Defined Type: apt::package_from_component

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

Overview

Parameters:

  • component (String)
  • packages (Array[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)


32
33
34
35
36
37
38
39
40
41
42
43
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
# File 'modules/apt/manifests/package_from_component.pp', line 32

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

    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, ' '),
            before   => Package[$packages],
            notify   => Exec["exec_apt_${title}"],
        }
    }

    package { $packages:
        ensure  => present,
        require => [Apt::Repository["repository_${title}"], Exec["exec_apt_${title}"]],
    }

    exec {"exec_apt_${title}":
        command     => '/usr/bin/apt-get update',
        refreshonly => true,
    }
}