我正在尝试使用github - https://github.com/ribeiroit/boh-puppet上发布的指令,通过木偶部署一个名为袋抱的应用程序。
我运行命令:sudo puppet apply /etc/puppet/manifests/site.pp并得到以下错误:
错误:评估错误:在计算资源语句时出错,无法在节点lab1-hp-elitebook-8570p上找到已声明的类boh (在/etc/ not /舱单/site.pp:2:2)。
似乎木偶很难找到已经在清单文件夹中的类boh。
这是我的目录树:
/etc/puppet
├── code
├── manifests
└── modules
└── boh-puppet
├── manifests
└── templates我的site.pp文件位于/etc/puppet/manifests中,如下所示:
node 'lab1-hp-elitebook-8570p' {
class { 'boh':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}init.pp文件具有class {boh },它位于:/etc/puppet/modules/boh-puppet/manifests
有什么办法解决这个问题吗?
发布于 2017-11-14 12:30:57
在自动加载时,木偶需要某些带有模块目录结构和类名的命名空间限制和约定。在这种情况下,通过将boh-puppet的模块目录重命名为简单的boh,可以最简单、最干净地解决问题,从而遵循正常的约定。这会解决你的问题。
有关更多信息,请参阅此处的文档:namespaces.html
由于您使用的是具有绝对路径的puppet apply,因此还需要通过将命令修改为:sudo puppet apply --modulepath=/etc/puppet/modules /etc/puppet/manifests/site.pp来向模块提供路径。
发布于 2017-11-14 11:25:30
您不能正确地调用模块名。这应该是可行的:
node 'lab1-hp-elitebook-8570p' {
class { 'boh-puppet':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}或者fqn这个:
node 'lab1-hp-elitebook-8570p' {
class { '::boh-puppet':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}https://stackoverflow.com/questions/47275288
复制相似问题