X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fppa.pp;h=a41c814f296e4a4f4c8f4462208ec3242e345a69;hb=f3735d2ba228fde8d2e119742e11bece4c2c78ac;hp=75f0a69574368316f4540567d00b92383645391b;hpb=45bc6b196245ccc3685a3cbead8213e9b8e40c96;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/ppa.pp b/manifests/ppa.pp index 75f0a69..a41c814 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -1,13 +1,21 @@ # ppa.pp -define apt::ppa( - -) { - include apt - - exec { "/usr/bin/add-apt-repository ${name}": - require => Package["python-software-properties"], - # TODO: unless => 'check' - } +define apt::ppa() { + + Class['apt'] -> Apt::Ppa[$title] + + exec { "apt-update-${name}": + command => "/usr/bin/aptitude update", + refreshonly => true, + } + + exec { "add-apt-repository-${name}": + command => "/usr/bin/add-apt-repository ${name}", + notify => Exec["apt-update-${name}"], + 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}.*$'", + } + } }