Introduce cloudkitty::ui

This patch aims to add a new class to manage
cloudkitty ui component.

Change-Id: Ib91216ce33c9a3e19487f19dc2e59793a6ae7e68
This commit is contained in:
Xingchao Yu 2016-12-01 15:10:27 +08:00
parent 15b6783438
commit 62d6d6caec
2 changed files with 69 additions and 0 deletions

24
manifests/ui.pp Normal file
View File

@ -0,0 +1,24 @@
# == Class: cloudkitty::ui
#
# Installs & configure the cloudkitty ui component
#
# === Parameters
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'.
#
class cloudkitty::ui (
$package_ensure = 'present',
) {
include ::cloudkitty::deps
include ::cloudkitty::params
package { 'cloudkitty-ui':
ensure => $package_ensure,
name => $::cloudkitty::params::ui_package_name,
tag => ['openstack', 'cloudkitty-package'],
}
}

View File

@ -0,0 +1,45 @@
require 'spec_helper'
describe 'cloudkitty::ui' do
let :params do
{ :package_ensure => 'present' }
end
shared_examples_for 'cloudkitty-ui' do
context 'when enabled' do
it { is_expected.to contain_class('cloudkitty::params') }
it { is_expected.to contain_class('cloudkitty::deps') }
it 'installs cloudkitty-ui package' do
is_expected.to contain_package('cloudkitty-ui').with(
:name => platform_params[:ui_package_name],
:ensure => 'present',
:tag => ['openstack', 'cloudkitty-package']
)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :ui_package_name => 'cloudkitty-dashboard' }
when 'RedHat'
{ :ui_package_name => 'openstack-cloudkitty-ui' }
end
end
it_configures 'cloudkitty-ui'
end
end
end