diff --git a/manifests/api.pp b/manifests/api.pp index 44932ba1..828902ed 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -172,20 +172,21 @@ class cinder::api ( } } - if $enabled { - if $sync_db { - Cinder_config<||> ~> Exec['cinder-manage db_sync'] + 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'], - } + 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'], } + } + + if $enabled { if $manage_service { $ensure = 'running' } diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index bf96d785..e901ec9a 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -183,7 +183,7 @@ describe 'cinder::api' do is_expected.to contain_service('cinder-api').with_ensure('stopped') end it 'should contain db_sync exec' do - is_expected.to_not contain_exec('cinder-manage db_sync') + is_expected.to contain_exec('cinder-manage db_sync') end end @@ -194,6 +194,9 @@ 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') + end end describe 'with ratelimits' do