Reputation: 135
I'm trying to deploy an application called Bag-Of-Holding via Puppet using the instruction as posted on github - https://github.com/ribeiroit/boh-puppet
I run the command: sudo puppet apply /etc/puppet/manifests/site.pp
and I get the error below:
Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class boh at /etc/puppet/manifests/site.pp:2:2 on node lab1-hp-elitebook-8570p
It appears the puppet is having hard time finding the class boh
which is already in the manifest folder
This is my directory tree:
/etc/puppet
├── code
├── manifests
└── modules
└── boh-puppet
├── manifests
└── templates
my site.pp
file is located in /etc/puppet/manifests
and it looks like this:
node 'lab1-hp-elitebook-8570p' {
class { 'boh':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}
And init.pp
file has the class {boh }
and that's located at:
/etc/puppet/modules/boh-puppet/manifests
Any ideas how to fix this?
Upvotes: 3
Views: 16339
Reputation: 28774
Puppet requires certain namespace restrictions and conventions with module directory structure and class names when autoloading. In this case, your problem can be solved most simply and cleanly to follow normal conventions by renaming your module directory of boh-puppet
to simply boh
. That will fix your issue.
Consult the documentation here for more information: https://puppet.com/docs/puppet/4.10/lang_namespaces.html
Since you are using puppet apply
with absolute paths, you will also need to supply the path to your modules by modifying the command to: sudo puppet apply --modulepath=/etc/puppet/modules /etc/puppet/manifests/site.pp
.
Upvotes: 3
Reputation: 4777
You are not calling the module name properly. This should work:
node 'lab1-hp-elitebook-8570p' {
class { 'boh-puppet':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}
or the fqn this:
node 'lab1-hp-elitebook-8570p' {
class { '::boh-puppet':
python_version => 3,
environment => 'dev',
language => 'en',
debug => 'True',
create_superuser => 'true',
pkg_checksum => '86b0164f7fd6c5e4aa43c8f056f08cea'
}
}
Upvotes: 0