Defined Type: apt::package_from_component

Defined in:
modules/apt/manifests/package_from_component.pp

Overview

Parameters:

  • component (String)
  • packages (Variant[Array[String],Hash[String,String]]) (defaults to: [$name])
  • distro (String) (defaults to: "${::lsbdistcodename}-wikimedia")
  • uri (Stdlib::HTTPUrl) (defaults to: 'http://apt.wikimedia.org/wikimedia')
  • priority (Integer) (defaults to: 1001)
  • ensure_packages (Boolean) (defaults to: true)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'modules/apt/manifests/package_from_component.pp', line 44

define apt::package_from_component(
    String          $component,
    Variant[Array[String],Hash[String,String]] $packages        = [$name],
    String                                     $distro          = "${::lsbdistcodename}-wikimedia",
    Stdlib::HTTPUrl                            $uri             = 'http://apt.wikimedia.org/wikimedia',
    Integer                                    $priority        = 1001,
    Boolean                                    $ensure_packages = true,
) {
    include apt

    $exec_before = $ensure_packages ? {
        false => undef,
        default => $packages ? {
            Hash    => Package[$packages.keys],
            default => Package[$packages],
        }
    }

    # We should be able to use the exec defined in the apt class, however this didn't
    # see: 1f85c34357cb745e36d709e5e696bc92f42d8d2c
    exec {"exec_apt_${title}":
        command     => '/usr/bin/apt-get update',
        refreshonly => true,
        before      => $exec_before,
    }

    apt::repository { "repository_${title}":
        uri        => $uri,
        dist       => $distro,
        components => $component,
        notify     => Exec["exec_apt_${title}"],
    }

    # We already pin o=Wikimedia with priority 1001
    unless $distro == "${::lsbdistcodename}-wikimedia" and $priority == 1001 {
        apt::pin { "apt_pin_${title}":
            pin      => "release c=${component}",
            priority => $priority,
            package  => join($packages, ' '),
            notify   => Exec["exec_apt_${title}"],
        }
        if $ensure_packages {
            Apt::Pin["apt_pin_${title}"] {
                before   => Package[$packages],
            }
        }
    }

    if $ensure_packages {
        if $packages =~ Hash {
            $packages.each |$pkg, $ensure| {
                ensure_packages($pkg, {ensure => $ensure})
            }
        } else {
            ensure_packages($packages)
        }
    }
}