Notifying apt module “apt_update” from custom puppet module

aptpuppet

I'm trying to configure APT to not install recommended packages. I'm using puppetforge puppetlabs/apt module so I wish to notify the Exec['apt_update'] resource from that module.

I'm using this:

  class init {

    include apt

    # Configure apt to not install recommends
    file { "/etc/apt/apt.conf.d/80mymodule-norecommends":
        ensure => present,
        owner => root,
        group => root,
        mode => 644,  
        source => "puppet:///modules/mymodule/apt/80mymodule-norecommends",
        notify => Exec['apt_update'],
    }

  }

However I get the following error:

Could not find dependent Exec[apt_update] for
File[/etc/apt/apt.conf.d/80mymodule-norecommends] at
/etc/puppet/modules/mymodule/manifests/apt.pp:18

I have tried several syntax options (like notify => Apt::Exec['apt_update'],) but I don't get why I can't notify that resource.

Best Answer

As Felix said, I had some apt class shadowing the one from the module.

I replaced:

include apt

with:

include ::apt

And the issue was fixed.

Related Topic