diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index 7a7bcaf6..830f06f7 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -20,12 +20,20 @@ # This resource installs additional horizon dashboard which is not # shipped with the horizon packages, but as additional packages. # +# == Parameters: +# +# [*ensure*] +# (Optional) The ensure state of the dashboard package. +# Defaults to present +# # == Example: # # This will install the correct heat-dashboard package for your deployment. # horizon::dashboard { 'heat': } # -define horizon::dashboard { +define horizon::dashboard ( + $ensure = 'present', +) { $dashboard = downcase($name) @@ -45,7 +53,7 @@ define horizon::dashboard { } ensure_packages($dashboard_package_name, { - 'ensure' => present, + 'ensure' => $ensure, 'tag' => ['horizon-dashboard-package'] }) } diff --git a/releasenotes/notes/dashboard-remove-2b250155570ab317.yaml b/releasenotes/notes/dashboard-remove-2b250155570ab317.yaml new file mode 100644 index 00000000..7f10f53c --- /dev/null +++ b/releasenotes/notes/dashboard-remove-2b250155570ab317.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added ``ensure`` parameter to ``horizon::dashboard`` resource which defaults + to ``present``. You can now set this to absent if you want to remove a horizon + dashboard package. diff --git a/spec/defines/horizon_dashboard_spec.rb b/spec/defines/horizon_dashboard_spec.rb index 96623717..edf9326a 100644 --- a/spec/defines/horizon_dashboard_spec.rb +++ b/spec/defines/horizon_dashboard_spec.rb @@ -24,11 +24,23 @@ describe 'horizon::dashboard' do shared_examples 'horizon::dashboard' do context 'with default' do - it { - is_expected.to contain_package(platform_params[:heat_dashboard_package_name]).with( + it { should contain_package(platform_params[:heat_dashboard_package_name]).with( :ensure => 'present', - :tag => ['horizon-dashboard-package']) - } + :tag => ['horizon-dashboard-package'] + )} + end + + context 'with absent' do + let :params do + { + :ensure => 'absent', + } + end + + it { should contain_package(platform_params[:heat_dashboard_package_name]).with( + :ensure => 'absent', + :tag => ['horizon-dashboard-package'] + )} end end @@ -38,21 +50,19 @@ describe 'horizon::dashboard' do end context 'with default' do - it { - is_expected.to contain_package('python3-heat-dashboard').with( - :ensure => 'present', - :tag => ['horizon-dashboard-package']) - } + it { should contain_package('python3-heat-dashboard').with( + :ensure => 'present', + :tag => ['horizon-dashboard-package'] + )} end end shared_examples 'horizon::dashboard on Ubuntu' do context 'with default' do - it { - is_expected.to contain_package('python-heat-dashboard').with( + it { should contain_package('python-heat-dashboard').with( :ensure => 'present', - :tag => ['horizon-dashboard-package']) - } + :tag => ['horizon-dashboard-package'] + )} end end