diff --git a/manifests/database.pp b/manifests/database.pp index 28da3e25..3a9bd72d 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -2,6 +2,7 @@ # @api private class pulpcore::database ( Integer[0] $timeout = 3600, + Boolean $always_run_migrations = true, ) { if $pulpcore::postgresql_manage_db { include postgresql::client @@ -28,9 +29,17 @@ Class['postgresql::server::service'] ~> Service['pulpcore-content.service'] } + # By default we want to always run `migrate`, even if `--check` returns no pending migrations + # This is due to the fact that Pulp uses post_migration hooks that need to be executed even + # when no real migration has happened. + $migrate_unless = $always_run_migrations ? { + false => 'pulpcore-manager migrate --check', + default => undef, + } + pulpcore::admin { 'migrate --noinput': timeout => $timeout, - unless => 'pulpcore-manager migrate --check', + unless => $migrate_unless, refreshonly => false, } diff --git a/spec/acceptance/hieradata/common.yaml b/spec/acceptance/hieradata/common.yaml index 72518b13..411c62fb 100644 --- a/spec/acceptance/hieradata/common.yaml +++ b/spec/acceptance/hieradata/common.yaml @@ -3,3 +3,4 @@ apache::default_mods: false pulpcore::apache_https_cert: '/etc/pulpcore-certs/ca-cert.pem' pulpcore::apache_https_key: '/etc/pulpcore-certs/ca-key.pem' pulpcore::apache_https_ca: '/etc/pulpcore-certs/ca-cert.pem' +pulpcore::database::always_run_migrations: false