Skip to content
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

(MODULES-10666) Stop agent run after an upgrade #496

Conversation

GabrielNagy
Copy link
Contributor

Previously, when evaluating additional resources after a puppet-agent
upgrade, we could get to a point where we had a mixture of old/new
Ruby code loaded in memory. This may cause unexpected behavior if the
new code tries to execute something not available in the already
loaded old code.

This commit introduces a new type/provider that is evaluated whenever
a puppet-agent upgrade happens on a platform managed with the package
resource (AIX, Debian, EL, Suse).

The newly added resource attempts to figure out if a Puppet upgrade
was performed, then stops the run altogether. If Puppet is being run
as a service, the HUP signal will have the daemon trigger a subsequent
Puppet run that will evaluate the remaining resources.

When running puppet agent -t manually, it is up to the user to rerun
the command after the puppet-agent upgrade.

@GabrielNagy GabrielNagy requested review from joshcooper, npwalker and a team May 21, 2020 14:06
@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch from bc58bf1 to 9d717fe Compare May 21, 2020 14:24
@GabrielNagy GabrielNagy marked this pull request as ready for review May 21, 2020 14:24
@puppetcla
Copy link

CLA signed by all contributors.

@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch 6 times, most recently from 4a78fd6 to 7d4d3d5 Compare May 29, 2020 12:50
@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch from 7d4d3d5 to 6ed2d85 Compare June 11, 2020 08:25
@GabrielNagy
Copy link
Contributor Author

I added a note in the readme to reflect this change in functionality. This should be ready to merge now.

Copy link
Contributor

@gimmyxd gimmyxd left a comment

Choose a reason for hiding this comment

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

Just a small remark about method naming, otherwise LGTM.

false
end

def needs_upgrade
Copy link
Contributor

@gimmyxd gimmyxd Jun 11, 2020

Choose a reason for hiding this comment

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

you could rename this to needs_upgrade? as it is the convention for methods that return a boolean

LE: also you could make this method private

@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch 2 times, most recently from 5214a6c to 92f4f73 Compare June 11, 2020 13:20
@GabrielNagy
Copy link
Contributor Author

GabrielNagy commented Jun 11, 2020

Hmm, ad-hoc is failing on Debian-based platforms. I'll check that.

All green!

image

@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch 2 times, most recently from eb8b0e7 to 4883763 Compare June 11, 2020 14:52
Previously, when evaluating additional resources after a puppet-agent
upgrade, we could get to a point where we had a mixture of old/new
Ruby code loaded in memory. This may cause unexpected behavior if the
new code tries to execute something not available in the already
loaded old code.

This commit introduces a new type/provider that is evaluated whenever
a puppet-agent upgrade happens on a platform managed with the package
resource (AIX, Debian, EL, Suse).

The newly added resource attempts to figure out if a Puppet upgrade
was performed, then stops the run altogether. If Puppet is being run
as a service, the HUP signal will have the daemon trigger a subsequent
Puppet run that will evaluate the remaining resources.

When running `puppet agent -t` manually, it is up to the user to rerun
the command after the puppet-agent upgrade.
@GabrielNagy GabrielNagy force-pushed the MODULES-10666/stop-run-after-upgrade branch from 4883763 to d26fab5 Compare June 11, 2020 15:23
@mihaibuzgau mihaibuzgau merged commit 3ecfcab into puppetlabs:master Jun 12, 2020
GabrielNagy added a commit to GabrielNagy/puppetlabs-puppet_agent that referenced this pull request Jun 15, 2020
We've chosen to do a major release due to the significant changes
brought on by MODULES-10666.

See: puppetlabs#496
GabrielNagy added a commit to GabrielNagy/puppetlabs-puppet_agent that referenced this pull request Jun 15, 2020
We've chosen to do a major release due to the significant changes
brought on by MODULES-10666.

See: puppetlabs#496
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.

6 participants