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

Change-Id: I63ac9b1d806565eb1847ed0e36d393c6c7ea98ad
This commit is contained in:
Yanis Guenane 2015-07-22 23:08:04 +02:00
parent 78d9f0b803
commit a63da90375
22 changed files with 56 additions and 36 deletions

View File

@ -142,7 +142,7 @@ class neutron::agents::dhcp (
package { 'neutron-dhcp-agent':
ensure => $package_ensure,
name => $::neutron::params::dhcp_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Some platforms (RedHat) do not provide a neutron DHCP agent package.
@ -163,5 +163,6 @@ class neutron::agents::dhcp (
name => $::neutron::params::dhcp_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -180,7 +180,7 @@ class neutron::agents::l3 (
ensure => $package_ensure,
name => $::neutron::params::l3_agent_package,
require => Package['neutron'],
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Some platforms (RedHat) does not provide a neutron L3 agent package.
@ -201,5 +201,6 @@ class neutron::agents::l3 (
name => $::neutron::params::l3_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -83,7 +83,7 @@ class neutron::agents::lbaas (
package { 'neutron-lbaas-agent':
ensure => $package_ensure,
name => $::neutron::params::lbaas_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
if $manage_service {
if $enabled {
@ -98,5 +98,6 @@ class neutron::agents::lbaas (
name => $::neutron::params::lbaas_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -150,7 +150,7 @@ class neutron::agents::metadata (
ensure => $package_ensure,
name => $::neutron::params::metadata_agent_package,
require => Package['neutron'],
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
}
@ -167,5 +167,6 @@ class neutron::agents::metadata (
name => $::neutron::params::metadata_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -85,7 +85,7 @@ class neutron::agents::metering (
package { 'neutron-metering-agent':
ensure => $package_ensure,
name => $::neutron::params::metering_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Default dependency if the system does not provide a neutron metering agent package.
@ -105,5 +105,6 @@ class neutron::agents::metering (
name => $::neutron::params::metering_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -134,7 +134,7 @@ class neutron::agents::ml2::linuxbridge (
package { 'neutron-plugin-linuxbridge-agent':
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Some platforms (RedHat) do not provide a separate
@ -143,7 +143,7 @@ class neutron::agents::ml2::linuxbridge (
package { 'neutron-plugin-linuxbridge-agent':
ensure => $package_ensure,
name => $::neutron::params::linuxbridge_server_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
}
}
@ -160,6 +160,7 @@ class neutron::agents::ml2::linuxbridge (
ensure => $service_ensure,
name => $::neutron::params::linuxbridge_agent_service,
enable => $enabled,
require => Class['neutron']
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -197,7 +197,7 @@ class neutron::agents::ml2::ovs (
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Some platforms (RedHat) do not provide a separate
@ -207,7 +207,7 @@ class neutron::agents::ml2::ovs (
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
}
}
@ -225,6 +225,7 @@ class neutron::agents::ml2::ovs (
name => $::neutron::params::ovs_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
if $::neutron::params::ovs_cleanup_service {

View File

@ -75,7 +75,7 @@ class neutron::agents::ml2::sriov (
package { 'neutron-sriov-nic-agent':
ensure => $package_ensure,
name => $::neutron::params::sriov_nic_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
if $manage_service {
@ -91,6 +91,7 @@ class neutron::agents::ml2::sriov (
name => $::neutron::params::sriov_nic_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -96,7 +96,7 @@ class neutron::agents::vpnaas (
package { 'neutron-vpnaas-agent':
ensure => $package_ensure,
name => $::neutron::params::vpnaas_agent_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
Package['neutron'] -> Neutron_vpnaas_agent_config<||>
@ -115,5 +115,6 @@ class neutron::agents::vpnaas (
name => $::neutron::params::vpnaas_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

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

View File

@ -336,7 +336,7 @@ class neutron::server (
package { 'neutron-server':
ensure => $package_ensure,
name => $::neutron::params::server_package,
tag => 'openstack',
tag => ['openstack', 'neutron-package'],
}
} else {
# Some platforms (RedHat) does not provide a neutron-server package.
@ -503,5 +503,6 @@ class neutron::server (
hasstatus => true,
hasrestart => true,
require => Class['neutron'],
tag => 'neutron-service',
}
}

View File

@ -61,7 +61,7 @@ describe 'neutron::agents::dhcp' do
is_expected.to contain_package('neutron-dhcp-agent').with(
:name => platform_params[:dhcp_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').with_before(/Package\[neutron-dhcp-agent\]/)
is_expected.to contain_package('neutron-dhcp-agent').with_before(/Neutron_dhcp_agent_config\[.+\]/)
@ -76,7 +76,8 @@ describe 'neutron::agents::dhcp' do
:name => platform_params[:dhcp_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -70,7 +70,7 @@ describe 'neutron::agents::l3' do
:name => platform_params[:l3_agent_package],
:ensure => p[:package_ensure],
:require => 'Package[neutron]',
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-l3').with_before(/Neutron_l3_agent_config\[.+\]/)
else
@ -83,7 +83,8 @@ describe 'neutron::agents::l3' do
:name => platform_params[:l3_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -50,7 +50,7 @@ describe 'neutron::agents::lbaas' do
is_expected.to contain_package('neutron-lbaas-agent').with(
:name => platform_params[:lbaas_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').with_before(/Package\[neutron-lbaas-agent\]/)
is_expected.to contain_package('neutron-lbaas-agent').with_before(/Neutron_lbaas_agent_config\[.+\]/)
@ -62,7 +62,8 @@ describe 'neutron::agents::lbaas' do
:name => platform_params[:lbaas_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -39,8 +39,9 @@ describe 'neutron::agents::metadata' do
is_expected.to contain_service('neutron-metadata').with(
:name => platform_params[:metadata_agent_service],
:enable => params[:enabled],
:ensure => 'running',
:require => 'Class[Neutron]'
:ensure => 'running',
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end
@ -104,7 +105,7 @@ describe 'neutron::agents::metadata' do
is_expected.to contain_package('neutron-metadata').with(
:ensure => params[:package_ensure],
:name => platform_params[:metadata_agent_package],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
end

View File

@ -69,7 +69,7 @@ describe 'neutron::agents::metering' do
is_expected.to contain_package('neutron-metering-agent').with(
:name => platform_params[:metering_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').with_before(/Package\[neutron-metering-agent\]/)
is_expected.to contain_package('neutron-metering-agent').with_before(/Neutron_metering_agent_config\[.+\]/)
@ -84,7 +84,8 @@ describe 'neutron::agents::metering' do
:name => platform_params[:metering_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -52,7 +52,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
is_expected.to contain_package('neutron-plugin-linuxbridge-agent').with(
:name => linuxbridge_agent_package,
:ensure => default_params[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-plugin-linuxbridge-agent').with_before(/Neutron_agent_linuxbridge\[.+\]/)
@ -63,7 +63,8 @@ describe 'neutron::agents::ml2::linuxbridge' do
:name => platform_params[:linuxbridge_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -56,7 +56,7 @@ describe 'neutron::agents::ml2::ovs' do
is_expected.to contain_package('neutron-ovs-agent').with(
:name => platform_params[:ovs_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-ovs-agent').with_before(/Neutron_agent_ovs\[.+\]/)
else
@ -68,7 +68,8 @@ describe 'neutron::agents::ml2::ovs' do
:name => platform_params[:ovs_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -43,7 +43,7 @@ describe 'neutron::agents::ml2::sriov' do
is_expected.to contain_package('neutron-sriov-nic-agent').with(
:name => platform_params[:sriov_nic_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-sriov-nic-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
end
@ -53,7 +53,8 @@ describe 'neutron::agents::ml2::sriov' do
:name => platform_params[:sriov_nic_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -78,7 +78,7 @@ describe 'neutron::agents::vpnaas' do
is_expected.to contain_package('neutron-vpnaas-agent').with(
:name => platform_params[:vpnaas_agent_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').with_before(/Package\[neutron-vpnaas-agent\]/)
is_expected.to contain_package('neutron-vpnaas-agent').with_before(/Neutron_vpnaas_agent_config\[.+\]/)
@ -92,7 +92,8 @@ describe 'neutron::agents::vpnaas' do
:name => platform_params[:vpnaas_agent_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
end

View File

@ -105,7 +105,7 @@ describe 'neutron' do
is_expected.to contain_package('neutron').with(
:ensure => 'present',
:name => platform_params[:common_package_name],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
end

View File

@ -79,7 +79,7 @@ describe 'neutron::server' do
is_expected.to contain_package('neutron-server').with(
:name => platform_params[:server_package],
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-server').with_before(/Neutron_api_config\[.+\]/)
is_expected.to contain_package('neutron-server').with_before(/Neutron_config\[.+\]/)
@ -94,7 +94,8 @@ describe 'neutron::server' do
:name => platform_params[:server_service],
:enable => true,
:ensure => 'running',
:require => 'Class[Neutron]'
:require => 'Class[Neutron]',
:tag => 'neutron-service',
)
is_expected.not_to contain_class('neutron::db::sync')
is_expected.to contain_neutron_api_config('filter:authtoken/auth_admin_prefix').with(