Fix (#10451) - apt::ppa fails to "apt-get update" when new PPA source is added
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
1 # ppa.pp
2
3 define apt::ppa() {
4
5   Class['apt'] -> Apt::Ppa[$title]
6
7   exec { "apt-update-${name}":
8     command     => "/usr/bin/aptitude update",
9     refreshonly => true,
10   }
11
12   exec { "add-apt-repository-${name}":
13     command => "/usr/bin/add-apt-repository ${name}",
14     notify  => Exec["apt-update-${name}"],
15     unless => $name? {
16       /ppa:(.*)/ => "/bin/cat /etc/apt/sources.list /etc/apt/sources.list.d/* | /bin/egrep '^[^#].*ppa.*$1.*$'",
17       default    => "/bin/cat /etc/apt/sources.list /etc/apt/sources.list.d/* | /bin/egrep '^[^#].*${title}.*$'",
18     }
19   }
20 }
21