X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fsite%2Fmanifests%2Faptrepo.pp;h=148f9cf0b8a5862e46cba42307fc039518382545;hb=b6527ce00278fa0b57893dd148768f0b0481ad3a;hp=d0e34ecaf8dddfcb6145725186f4013a8b93d817;hpb=7abe65323c6bf5909c19fa7766af23048559c79d;p=mirror%2Fdsa-puppet.git diff --git a/modules/site/manifests/aptrepo.pp b/modules/site/manifests/aptrepo.pp index d0e34ecaf..148f9cf0b 100644 --- a/modules/site/manifests/aptrepo.pp +++ b/modules/site/manifests/aptrepo.pp @@ -1,63 +1,42 @@ -define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present, $require = []) { - +define site::aptrepo ( + $url='', + $suite='', + $components=[], + $key = undef, + $ensure = present +) { case $ensure { present: { if $key { - exec { "apt-key-update-${name}": - command => "apt-key add /etc/apt/trusted-keys.d/${name}.asc", - refreshonly => true, - } - - file { "/etc/apt/trusted-keys.d/${name}.asc": + file { "/etc/apt/trusted.gpg.d/${name}.gpg": source => $key, mode => '0664', - notify => Exec["apt-key-update-${name}"] } } } absent: { - if ($keyid) and ($key) { - file { "/etc/apt/trusted-keys.d/${name}.asc": - ensure => absent, - notify => Exec["apt-key-del-${keyid}"] - } - exec { "apt-key-del-${keyid}": - command => "apt-key del ${keyid}", - refreshonly => true, - } - } elsif $key { - file { "/etc/apt/trusted-keys.d/${name}.asc": + if $key { + file { "/etc/apt/trusted.gpg.d/${name}.gpg": ensure => absent, } - } elsif $keyid { - exec { "apt-key-del-${keyid}": - command => "apt-key del ${keyid}", - } } } default: { fail ( "Unknown ensure value: '$ensure'" ) } } - if $ensure == present { - if ! ($config or $template) { - fail ( "No configuration found for ${name}" ) + case $ensure { + present: { + if !($url and $suite) { + fail ( "Need both url and suite for $name" ) + } } + default: {} } - if $template { - file { "/etc/apt/sources.list.d/${name}.list": - ensure => $ensure, - content => template($template), - notify => Exec['apt-get update'], - require => $require, - } - } else { - file { "/etc/apt/sources.list.d/${name}.list": - ensure => $ensure, - source => $config, - notify => Exec['apt-get update'], - require => $require, - } + file { "/etc/apt/sources.list.d/${name}.list": + ensure => $ensure, + content => template('site/aptrepo.erb'), + notify => Exec['apt-get update'], } }