(#14657) Fix filename when there is a period in the PPA
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
index 578c81df7123c3f0171fddc6d222a410190a9c8d..6b38e52d63164b8249adea6e2b5142829c54050d 100644 (file)
@@ -3,9 +3,6 @@
 define apt::ppa(
   $release = $::lsbdistcodename
 ) {
-
-  Class['apt'] -> Apt::Ppa[$title]
-
   include apt::params
   include apt::update
 
@@ -15,8 +12,9 @@ define apt::ppa(
     fail('lsbdistcodename fact not available: release parameter required')
   }
 
-  $filename_without_slashes = regsubst($name,'/','-','G')
-  $filename_without_ppa     = regsubst($filename_without_slashes, '^ppa:','','G')
+  $filename_without_slashes = regsubst($name, '/', '-', G)
+  $filename_without_dots    = regsubst($filename_without_slashes, '\.', '_', G)
+  $filename_without_ppa     = regsubst($filename_without_dots, '^ppa:', '', G)
   $sources_list_d_filename  = "${filename_without_ppa}-${release}.list"
 
   if ! defined(Package['python-software-properties']) {
@@ -26,7 +24,8 @@ define apt::ppa(
   exec { "add-apt-repository-${name}":
     command => "/usr/bin/add-apt-repository ${name}",
     creates => "${sources_list_d}/${sources_list_d_filename}",
-    require => Package['python-software-properties'],
+    require => [ File[$sources_list_d],
+                 Package['python-software-properties'] ],
     notify  => Exec['apt_update'],
   }