Search code examples
vagrantpuppet

Could not find class when running puppet apply with modulepath


Running puppet apply with the modulepath switch fails with Error: Could not find class apt for vagrant.example.com on node vagrant.example.com

Puppet version is 3.7.3 running on Ubuntu 14.04 managed by Vagrant and VirtualBox

This is the command I'm running:

sudo puppet apply --debug --verbose --modulepath '/tmp/vagrant-puppet-3/modules-0' /tmp/vagrant-puppet-3/manifests/default.pp

The output

vagrant@vagrant:~$ sudo puppet apply --debug --verbose --modulepath '/tmp/vagrant-puppet-3/modules-0'  /tmp/vagrant-puppet-3/manifests/default.pp
Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
   (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')
Debug: Runtime environment: puppet_version=3.7.3, ruby_version=1.9.3, run_mode=user, default_encoding=US-ASCII
Info: Loading facts
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-apt/lib/facter/apt_update_last_success.rb
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-apt/lib/facter/apt_updates.rb
Info: Loading facts
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-concat/lib/facter/concat_basedir.rb
Info: Loading facts
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-stdlib/lib/facter/facter_dot_d.rb
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-stdlib/lib/facter/pe_version.rb
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-stdlib/lib/facter/puppet_vardir.rb
Debug: Loading facts from /tmp/vagrant-puppet-3/modules-0/puppetlabs-stdlib/lib/facter/root_home.rb
Error: Could not find class apt for vagrant.example.com on node vagrant.example.com
Error: Could not find class apt for vagrant.example.com on node vagrant.example.com

The content of /tmp/vagrant-puppet-3/manifests/default.pp`

node default 
{ 
  include apt
}

The content of /tmp/vagrant-puppet-3/modules-0

drwxr-xr-x 1 root vagrant  714 Jan  5 20:03 puppetlabs-apt
drwxr-xr-x 1 root vagrant  680 Jan  5 20:03 puppetlabs-concat
drwxr-xr-x 1 root vagrant  782 Jan  5 20:03 puppetlabs-postgresql
drwxr-xr-x 1 root vagrant  782 Jan  5 20:03 puppetlabs-stdlib

Running puppet module list with same modulepath does indeed list the modules (including puppetlabs-apt which I'm refering to), albeit with dependencies warnings.

vagrant@vagrant:~$ puppet module list --debug --verbose --modulepath '/tmp/vagrant-puppet-3/modules-0'
Warning: Missing dependency 'puppetlabs-apt':
  'puppetlabs-postgresql' (v4.1.0) requires 'puppetlabs-apt' (>=1.1.0 <2.0.0)
Warning: Missing dependency 'puppetlabs-concat':
  'puppetlabs-postgresql' (v4.1.0) requires 'puppetlabs-concat' (>= 1.1.0 <2.0.0)
Warning: Missing dependency 'puppetlabs-stdlib':
  'puppetlabs-apt' (v1.7.0) requires 'puppetlabs-stdlib' (>= 2.2.1)
  'puppetlabs-concat' (v1.1.2) requires 'puppetlabs-stdlib' (>= 3.2.0 < 5.0.0)
  'puppetlabs-postgresql' (v4.1.0) requires 'puppetlabs-stdlib' (v4.x)
/tmp/vagrant-puppet-3/modules-0
├── puppetlabs-apt (v1.7.0)
├── puppetlabs-concat (v1.1.2)
├── puppetlabs-postgresql (v4.1.0)
└── puppetlabs-stdlib (v4.5.0)

The strange thing is that puppet module list seems to be finding the modules, but referring to any of the modules in my manifest file fails (same class error if I try to include postgresql). I have a feeling that my manifest file is wrong. Am I missing something obvious here?

Cheers


Solution

  • rename the module folder puppetlabs-apt to apt

    or change the pp code

    from

    include apt 
    

    to

    include puppetlabs-apt
    

    Depend on how you defined in apt pp file.