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
# 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']
})
}

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,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