Merge "Add support to remove horizon dashboards"

This commit is contained in:
Zuul 2018-12-28 00:29:53 +00:00 committed by Gerrit Code Review
commit 8271153f30
3 changed files with 39 additions and 15 deletions

View File

@ -20,12 +20,20 @@
# This resource installs additional horizon dashboard which is not # This resource installs additional horizon dashboard which is not
# shipped with the horizon packages, but as additional packages. # shipped with the horizon packages, but as additional packages.
# #
# == Parameters:
#
# [*ensure*]
# (Optional) The ensure state of the dashboard package.
# Defaults to present
#
# == Example: # == Example:
# #
# This will install the correct heat-dashboard package for your deployment. # This will install the correct heat-dashboard package for your deployment.
# horizon::dashboard { 'heat': } # horizon::dashboard { 'heat': }
# #
define horizon::dashboard { define horizon::dashboard (
$ensure = 'present',
) {
$dashboard = downcase($name) $dashboard = downcase($name)
@ -45,7 +53,7 @@ define horizon::dashboard {
} }
ensure_packages($dashboard_package_name, { ensure_packages($dashboard_package_name, {
'ensure' => present, 'ensure' => $ensure,
'tag' => ['horizon-dashboard-package'] 'tag' => ['horizon-dashboard-package']
}) })
} }

View File

@ -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.

View File

@ -24,12 +24,24 @@ describe 'horizon::dashboard' do
shared_examples 'horizon::dashboard' do shared_examples 'horizon::dashboard' do
context 'with default' do context 'with default' do
it { it { should contain_package(platform_params[:heat_dashboard_package_name]).with(
is_expected.to contain_package(platform_params[:heat_dashboard_package_name]).with(
:ensure => 'present', :ensure => 'present',
:tag => ['horizon-dashboard-package']) :tag => ['horizon-dashboard-package']
)}
end
context 'with absent' do
let :params do
{
:ensure => 'absent',
} }
end end
it { should contain_package(platform_params[:heat_dashboard_package_name]).with(
:ensure => 'absent',
:tag => ['horizon-dashboard-package']
)}
end
end end
shared_examples 'horizon::dashboard on Debian' do shared_examples 'horizon::dashboard on Debian' do
@ -38,21 +50,19 @@ describe 'horizon::dashboard' do
end end
context 'with default' do context 'with default' do
it { it { should contain_package('python3-heat-dashboard').with(
is_expected.to contain_package('python3-heat-dashboard').with(
:ensure => 'present', :ensure => 'present',
:tag => ['horizon-dashboard-package']) :tag => ['horizon-dashboard-package']
} )}
end end
end end
shared_examples 'horizon::dashboard on Ubuntu' do shared_examples 'horizon::dashboard on Ubuntu' do
context 'with default' do context 'with default' do
it { it { should contain_package('python-heat-dashboard').with(
is_expected.to contain_package('python-heat-dashboard').with(
:ensure => 'present', :ensure => 'present',
:tag => ['horizon-dashboard-package']) :tag => ['horizon-dashboard-package']
} )}
end end
end end