Skip to content

How to ensure Exec[update_apt] is defined before apt::preferences_snippet is used?

On some systems of mine (Puppet 3.8.5-2~bpo8+1) I've seen a weird issue after enabling the future parser: apt::preferences_snippet fails because Puppet says it does not know about Exec[update_apt]. These nodes have include ::apt declared (transitively, via two class inclusions).

I've workaround'ed this problem with the following patch:

--- a/manifests/preferences_snippet.pp
+++ b/manifests/preferences_snippet.pp
@@ -7,6 +7,8 @@ define apt::preferences_snippet (
   $pin      = undef,
 ) {
 
+  include ::apt
+
   $real_package = $package ? {
     false   => $name,
     default => $package,

… but that feels wrong, at least because it forces the user of our apt module to pass parameters to the apt class via hiera.

Is there a better, canonical way to ensure Exec[update_apt] is defined before apt::preferences_snippet is used?