-
Notifications
You must be signed in to change notification settings - Fork 21
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
Clear cached provider properties after transition #8
Clear cached provider properties after transition #8
Conversation
|
I had an AIX 7.1 box that was failing to upgrade the |
| @@ -34,6 +34,10 @@ def transition | |||
|
|
|||
| # TODO: Find a better way to log the results ??? | |||
|
|
|||
| # Clean cached state from the catalog resource since it was just | |||
| # altered. | |||
| catalog_resource.provider.instance_variable_set(:@property_hash, {}) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not the biggest fan of this since it does manipulate an internal instance variable. But, it seems like the only approach that will preserve existing references to the provider instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there another way that you could use set to achieve the same goal?
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider.rb#L535-L544
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at set, but the problem there is that it can update properties, but not remove them. So, set can't be used to purge stale data in order to force a re-load.
|
Ping @puppetlabs/modules for review. |
|
@puppetlabs/modules Anything else needed on this one, or is it good for a merge+release? AIX upgrades are completely broken without something to address the pre-fetched state issue. |
|
After chatting with Hunner a bit, we've decided to see if re-triggering prefetch for a single resource would work using something like: unless catalog_resource.provider.nil?
provider_class = catalog_resource.provider.class
provider_class.prefetch({ catalog_resource.name => catalog_resource}) if provider_class.respond_to?(:prefetch)
endThis would refresh the prefetched state using the same process that initially loaded it. I'll see if this approach is workable and update the PR. |
A transition resource does the equivalent of an out-of-band `puppet resource ...` operation. This means that the catalog will end up containg a resource with a stale state if pre-fetching was triggered before the transition. An example of this is a package resource in the catalot that the agent thinks is present, because it was when pre-fetch happened, but is actually absent because of a Transition. This patch clears cached state from the catalog resource so that it will be re-fetched when the resource is evaluated.
85a5526
to
1d17e9c
Compare
|
PR updated with a more robust implementation that uses |
|
ping @puppetlabs/modules for another review after @Sharpie's update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it should handle standard and prefetching resources for ensuring present, changing properties, and ensuring absent. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I haven't dived into prefetch internals to know if there are any booby traps that come from re-fetching state, but I'm 👍 to the concept.
|
This patch also just resolved an issue with transition upgrading Splunk on Solaris. |
This increases the minimum version requirement for the puppetlabs-transition module from 0.1.0 to 0.1.1. There was a very important bug fix in 0.1.1 that allows puppet-agent to be upgraded on AIX servers. Prior versions were unable to automatically update puppet-agent due to inconsistent state caching. See: puppetlabs/puppetlabs-transition#8
This increases the minimum version requirement for the puppetlabs-transition module from 0.1.0 to 0.1.1. There was a very important bug fix in 0.1.1 that allows puppet-agent to be upgraded on AIX servers. Prior versions were unable to automatically update puppet-agent due to inconsistent state caching. See: puppetlabs/puppetlabs-transition#8
A transition resource does the equivalent of an out-of-band
puppet resource ...operation. This means that the catalog will end upcontaing a resource with a stale state if pre-fetching was triggered before
the transition. An example of this is a package resource in the catalot that
the agent thinks is present, because it was when pre-fetch happened, but is
actually absent because of a Transition. This patch clears cached state from
the catalog resource so that it will be re-fetched when the resource
is evaluated.