From 73df6089363d8f4ea58188b5ae2187dbca3cbd6c Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Sat, 28 Mar 2015 19:07:21 +0100 Subject: [PATCH] Tag all Heat packages Some users wish to override the default package provider by their own. Tag all packages with the 'openstack' to allow mass resource attributes override using resource collectors. Closes-bug: #1391209 Change-Id: I09e54700438894e22d29605fec51bb056baf4050 Signed-off-by: Gael Chamoulaud --- manifests/api.pp | 1 + manifests/api_cfn.pp | 1 + manifests/api_cloudwatch.pp | 1 + manifests/client.pp | 1 + manifests/engine.pp | 1 + manifests/init.pp | 2 ++ spec/classes/heat_client_spec.rb | 45 ++++++++++++++++++++++++++++++++ spec/classes/heat_engine_spec.rb | 7 ++++- spec/classes/heat_init_spec.rb | 3 ++- 9 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 spec/classes/heat_client_spec.rb diff --git a/manifests/api.pp b/manifests/api.pp index 916493b0..b90a4e0c 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -76,6 +76,7 @@ class heat::api ( package { 'heat-api': ensure => installed, name => $::heat::params::api_package_name, + tag => 'openstack', } if $manage_service { diff --git a/manifests/api_cfn.pp b/manifests/api_cfn.pp index 175d9c14..9738eb41 100644 --- a/manifests/api_cfn.pp +++ b/manifests/api_cfn.pp @@ -79,6 +79,7 @@ class heat::api_cfn ( package { 'heat-api-cfn': ensure => installed, name => $::heat::params::api_cfn_package_name, + tag => 'openstack', } if $manage_service { diff --git a/manifests/api_cloudwatch.pp b/manifests/api_cloudwatch.pp index d57fe523..8f4a64cd 100644 --- a/manifests/api_cloudwatch.pp +++ b/manifests/api_cloudwatch.pp @@ -78,6 +78,7 @@ class heat::api_cloudwatch ( package { 'heat-api-cloudwatch': ensure => installed, name => $::heat::params::api_cloudwatch_package_name, + tag => 'openstack', } if $manage_service { diff --git a/manifests/client.pp b/manifests/client.pp index b594b0a7..3fdd35fa 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -16,6 +16,7 @@ class heat::client ( package { 'python-heatclient': ensure => $ensure, name => $::heat::params::client_package_name, + tag => 'openstack', } } diff --git a/manifests/engine.pp b/manifests/engine.pp index d7554bb1..929490b9 100644 --- a/manifests/engine.pp +++ b/manifests/engine.pp @@ -81,6 +81,7 @@ class heat::engine ( package { 'heat-engine': ensure => installed, name => $::heat::params::engine_package_name, + tag => 'openstack', notify => Exec['heat-dbsync'], } diff --git a/manifests/init.pp b/manifests/init.pp index 1276eff7..700002d6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -279,6 +279,7 @@ class heat( package { 'heat-common': ensure => $package_ensure, name => $::heat::params::common_package_name, + tag => 'openstack', } Package['heat-common'] -> Heat_config<||> @@ -483,6 +484,7 @@ class heat( package {'heat-backend-package': ensure => present, name => $backend_package, + tag => 'openstack', } } diff --git a/spec/classes/heat_client_spec.rb b/spec/classes/heat_client_spec.rb new file mode 100644 index 00000000..c436131f --- /dev/null +++ b/spec/classes/heat_client_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +describe 'heat::client' do + + let :params do + {} + end + + let :default_params do + { :package_ensure => 'present' } + end + + shared_examples_for 'heat client' do + let :p do + default_params.merge(params) + end + + it { is_expected.to contain_class('heat::params') } + + it 'installs heat client package' do + is_expected.to contain_package('python-heatclient').with( + :name => 'python-heatclient', + :ensure => p[:package_ensure], + :tag => 'openstack' + ) + end + + end + + context 'on Debian platform' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'heat client' + end + + context 'on RedHat platform' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'heat client' + end +end diff --git a/spec/classes/heat_engine_spec.rb b/spec/classes/heat_engine_spec.rb index 4a129ea3..dc314d54 100644 --- a/spec/classes/heat_engine_spec.rb +++ b/spec/classes/heat_engine_spec.rb @@ -42,7 +42,12 @@ describe 'heat::engine' do default_params.merge(params) end - it { is_expected.to contain_package('heat-engine').with_name(os_params[:package_name]) } + it { is_expected.to contain_package('heat-engine').with( + :ensure => 'installed', + :name => os_params[:package_name], + :tag => 'openstack', + :notify => 'Exec[heat-dbsync]' + ) } it { is_expected.to contain_service('heat-engine').with( :ensure => (expected_params[:manage_service] && expected_params[:enabled]) ? 'running' : 'stopped', diff --git a/spec/classes/heat_init_spec.rb b/spec/classes/heat_init_spec.rb index c1324871..cb152944 100644 --- a/spec/classes/heat_init_spec.rb +++ b/spec/classes/heat_init_spec.rb @@ -116,7 +116,8 @@ describe 'heat' do it 'installs heat common package' do is_expected.to contain_package('heat-common').with( :ensure => 'present', - :name => platform_params[:common_package_name] + :name => platform_params[:common_package_name], + :tag => 'openstack' ) end