# ppa.pp
-define apt::ppa(
+define apt::ppa() {
-) {
- include apt
+ Class['apt'] -> Apt::Ppa[$title]
- package { "python-software-properties": }
+ exec { "apt-update-${name}":
+ command => "/usr/bin/aptitude update",
+ refreshonly => true,
+ }
- exec { "/usr/bin/add-apt-repository ${name}":
- require => Package["python-software-properties"],
- # TODO: unless => 'check'
- }
+ 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}.*$'",
+ }
+ }
}