Allow duplicate $required_packages
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
index 9c277e9bd4534ec35d7859a17706e5a1616f2ec4..a41c814f296e4a4f4c8f4462208ec3242e345a69 100644 (file)
@@ -1,18 +1,21 @@
 # ppa.pp
 
-define apt::ppa(
+define apt::ppa() {
 
-) {
-    require apt
+  Class['apt'] -> Apt::Ppa[$title]
 
-    exec { "apt-update-${name}":
-        command     => "/usr/bin/aptitude update",
-        refreshonly => true,
-    }
+  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}"],
+  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}.*$'",
     }
+  }
 }