Force owner and mode on ppa files
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
index 730bf7d198f452728097879841d83008f77531eb..3c4dc3194e9df8f88dcd5be400dc122a8e183339 100644 (file)
@@ -14,6 +14,10 @@ define apt::ppa(
     fail('lsbdistcodename fact not available: release parameter required')
   }
 
+  if $::operatingsystem != 'Ubuntu' {
+    fail("apt::ppa is currently supported on Ubuntu only.")
+  }
+
   $filename_without_slashes = regsubst($name, '/', '-', 'G')
   $filename_without_dots    = regsubst($filename_without_slashes, '\.', '_', 'G')
   $filename_without_ppa     = regsubst($filename_without_dots, '^ppa:', '', 'G')
@@ -45,6 +49,7 @@ define apt::ppa(
         environment  => $proxy_env,
         command      => "/usr/bin/add-apt-repository ${options} ${name}",
         unless       => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}",
+        user         => 'root',
         logoutput    => 'on_failure',
         notify       => Exec['apt_update'],
         require      => [
@@ -62,6 +67,9 @@ define apt::ppa(
 
     file { "${sources_list_d}/${sources_list_d_filename}":
         ensure => 'absent',
+        mode   => '0644',
+        owner  => 'root',
+        gruop  => 'root',
         notify => Exec['apt_update'],
     }
   }