fixes #18261 - Run pulp-manage-db on ostree enable #500
Conversation
This hook will run pulp-manage-db on --katello-enable-ostree=true or --katello-devel-enable-ostree=true
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.
@parthaa LGTM, is there a way that this can be added into puppet though based on the talk with stbejnam?
What I was thinking is another pulp-manage-db exec in https://github.com/Katello/puppet-pulp/blob/master/manifests/database.pp that only runs when refreshed, and set up a notify in puppet-katello when ostree is enabled. I'd like to see what @ekohl or @ehelms thinks about that idea, not sure if it makes sense. I'd prefer not to do things in hooks, especially since this will run in every post |
I tend to agree with @stbenjam. Given that you can enable plugins via puppet-pulp, that module should be able to handle ensuring proper database state if a plugin is enabled. I think this might be more complicated no matter the solution with newer Pulps the workers, resource manager and celerybeat all have to be stopped for db manage to run. |
I believe https://github.com/Katello/puppet-pulp/blob/74fb5e2c9b666253ae0bc3b4465f2344b8f235d2/manifests/install.pp#L46 should be the line that knows the database should be updated. I sort of agree with @stbenjam that that should trigger another exec. Since the guard is the existence of exec { 'force database migration':
command => 'rm -f /var/lib/pulp/init.flag',
refreshonly => true,
before => Exec['migrate_pulp_db'],
} If other plugins need a similar mechanism then it can easily be reused. |
@parthaa I think we talked about this on IRC briefly but I'm wondering if it can be a pre-start exec in the systemd unit file. That way we can simply restart the service from puppet and end up with a migrated database. The only thing is that a sysadmin might not expect a startup to take long after an upgrade, but wouldn't that be an inconsistent state anyway? |
After discussing on IRC, one of the limitations is the pulp services must be stopped prior to a migration. So, first thing is - I think this should be abstracted to be generic. In Pulp, you'd add some generic define: define pulp::plugin(
# we need some stuff here to customize things, like package name, etc
$version = ...
$package = ...
$whatever = ...
) {
package { "pulp-${name}-plugins":
ensure => present,
notify => Exec['force-pulp-migration'],
}
# anything else needed for a pulp plugin
} And then you can adapt @ekohl's example to do something like this: exec { 'force-pulp-migration':
command => 'rm -f /var/lib/pulp/init.flag',
refreshonly => true,
before => Exec['migrate_pulp_db'],
} ~>
exec { 'stop pulp services':
command => 'service stop pulp_workers && service stop pulp_resource_manager && service stop pulp_celerybeat',
refreshonly => true,
} That will ensure the services are stopped. You don't actually need to start them again. The database migration task occurs before service, so they should get started again there. |
@stbenjam my first attempt at that was theforeman/puppet-pulp#240. It's a step in that direction, but I'm not 100% sure yet we can reach that goal. |
It looks like this PR had a lot of discussion and then stopped. Is it still outstanding? |
This repository has been deprecated and merged into https://github.com/theforeman/foreman-installer (#731). If this is still relevant, please resubmit the PR there. |
This hook will run pulp-manage-db on
--katello-enable-ostree=true or --katello-devel-enable-ostree=true