From 5c8ee34222bffd0da5904fa1ad23bbf631ee3a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Thu, 13 Nov 2014 11:55:04 -0500 Subject: [PATCH] Tag all nova packages Some users wish to override the default package provider by their own. Tag all packages with the 'openstack' and its corresponding service name to allow mass resource attributes override using resource collectors. Change-Id: I3a8041be7b9fcb304d2cf0dbdd4a021cd8594c02 Closes-bug: #1391209 --- manifests/client.pp | 1 + manifests/compute/libvirt.pp | 1 + manifests/generic_service.pp | 1 + manifests/init.pp | 6 ++++-- spec/classes/nova_api_spec.rb | 6 ++++-- spec/classes/nova_cells_spec.rb | 3 ++- spec/classes/nova_client_spec.rb | 7 ++++++- spec/classes/nova_compute_libvirt_spec.rb | 3 ++- spec/classes/nova_compute_spec.rb | 6 ++++-- spec/classes/nova_init_spec.rb | 3 ++- spec/shared_examples.rb | 3 ++- 11 files changed, 29 insertions(+), 11 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index d9833d8de..35748c095 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -14,6 +14,7 @@ class nova::client( package { 'python-novaclient': ensure => $ensure, + tag => ['openstack', 'nova'], } } diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index c853c740a..c27bb4c68 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -110,6 +110,7 @@ class nova::compute::libvirt ( ensure => present, before => Package['nova-compute'], require => Package['nova-common'], + tag => ['openstack', 'nova'], } } diff --git a/manifests/generic_service.pp b/manifests/generic_service.pp index 2ead9bda5..3328ba5f7 100644 --- a/manifests/generic_service.pp +++ b/manifests/generic_service.pp @@ -37,6 +37,7 @@ define nova::generic_service( ensure => $ensure_package, name => $package_name, notify => Service[$nova_title], + tag => ['openstack', 'nova'], } } } diff --git a/manifests/init.pp b/manifests/init.pp index 6ac0a3b65..d39205fbe 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -473,13 +473,15 @@ class nova( package { 'python-nova': ensure => $ensure_package, - require => Package['python-greenlet'] + require => Package['python-greenlet'], + tag => ['openstack', 'nova'], } package { 'nova-common': ensure => $ensure_package, name => $::nova::params::common_package_name, - require => [Package['python-nova'], Anchor['nova-start']] + require => [Package['python-nova'], Anchor['nova-start']], + tag => ['openstack', 'nova'], } file { '/etc/nova/nova.conf': diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index 54f937ee6..c0d1dd2f9 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -28,7 +28,8 @@ describe 'nova::api' do should contain_package('nova-api').with( :name => platform_params[:nova_api_package], :ensure => 'present', - :notify => 'Service[nova-api]' + :notify => 'Service[nova-api]', + :tag => ['openstack', 'nova'] ) end @@ -114,7 +115,8 @@ describe 'nova::api' do it 'installs nova-api package and service' do should contain_package('nova-api').with( :name => platform_params[:nova_api_package], - :ensure => '2012.1-2' + :ensure => '2012.1-2', + :tag => ['openstack', 'nova'] ) should contain_service('nova-api').with( :name => platform_params[:nova_api_service], diff --git a/spec/classes/nova_cells_spec.rb b/spec/classes/nova_cells_spec.rb index 626264af5..45328650f 100644 --- a/spec/classes/nova_cells_spec.rb +++ b/spec/classes/nova_cells_spec.rb @@ -60,7 +60,8 @@ describe 'nova::cells' do it 'installs nova-cells package' do should contain_package('nova-cells').with( :ensure => 'present', - :name => platform_params[:cells_package_name] + :name => platform_params[:cells_package_name], + :tag => ['openstack', 'nova'] ) end diff --git a/spec/classes/nova_client_spec.rb b/spec/classes/nova_client_spec.rb index 2057e2c01..4caae33aa 100644 --- a/spec/classes/nova_client_spec.rb +++ b/spec/classes/nova_client_spec.rb @@ -3,7 +3,12 @@ require 'spec_helper' describe 'nova::client' do context 'with default parameters' do - it { should contain_package('python-novaclient').with_ensure('present') } + it { + should contain_package('python-novaclient').with( + :ensure => 'present', + :tag => ['openstack', 'nova'] + ) + } end context 'with ensure parameter provided' do diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index bdf7362d7..2ceb3983e 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -16,7 +16,8 @@ describe 'nova::compute::libvirt' do it { should contain_package('nova-compute-kvm').with( :ensure => 'present', - :before => 'Package[nova-compute]' + :before => 'Package[nova-compute]', + :tag => ['openstack', 'nova'] ) } it { should contain_package('libvirt').with( diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index c1fc79d57..253f65506 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -18,7 +18,8 @@ describe 'nova::compute' do :enable => false }) should contain_package('nova-compute').with({ - :name => platform_params[:nova_compute_package] + :name => platform_params[:nova_compute_package], + :tag => ['openstack', 'nova'] }) end @@ -55,7 +56,8 @@ describe 'nova::compute' do }) should contain_package('nova-compute').with({ :name => platform_params[:nova_compute_package], - :ensure => '2012.1-2' + :ensure => '2012.1-2', + :tag => ['openstack', 'nova'] }) end diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 9a70df1f3..e4bdf136e 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -18,7 +18,8 @@ describe 'nova' do ) should contain_package('nova-common').with( :name => platform_params[:nova_common_package], - :ensure => 'present' + :ensure => 'present', + :tag => ['openstack', 'nova'] ) end diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb index 52f56c3a8..b7b16517e 100644 --- a/spec/shared_examples.rb +++ b/spec/shared_examples.rb @@ -11,7 +11,8 @@ shared_examples 'generic nova service' do |service| should contain_package(service[:name]).with({ :name => service[:package_name], :ensure => 'present', - :notify => "Service[#{service[:name]}]" + :notify => "Service[#{service[:name]}]", + :tag => ['openstack', 'nova'] }) should contain_service(service[:name]).with({ :name => service[:service_name],