Move Package['python-software-properties'] to apt:ppa
[puppet-modules/puppetlabs-apt.git] / manifests / init.pp
index 068fb497c4933d3e9d7fb6af925c0a0ab459a581..e41cd3fdee7514b6373603d917638e3a77dbd28e 100644 (file)
@@ -29,23 +29,21 @@ class apt(
 ) {
 
   include apt::params
+  include apt::update
 
   validate_bool($purge_sources_list, $purge_sources_list_d)
 
-  $refresh_only_apt_update = $always_apt_update? {
-    true  => false,
-    false => true,
-  }
-
-  if ! defined(Package['python-software-properties']) {
-    package { 'python-software-properties': }
-  }
-
   $sources_list_content = $purge_sources_list ? {
-    false =>  undef,
+    false => undef,
     true  => "# Repos managed by puppet.\n",
   }
 
+  if $always_apt_update == true {
+    Exec <| title=='apt_update' |> {
+      refreshonly => false,
+    }
+  }
+
   $root           = $apt::params::root
   $apt_conf_d     = $apt::params::apt_conf_d
   $sources_list_d = $apt::params::sources_list_d
@@ -58,6 +56,7 @@ class apt(
     group   => root,
     mode    => '0644',
     content => $sources_list_content,
+    notify  => Exec['apt_update'],
   }
 
   file { 'sources.list.d':
@@ -67,12 +66,7 @@ class apt(
     group   => root,
     purge   => $purge_sources_list_d,
     recurse => $purge_sources_list_d,
-  }
-
-  exec { 'apt_update':
-    command     => "${provider} update",
-    subscribe   => [ File['sources.list'], File['sources.list.d'] ],
-    refreshonly => $refresh_only_apt_update,
+    notify  => Exec['apt_update'],
   }
 
   case $disable_keys {
@@ -89,7 +83,7 @@ class apt(
         path   => "${apt_conf_d}/99unauth",
       }
     }
-    undef: { } # do nothing
+    undef:   { } # do nothing
     default: { fail('Valid values for disable_keys are true or false') }
   }