Update mistral::db::sync to run 'update head'
This patch modifies mistral::db::sync so that it runs 'update head' in addition to 'populate'. This brings the mistral "db_sync" class more inline with other Puppet Openstack modules that run DB sync and fixes issues in bootstrapping mistral in that running populate without first having an 'upgrade head' would always fail. Both actions appear to be idempotent so re-running them should be fine. Change-Id: I13f037c3eea944d5f41ced904623e38ce3fcae44
This commit is contained in:
parent
368d53e24f
commit
16a00799a9
@ -50,6 +50,6 @@ class mistral::db::postgresql(
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Postgresql['mistral'] ~> Exec<| title == 'mistral-dbsync' |>
|
||||
::Openstacklib::Db::Postgresql['mistral'] ~> Exec<| title == 'mistral-db-sync' |>
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,34 @@
|
||||
#
|
||||
# Class to execute "mistral-dbsync"
|
||||
# Class to execute "mistral-db-manage 'upgrade head' and 'populate'"
|
||||
#
|
||||
class mistral::db::sync {
|
||||
|
||||
exec { 'mistral-dbsync':
|
||||
command => $::mistral::params::dbsync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'mistral',
|
||||
logoutput => on_failure,
|
||||
subscribe => File[$::mistral::params::mistral_conf],
|
||||
include ::mistral::params
|
||||
|
||||
Package<| tag =='mistral-common' |> ~> Exec['mistral-db-sync']
|
||||
Exec['mistral-db-sync'] ~> Service<| tag == 'mistral-service' |>
|
||||
Mistral_config <||> -> Exec['mistral-db-sync']
|
||||
Mistral_config <| title == 'database/connection' |> ~> Exec['mistral-db-sync']
|
||||
|
||||
exec { 'mistral-db-sync':
|
||||
command => $::mistral::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'mistral',
|
||||
logoutput => on_failure,
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
Exec['mistral-db-sync'] -> Exec['mistral-db-populate']
|
||||
Package<| tag =='mistral-common' |> ~> Exec['mistral-db-populate']
|
||||
Exec['mistral-db-populate'] ~> Service<| tag == 'mistral-service' |>
|
||||
Mistral_config <||> -> Exec['mistral-db-populate']
|
||||
Mistral_config <| title == 'database/connection' |> ~> Exec['mistral-db-populate']
|
||||
exec { 'mistral-db-populate':
|
||||
command => $::mistral::params::db_populate_command,
|
||||
path => '/usr/bin',
|
||||
user => 'mistral',
|
||||
logoutput => on_failure,
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
Exec['mistral-dbsync'] ~> Service<| title == 'mistral' |>
|
||||
}
|
||||
|
@ -3,11 +3,13 @@
|
||||
# Parameters for puppet-mistral
|
||||
#
|
||||
class mistral::params {
|
||||
|
||||
$mistral_conf_dir = '/etc/mistral'
|
||||
$mistral_conf = "${mistral_conf_dir}/mistral.conf"
|
||||
$client_package = 'python-mistralclient'
|
||||
$log_dir ='/var/log/mistral'
|
||||
$dbsync_command = "/usr/bin/python /usr/bin/mistral-db-manage --config-file=${mistral_conf} populate"
|
||||
$db_sync_command = "mistral-db-manage --config-file=${mistral_conf} upgrade head"
|
||||
$db_populate_command = "mistral-db-manage --config-file=${mistral_conf} populate"
|
||||
$update_service_command = '/usr/bin/systemctl daemon-reload'
|
||||
|
||||
case $::osfamily {
|
||||
|
53
spec/classes/mistral_db_sync_spec.rb
Normal file
53
spec/classes/mistral_db_sync_spec.rb
Normal file
@ -0,0 +1,53 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'mistral::db::sync' do
|
||||
|
||||
shared_examples_for 'mistral-db-sync' do
|
||||
|
||||
it 'runs mistral-db-manage upgrade head' do
|
||||
|
||||
is_expected.to contain_exec('mistral-db-sync').with(
|
||||
:command => 'mistral-db-manage --config-file=/etc/mistral/mistral.conf upgrade head',
|
||||
:path => '/usr/bin',
|
||||
:user => 'mistral',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure'
|
||||
)
|
||||
|
||||
is_expected.to contain_exec('mistral-db-populate').with(
|
||||
:command => 'mistral-db-manage --config-file=/etc/mistral/mistral.conf populate',
|
||||
:path => '/usr/bin',
|
||||
:user => 'mistral',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure'
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on a RedHat osfamily' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemrelease => '7.0',
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'mistral-db-sync'
|
||||
end
|
||||
|
||||
context 'on a Debian osfamily' do
|
||||
let :facts do
|
||||
{
|
||||
:operatingsystemrelease => '8.0',
|
||||
:osfamily => 'Debian',
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'mistral-db-sync'
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user