Project

General

Profile

« Previous | Next » 

Revision a32b6639

Added by Dominic Cleal over 9 years ago

fixes #9101 - refresh db:migrate if DB class changes or settings are missing

When the DB is missing, the foreman::database::${type} class will refresh as
it recreates it, and now triggers the migration. On a clean install, this was
working mostly by luck as foreman::config refreshed everything.

foreman_config_entry didn't cause a refresh due to ignore_missing, which meant
it would only help when Foreman settings had been initialised, but before the
migration had completed. With an empty DB, it wouldn't work.

Removing ignore_missing means foreman_config_entry will also continue to
refresh the db:migrate until the setting is populated, and the migration
completes.

Only compatible with Foreman 1.7+ as it'll cause continuous refreshes on older
versions without the setting.

View differences:

manifests/database.pp
$foreman_service = Class['foreman::service']
}
class { $db_class: } ->
class { $db_class: } ~>
foreman_config_entry { 'db_pending_migration':
value => false,
dry => true,
ignore_missing => true,
value => false,
dry => true,
} ~>
foreman::rake { 'db:migrate': } ->
foreman::rake { 'db:migrate': } ~>
foreman_config_entry { 'db_pending_seed':
value => false,
dry => true,
ignore_missing => true,
value => false,
dry => true,
# to address #7353: settings initialization race condition
before => $foreman_service,
before => $foreman_service,
} ~>
foreman::rake { 'db:seed':
environment => delete_undef_values($seed_env),

Also available in: Unified diff