木偶申请'找不到班级'

时间:2015-02-25 16:04:51

标签: puppet puppet-enterprise

这是一个非常简单的问题,我已经阅读了一些建议的解决方案,但我仍然无法获得puppet申请导入git :: config类。这是我的文件设置:

我通过nodes.pp导入git模块:

#/etc/puppet/manifests/nodes.pp
node default {
}
include git

site.pp导入nodes.pp:

#/etc/puppet/manifests/site.pp
import 'nodes.pp'

git模块定义如下:

#/etc/puppet/modules/git/manifests/init.pp
class git {
    include git::install
    include git::config
}
class git::install{
    package {'git': => present }
}

和配置文件:

#/etc/puppet/modules/git/manifests/config.pp
define git::config{
    [some code here]
}

当我运行puppet apply时,puppet找不到git :: config类:

sudo puppet apply --modulepath=/etc/puppet/modules /etc/puppet/manifests/site.pp
Error: Could not find class git::config for xxxx on node xxxx.

原始模块是puppetlabs-git(相同的文件夹结构),但我使用简化的文件结构(上面)重新创建了错误。

更新1

上面的错误,git config.pp和init.pp在文件夹/ modules / git / manifests中,config.pp文件读取'define git :: config'

2 个答案:

答案 0 :(得分:5)

您的木偶代码结构错误。您需要移动您的pp文件以显示文件夹。

/etc/puppet/modules/git/init.pp
/etc/puppet/modules/git/config.pp

/etc/puppet/modules/git/manifests/init.pp
/etc/puppet/modules/git/manifests/config.pp

答案 1 :(得分:5)

您无法在include上致电git::configgit::configdefined type,而非class。使用defined type的语法如下:

git::config { 'the_name_var':
  param1 => 'foo',
  param2 => 'bar'
}

希望这有帮助

相关问题