Skip to content

(PUP-11201) Refine when the last used environment is used #8733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

GabrielNagy
Copy link
Contributor

With the recent changes in PUP-10216, the agent stores the last used environment in last_run_summary.yaml. If the next run does not specify an environment on the CLI, then the last used environment always takes precedence over the environment specified in puppet.conf.

This change makes an exception for the agent-specified case so that the second run only uses the environment from the previous run if it was server-specified. Otherwise, the agent should start in its configured environment (from puppet.conf) or default to "production".

@GabrielNagy GabrielNagy force-pushed the PUP-11201/refine-last-used-env branch 5 times, most recently from 1c0c231 to 8392cb6 Compare August 9, 2021 13:41
With the recent changes in PUP-10216, the agent stores the last used
environment in `last_run_summary.yaml`. If the next run does not specify
an environment on the CLI, then the last used environment always takes
precedence over the environment specified in puppet.conf.

This change makes an exception for the agent-specified case so that the
second run only uses the environment from the previous run if it was
server-specified. Otherwise, the agent should start in its configured
environment (from puppet.conf) or default to "production".
@GabrielNagy GabrielNagy marked this pull request as ready for review August 9, 2021 13:43
@GabrielNagy GabrielNagy requested review from a team August 9, 2021 13:43
@ciprianbadescu
Copy link
Contributor

jenkins please test this with servertests

if last_agent_environment
@environment = last_agent_environment
report.environment = last_agent_environment
unless (cached_catalog || options[:catalog] || Puppet.settings.set_by_cli?(:environment) || Puppet[:strict_environment_mode])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Puppet[:strict_environment_mode] is set, or if environment is set via CLI, there is no point in checking the lastrunfile; we just assume it's authoritative and fail further down if needed.

@ciprianbadescu ciprianbadescu requested a review from a team August 10, 2021 11:23
@GabrielNagy GabrielNagy merged commit 500e514 into puppetlabs:6.x Aug 10, 2021
@GabrielNagy GabrielNagy deleted the PUP-11201/refine-last-used-env branch August 10, 2021 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants