Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Duplicate
-
PUP 5.5.20, PUP 6.15.0
-
None
-
None
-
None
-
CentOS 7
-
Needs Assessment
-
Needs Assessment
Description
Puppet Version: 6.15.0
Puppet Server Version: 6.12.0 (open source)
OS Name/Version: CentOS 7
When running puppet agent -t against an environment that doesn't exist, the Puppet run doesn't fail quickly and instead makes the following requests in order, all of which respond with a 404 (except for the catalog request, which gets a 500 response):
- GET /puppet/v3/node
- GET /puppet/v3/file_metadatas/pluginfacts
- GET /puppet/v3/file_metadata/pluginfacts
- GET /puppet/v3/file_metadatas/plugins
- GET /puppet/v3/file_metadata/plugins
- GET /puppet/v3/file_metadatas/locales
- GET /puppet/v3/file_metadata/locales
- POST /puppet/v3/catalog/
From the agent's view, that looks like this:
$ sudo puppet agent -t --environment not_a_real_env
|
Warning: Unable to fetch my node definition, but the agent run will continue:
|
Warning: Find /puppet/v3/node/agent.corp.net resulted in 404 with the message: {"message":"Not Found: Could not find environment 'not_a_real_env'","issue_kind":"RUNTIME_ERROR"}
|
Info: Retrieving pluginfacts
|
Error: /File[/opt/puppetlabs/puppet/cache/facts.d]: Could not evaluate: Could not retrieve information from environment not_a_real_env source(s) puppet:///pluginfacts
|
Info: Retrieving plugin
|
Warning: /File[/opt/puppetlabs/puppet/cache/lib/facter]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/lib/facter/facter_dot_d.rb]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/lib/facter/package_provider.rb]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/lib/facter/pe_version.rb]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/lib/facter/puppet_settings.rb]: Skipping because of failed dependencies
|
|
...(snip 100's of lines of failed pluginsync files)...
|
|
Info: Retrieving locales
|
Error: /File[/opt/puppetlabs/puppet/cache/locales]: Could not evaluate: Could not retrieve information from environment not_a_real_env source(s) puppet:///locales
|
Notice: /File[/opt/puppetlabs/puppet/cache/locales/ja]: Dependency File[/opt/puppetlabs/puppet/cache/locales] has failures: true
|
Warning: /File[/opt/puppetlabs/puppet/cache/locales/ja]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/locales/ja/puppetlabs-stdlib.po]: Skipping because of failed dependencies
|
Warning: /File[/opt/puppetlabs/puppet/cache/locales/ja/puppetlabs-tomcat.po]: Skipping because of failed dependencies
|
Info: Loading facts
|
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Internal Server Error: java.lang.IllegalStateException: Non-zero exit code returned while running '/etc/puppetlabs/puppet/code-id.sh'. exit-code: '1', stdout: '', stderr: '/etc/puppetlabs/puppet/code-id.sh: line 19: cd: /etc/puppetlabs/code/environments/not_a_real_env: No such file or directory
|
'
|
Warning: Not using cache on failed catalog
|
Error: Could not retrieve catalog; skipping run
|
The problem here is that there is clearly a "404 environment not found" error on the first line yet the agent continues to request a catalog and the master tries to serve one. Even going so far as to run the static catalog code-id.sh scripts which also error out because there is no environment.
This spews a ton of errors and warning at the user and doesn't make it clear that the problem is simply that the requested environment doesn't exist. This also causes more load than it should when the entire transaction could probably be killed early once the request for the node object returns a 404.
Desired Behavior: When an agent requests an environment that doesn't exist, the entire transaction stops after the initial request of GET /puppet/v3/node, pluginsync doesn't get attempted, a catalog doesn't get requested, and the static catalog code-id scripts don't get run.
Actual Behavior: All of the above happens even though the requested environment doesn't exist, and the user that ran Puppet has to wade through dozens of lines of errors messages to figure out what went wrong.
Additional Thoughts: Is there maybe a setting to "fail fast" that I'm just not aware of? Like a "stop if environment not found" type of setting?