diff --git a/manifests/registry.pp b/manifests/registry.pp index 761b7ca2..84e8155a 100644 --- a/manifests/registry.pp +++ b/manifests/registry.pp @@ -7,6 +7,11 @@ # [*keystone_password*] # (required) The keystone password for administrative user # +# [*package_ensure*] +# (optional) Ensure state for package. Defaults to 'present'. On RedHat +# platforms this setting is ignored and the setting from the glance class is +# used because there is only one glance package. +# # [*verbose*] # (optional) Enable verbose logs (true|false). Defaults to false. # @@ -106,6 +111,7 @@ # class glance::registry( $keystone_password, + $package_ensure = 'present', $verbose = false, $debug = false, $bind_host = '0.0.0.0', @@ -142,7 +148,8 @@ class glance::registry( } if ( $glance::params::api_package_name != $glance::params::registry_package_name ) { - ensure_packages([$glance::params::registry_package_name]) + ensure_packages( [$glance::params::registry_package_name], + { ensure => $package_ensure }) } Package[$glance::params::registry_package_name] -> File['/etc/glance/'] diff --git a/spec/classes/glance_registry_spec.rb b/spec/classes/glance_registry_spec.rb index b113d052..8b6dcbd1 100644 --- a/spec/classes/glance_registry_spec.rb +++ b/spec/classes/glance_registry_spec.rb @@ -296,9 +296,15 @@ describe 'glance::registry' do let :facts do { :osfamily => 'Debian' } end - let(:params) { default_params } - it {should contain_package('glance-registry')} + # We only test this on Debian platforms, since on RedHat there isn't a + # separate package for glance registry. + ['present', 'latest'].each do |package_ensure| + context "with package_ensure '#{package_ensure}'" do + let(:params) { default_params.merge({ :package_ensure => package_ensure })} + it {should contain_package('glance-registry').with_ensure(package_ensure)} + end + end end describe 'on RedHat platforms' do