Run db-sync if nova packages are upgraded

This changes the db-sync logic to run if the api or common package is
upgraded.  Previously it would solely ensure that the api package was
installed before running db sync.  On ubuntu, if the common package is
upgraded then the api package will also be upgraded in the same
transaction, which means that no notify will be generated.

Lastly, this fixes the package collector to use the params names for the
packages, instead of hard coding nova-api

Change-Id: I4fcea354c5d663644592093ec617ee5b1c6f33e3
This commit is contained in:
Clayton O'Neill
2015-06-01 20:49:05 +00:00
parent f4330488dd
commit 7e457c48df
2 changed files with 4 additions and 2 deletions

View File

@@ -346,7 +346,9 @@ class nova::api(
# Added arg and if statement prevents this from being run
# where db is not active i.e. the compute
if $sync_db {
Package<| title == 'nova-api' |> -> Exec['nova-db-sync']
Package<| title == $::nova::params::api_package_name |> ~> Exec['nova-db-sync']
Package<| title == $::nova::params::common_package_name |> ~> Exec['nova-db-sync']
exec { 'nova-db-sync':
command => '/usr/bin/nova-manage db sync',
refreshonly => true,

View File

@@ -28,9 +28,9 @@ describe 'nova::api' do
is_expected.to contain_package('nova-api').with(
:name => platform_params[:nova_api_package],
:ensure => 'present',
:notify => 'Service[nova-api]',
:tag => ['openstack']
)
is_expected.to contain_package('nova-api').that_notifies('Service[nova-api]')
is_expected.to_not contain_exec('validate_nova_api')
end