X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=64c65bbd09e41d595b902135d6fd5222138fb114;hb=836f16e946b316d7eb3a38fb38c9e1a2d064f557;hp=af6eebff0a4064ec35a52d178a570c4222b41609;hpb=749c3e185d2ae5816fa19645aa7b8928298487a0;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index af6eebf..64c65bb 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,24 +1,41 @@ # ppa.pp -define apt::ppa() { +define apt::ppa( + $release = $::lsbdistcodename +) { + include apt::params + include apt::update - Class['apt'] -> Apt::Ppa[$title] + $sources_list_d = $apt::params::sources_list_d - Exec { - unless => $name? { - /ppa:(.*)/ => "/bin/cat /etc/apt/sources.list /etc/apt/sources.list.d/* | /bin/egrep '^[^#].*ppa.*$1.*$'", - default => "/bin/cat /etc/apt/sources.list /etc/apt/sources.list.d/* | /bin/egrep '^[^#].*${title}.*$'", - } + if ! $release { + fail('lsbdistcodename fact not available: release parameter required') } - exec { "apt-update-${name}": - command => "/usr/bin/aptitude update", - refreshonly => true, + $filename_without_slashes = regsubst($name,'/','-','G') + $filename_without_ppa = regsubst($filename_without_slashes, '^ppa:','','G') + $sources_list_d_filename = "${filename_without_ppa}-${release}.list" + + if ! defined(Package['python-software-properties']) { + package { 'python-software-properties': } } exec { "add-apt-repository-${name}": command => "/usr/bin/add-apt-repository ${name}", - notify => Exec["apt-update-${name}"], + creates => "${sources_list_d}/${sources_list_d_filename}", + require => [ File[$sources_list_d], + Package['python-software-properties'] ], + notify => Exec['apt_update'], + } + + file { "${sources_list_d}/${sources_list_d_filename}": + ensure => file, + require => Exec["add-apt-repository-${name}"], + } + + # Need anchor to provide containment for dependencies. + anchor { "apt::ppa::${name}": + require => Class['apt::update'], } }