Sync cinder::db::sync with new standard
Apply the same logic to cinder::db::sync and cinder::api that the one applied to the other modules[1] [1] https://review.openstack.org/#/q/status:open+branch:master+topic:db_sync,n,z Change-Id: I4dead2a5e7fca97621ea185ed76de751c2ee0d01
This commit is contained in:
parent
384145d163
commit
81163c0fad
@ -173,17 +173,7 @@ class cinder::api (
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
Cinder_config<||> ~> Exec['cinder-manage db_sync']
|
||||
|
||||
exec { 'cinder-manage db_sync':
|
||||
command => $::cinder::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'cinder',
|
||||
refreshonly => true,
|
||||
logoutput => 'on_failure',
|
||||
subscribe => Package['cinder'],
|
||||
before => Service['cinder-api'],
|
||||
}
|
||||
include ::cinder::db::sync
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
|
@ -1,14 +1,22 @@
|
||||
#
|
||||
# Class to execute cinder dbsync
|
||||
#
|
||||
class cinder::db::sync {
|
||||
|
||||
include ::cinder::params
|
||||
|
||||
Package <| tag == 'cinder-package' |> ~> Exec['cinder-manage db_sync']
|
||||
Exec['cinder-manage db_sync'] ~> Service <| tag == 'cinder-service' |>
|
||||
|
||||
Cinder_config <||> ~> Exec['cinder-manage db_sync']
|
||||
Cinder_config <| title == 'database/connection' |> ~> Exec['cinder-manage db_sync']
|
||||
|
||||
exec { 'cinder-manage db_sync':
|
||||
command => $::cinder::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'cinder',
|
||||
refreshonly => true,
|
||||
require => Class['cinder'],
|
||||
logoutput => 'on_failure',
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ describe 'cinder::api' do
|
||||
:sync_db => false,
|
||||
}
|
||||
end
|
||||
it { is_expected.not_to contain_exec('cinder-manage db_sync') }
|
||||
it { is_expected.not_to contain_class('cinder::db::sync') }
|
||||
end
|
||||
|
||||
[ '/keystone', '/keystone/admin' ].each do |keystone_auth_admin_prefix|
|
||||
@ -183,8 +183,8 @@ describe 'cinder::api' do
|
||||
it 'should stop the service' do
|
||||
is_expected.to contain_service('cinder-api').with_ensure('stopped')
|
||||
end
|
||||
it 'should contain db_sync exec' do
|
||||
is_expected.to contain_exec('cinder-manage db_sync')
|
||||
it 'includes cinder::db::sync' do
|
||||
is_expected.to contain_class('cinder::db::sync')
|
||||
end
|
||||
end
|
||||
|
||||
@ -195,8 +195,8 @@ describe 'cinder::api' do
|
||||
it 'should not change the state of the service' do
|
||||
is_expected.to contain_service('cinder-api').without_ensure
|
||||
end
|
||||
it 'should contain db_sync exec' do
|
||||
is_expected.to contain_exec('cinder-manage db_sync')
|
||||
it 'includes cinder::db::sync' do
|
||||
is_expected.to contain_class('cinder::db::sync')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2,15 +2,43 @@ require 'spec_helper'
|
||||
|
||||
describe 'cinder::db::sync' do
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'Debian'}
|
||||
shared_examples_for 'cinder-dbsync' do
|
||||
|
||||
it 'runs cinder-manage db_sync' do
|
||||
is_expected.to contain_exec('cinder-manage db_sync').with(
|
||||
:command => 'cinder-manage db sync',
|
||||
:user => 'cinder',
|
||||
:path => '/usr/bin',
|
||||
: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 'cinder-dbsync'
|
||||
end
|
||||
|
||||
context 'on a Debian osfamily' do
|
||||
let :facts do
|
||||
{
|
||||
:operatingsystemrelease => '7.8',
|
||||
:operatingsystem => 'Debian',
|
||||
:osfamily => 'Debian',
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'cinder-dbsync'
|
||||
end
|
||||
it { is_expected.to contain_exec('cinder-manage db_sync').with(
|
||||
:command => 'cinder-manage db sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'cinder',
|
||||
:refreshonly => true,
|
||||
:logoutput => 'on_failure'
|
||||
) }
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user