使用modulepath运行puppet时找不到类

时间:2015-01-05 22:23:09

标签: vagrant puppet

使用模块路径开关运行puppet,失败并显示Error: Could not find class apt for vagrant.example.com on node vagrant.example.com

Puppet版本是由Vagrant和VirtualBox管理的Ubuntu 14.04上运行的3.7.3

这是我正在运行的命令:

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

输出

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

/ tmp / vagrant-puppet-3 / manifests / default.pp`

的内容
node default 
{ 
  include apt
}

/ 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

使用相同的模块路径运行puppet module list确实列出了模块(包括我引用的puppetlabs-apt),尽管有依赖性警告。

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)

奇怪的是puppet module list似乎找到了模块,但引用我的清单文件中的任何模块都失败了(如果我尝试包含postgresql,则会出现相同的类错误)。我觉得我的清单文件是错误的。我错过了一些明显的东西吗?

干杯

1 个答案:

答案 0 :(得分:3)

将模块文件夹puppetlabs-apt重命名为apt

或更改pp代码

include apt 

include puppetlabs-apt

取决于您在apt pp文件中的定义方式。

相关问题