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 'keystone-package' and 'keyston-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 == 'keystone-package' |> -> X

Change-Id: I2de6880ba14ccd07b5d4c1928ddcde821bc9625d
This commit is contained in:
Yanis Guenane 2015-07-22 15:10:25 +02:00
parent c513360c2d
commit 8f5286557f
4 changed files with 11 additions and 7 deletions

View File

@ -536,7 +536,7 @@ class keystone(
package { 'keystone':
ensure => $package_ensure,
name => $::keystone::params::package_name,
tag => 'openstack',
tag => ['openstack', 'keystone-package'],
}
if $client_package_ensure == 'present' {
include '::openstacklib::openstackclient'

View File

@ -86,7 +86,8 @@ class keystone::service(
enable => $enable,
hasstatus => $hasstatus,
hasrestart => $hasrestart,
provider => $provider
provider => $provider,
tag => 'keystone-service',
}
if $insecure {

View File

@ -7,7 +7,8 @@ describe 'keystone::service' do
:ensure => nil,
:enable => true,
:hasstatus => true,
:hasrestart => true
:hasrestart => true,
:tag => 'keystone-service',
) }
it { is_expected.to_not contain_exec('validate_keystone_connection') }
end
@ -24,7 +25,8 @@ describe 'keystone::service' do
:ensure => nil,
:enable => true,
:hasstatus => true,
:hasrestart => true
:hasrestart => true,
:tag => 'keystone-service',
) }
it { is_expected.to contain_exec('validate_keystone_connection') }
end

View File

@ -107,12 +107,12 @@ describe 'keystone' do
it { is_expected.to contain_package('keystone').with(
'ensure' => param_hash['package_ensure'],
'tag' => 'openstack'
'tag' => ['openstack', 'keystone-package'],
) }
it { is_expected.to contain_package('python-openstackclient').with(
'ensure' => param_hash['client_package_ensure'],
'tag' => 'openstack'
'tag' => 'openstack',
) }
it { is_expected.to contain_group('keystone').with(
@ -240,7 +240,8 @@ describe 'keystone' do
'ensure' => (param_hash['manage_service'] && param_hash['enabled']) ? 'running' : 'stopped',
'enable' => param_hash['enabled'],
'hasstatus' => true,
'hasrestart' => true
'hasrestart' => true,
'tag' => 'keystone-service',
) }
it { is_expected.to contain_anchor('keystone_started') }