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

Change-Id: I969fbe7405a3eb3fab5437293c0efe1da57c631c
This commit is contained in:
Yanis Guenane 2015-07-22 16:59:16 +02:00
parent c09363e986
commit c9966f7d97
4 changed files with 13 additions and 5 deletions

View File

@ -68,6 +68,7 @@ define trove::generic_service(
ensure => $ensure_package,
name => $package_name,
notify => Service[$trove_title],
tag => ['openstack', 'trove-package'],
}
}
}
@ -86,6 +87,7 @@ define trove::generic_service(
name => $service_name,
enable => $enabled,
hasstatus => true,
tag => 'trove-service',
}
}
}

View File

@ -236,7 +236,8 @@ class trove(
# https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1365561
package { 'trove':
ensure => $package_ensure,
name => $::trove::params::common_package_name
name => $::trove::params::common_package_name,
tag => ['openstack', 'trove-package'],
}
$group_require = Package['trove']
} else {

View File

@ -58,6 +58,7 @@ describe 'trove' do
should contain_package('trove').with(
:name => 'openstack-trove',
:ensure => 'present',
:tag => ['openstack', 'trove-package'],
)
end

View File

@ -11,13 +11,15 @@ shared_examples 'generic trove service' do |service|
is_expected.to contain_package(service[:name]).with({
:name => service[:package_name],
:ensure => 'present',
:notify => "Service[#{service[:name]}]"
:notify => "Service[#{service[:name]}]",
:tag => ['openstack', 'trove-package'],
})
is_expected.to contain_service(service[:name]).with({
:name => service[:service_name],
:ensure => 'stopped',
:hasstatus => true,
:enable => false
:enable => false,
:tag => 'trove-service',
})
end
end
@ -32,13 +34,15 @@ shared_examples 'generic trove service' do |service|
is_expected.to contain_package(service[:name]).with({
:name => service[:package_name],
:ensure => '2014.1-1',
:notify => "Service[#{service[:name]}]"
:notify => "Service[#{service[:name]}]",
:tag => ['openstack', 'trove-package'],
})
is_expected.to contain_service(service[:name]).with({
:name => service[:service_name],
:ensure => 'running',
:hasstatus => true,
:enable => true
:enable => true,
:tag => 'trove-service',
})
end
end