Skip to content

Commit

Permalink
Allow disabling migration re-runs to make things idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Aug 14, 2024
1 parent 5750cff commit 6836133
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,8 +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 => $migrate_unless,
refreshonly => false,
}

Expand Down
1 change: 1 addition & 0 deletions spec/acceptance/hieradata/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6836133

Please sign in to comment.