After adding an agent node to the development
environment, you try to stop Puppet service on it, and get a Does the directory exist?
error. Puppet agent
commands succeed on the node, but all other Puppet commands fail.
Error messages and logs
When running puppet resource service puppet ensure=stopped
on the agent, you get the following error:
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'development' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
On the primary server, in the puppetserver log at /var/log/puppetlabs/puppetserver/puppetserver.log
:
2021-03-10T00:43:19.824Z INFO [qtp1034541873-242] [puppetserver] Puppet Not Found: Could not find environment 'development'
This error occurs when the agent’s environment is set in the [main]
section of /etc/puppetlabs/puppet/puppet.conf
instead of in the [agent]
section. The development
environment does not exist on the agent, causing errors. For example:
\[main\] server = puppet.example.lab certname = agent.example.lab environment = development \[agent\] graph = true
Version and installation information
PE version: 2017.3.10 and later
OS: Any
Installation type: Any
Solution
To fix the issue, on the affected agent, edit /etc/puppetlabs/puppet/puppet.conf
so that the environment is set in [agent]
.
For example:
\[main\] server = puppet.example.lab certname = agent.example.lab \[agent\] graph = true environment = development
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles