Add tag to package and service resources

In order to be able to take an action after all the packages of the
module have been installed/updated or all the services have been
started/restarted, we set a 'glance-package' and 'glance-service'
tag for each package and service of this module.

At the moment, there is a generic openstack tag that is not specific
enough if one wants to take action upon a single module change.

Use case :

If an action needs to be taken after all the packages have been
installed or updated : Package <| tag == 'glance-package' |> -> X

Change-Id: If43e27e80500deebf6b758b11541d3d6f50cb129
This commit is contained in:
Yanis Guenane 2015-07-22 10:14:50 +02:00
parent d09db618b6
commit 92180ae9a1
6 changed files with 19 additions and 13 deletions

View File

@ -243,7 +243,7 @@ class glance::api(
ensure_packages([$glance::params::api_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
tag => ['openstack', 'glance-package'],
}
)
}
@ -498,6 +498,7 @@ class glance::api(
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'glance-service',
}
if $validate {

View File

@ -26,7 +26,7 @@ class glance(
package { $glance::params::api_package_name :
ensure => $package_ensure,
name => $::glance::params::package_name,
tag => ['openstack'],
tag => ['openstack', 'glance-package'],
}
}
}

View File

@ -166,7 +166,7 @@ class glance::registry(
ensure_packages( [$glance::params::registry_package_name],
{
ensure => $package_ensure,
tag => ['openstack'],
tag => ['openstack', 'glance-package'],
}
)
}
@ -386,7 +386,8 @@ class glance::registry(
hasstatus => true,
hasrestart => true,
subscribe => File['/etc/glance/glance-registry.conf'],
require => Class['glance']
require => Class['glance'],
tag => 'glance-service',
}
}

View File

@ -87,7 +87,8 @@ describe 'glance::api' do
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
'enable' => param_hash[:enabled],
'hasstatus' => true,
'hasrestart' => true
'hasrestart' => true,
'tag' => 'glance-service',
) }
it { is_expected.to_not contain_exec('validate_nova_api') }
@ -183,7 +184,8 @@ describe 'glance::api' do
'ensure' => nil,
'enable' => false,
'hasstatus' => true,
'hasrestart' => true
'hasrestart' => true,
'tag' => 'glance-service',
) }
end
@ -441,7 +443,7 @@ describe 'glance::api' do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
it { is_expected.to contain_package('glance-api').with(
:ensure => package_ensure,
:tag => ['openstack']
:tag => ['openstack', 'glance-package']
)}
end
end
@ -454,7 +456,7 @@ describe 'glance::api' do
let(:params) { default_params }
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
:tag => ['openstack', 'glance-package'],
)}
end

View File

@ -71,7 +71,8 @@ describe 'glance::registry' do
'hasstatus' => true,
'hasrestart' => true,
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
'require' => 'Class[Glance]'
'require' => 'Class[Glance]',
'tag' => 'glance-service',
)}
it 'is_expected.to only sync the db if sync_db is enabled' do
@ -142,7 +143,8 @@ describe 'glance::registry' do
'hasstatus' => true,
'hasrestart' => true,
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
'require' => 'Class[Glance]'
'require' => 'Class[Glance]',
'tag' => 'glance-service',
)}
end
@ -354,7 +356,7 @@ describe 'glance::registry' do
let(:params) { default_params.merge({ :package_ensure => package_ensure }) }
it { is_expected.to contain_package('glance-registry').with(
:ensure => package_ensure,
:tag => ['openstack']
:tag => ['openstack', 'glance-package']
)}
end
end
@ -366,7 +368,7 @@ describe 'glance::registry' do
end
let(:params) { default_params }
it { is_expected.to contain_package('openstack-glance')}
it { is_expected.to contain_package('openstack-glance') }
end
describe 'on unknown platforms' do

View File

@ -50,7 +50,7 @@ describe 'glance' do
let(:params) { default_params }
it { is_expected.to contain_package('openstack-glance').with(
:tag => ['openstack'],
:tag => ['openstack', 'glance-package'],
)}
end