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
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
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
Installation type: Any
To fix the issue, on the affected agent, edit
/etc/puppetlabs/puppet/puppet.conf so that the environment is set in
\[main\] server = puppet.example.lab certname = agent.example.lab \[agent\] graph = true environment = development
How can we improve this article?
Please sign in to leave a comment.