diff --git a/manifests/api.pp b/manifests/api.pp index dc861932..db6a279e 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -7,6 +7,11 @@ # [*keystone_password*] # (required) Password used to authentication. # +# [*package_ensure*] +# (optional) Ensure state for package. On RedHat platforms this +# setting is ignored and the setting from the glance class is used +# because there is only one glance package. Defaults to 'present'. +# # [*verbose*] # (optional) Rather to log the glance api service at verbose level. # Default: false @@ -184,6 +189,7 @@ # class glance::api( $keystone_password, + $package_ensure = 'present', $verbose = false, $debug = false, $bind_host = '0.0.0.0', @@ -236,6 +242,7 @@ class glance::api( if ( $glance::params::api_package_name != $glance::params::registry_package_name ) { ensure_packages([$glance::params::api_package_name], { + ensure => $package_ensure, tag => ['openstack'], } ) diff --git a/manifests/init.pp b/manifests/init.pp index 5920ee8d..3b104225 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,7 +5,8 @@ # === parameters: # # [*package_ensure*] -# (Optional) ensure state for package. +# (Optional) Ensure state for package. On Ubuntu this setting +# is ignored since Ubuntu has separate API and registry packages. # Defaults to 'present' # class glance( diff --git a/spec/classes/glance_api_spec.rb b/spec/classes/glance_api_spec.rb index da77321f..74e48626 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -427,9 +427,17 @@ describe 'glance::api' do end let(:params) { default_params } - it { is_expected.to contain_package('glance-api').with( - :tag => ['openstack'], - )} + # We only test this on Debian platforms, since on RedHat there isn't a + # separate package for glance API. + ['present', 'latest'].each do |package_ensure| + context "with package_ensure '#{package_ensure}'" do + let(:params) { default_params.merge({ :package_ensure => package_ensure }) } + it { is_expected.to contain_package('glance-api').with( + :ensure => package_ensure, + :tag => ['openstack'] + )} + end + end end describe 'on RedHat platforms' do