Add enablement parameter for bootstrap RPMs#501
Add enablement parameter for bootstrap RPMs#501ehelms wants to merge 1 commit intotheforeman:masterfrom
Conversation
Signed-off-by: Eric D. Helms <ericdhelms@gmail.com>
| copy_sources | ||
| write_specfile | ||
| build_rpm | ||
| if resource[:ensure] == :absent |
There was a problem hiding this comment.
This feels like an abuse of exists. I suppose it already was and I think this currently doesn't support noop mode, but this really is making it much worse. exists? should really answer the question if anything exists.
Looking at the source, I think this is the relevant bit:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L68-L95
So if anything, it should be changed to:
if resource[:ensure] == :absent
File.exist?(resource[:symlink]) || !all_rpms.empty? || !all_rpms(source: true).empty?
else
!File.exist?(resource[:symlink]) || all_rpms.empty? || all_rpms(source: true).empty? || rpm_changed?
endThen it will end up calling .create:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L16-L23
Or .destroy:
https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L25-L32
It's still not very nice, but since it's going away I think that's ok.
There was a problem hiding this comment.
This doesn't work as you have to have this part:
copy_sources
write_specfile
build_rpm
Which creates the temporary RPM to detect if the RPM has changed. Even if I include that in the else, all the tests break. That has been where this whole resource is tricky.
The RPM only needs to change if the input script, katello-rhsm-consumer, changes. To detect if the RPM exists with that script has mean that we need to temporarily generate the RPM, and then compare the generated RPM to the current latest one and see if it's changed.
This will allow us to disable the bootstrap RPM and the consumer RPM when we are ready. The only odd situation is if someone were to re-enable it the RPM counter would start back at 1 which clients with the RPM already would not upgrade to without being forced.