Merge "Add general basic functionality to the base barbican class"
This commit is contained in:
commit
cb66231bbe
|
@ -1,9 +1,33 @@
|
|||
# == Class: barbican
|
||||
#
|
||||
# Full description of class barbican here.
|
||||
# Barbican base package & configuration
|
||||
#
|
||||
class barbican {
|
||||
# === Parameters
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) Ensure state for package.
|
||||
# Defaults to 'present'.
|
||||
#
|
||||
# [*purge_config*]
|
||||
# (optional) Whether to set only the specified config options
|
||||
# in the cinder config.
|
||||
# Defaults to false.
|
||||
#
|
||||
class barbican(
|
||||
$package_ensure = 'present',
|
||||
$purge_config = false,
|
||||
) {
|
||||
|
||||
include barbican::deps
|
||||
include barbican::params
|
||||
|
||||
package { 'barbican':
|
||||
ensure => $package_ensure,
|
||||
name => $::barbican::params::common_package_name,
|
||||
tag => ['openstack', 'barbican-package'],
|
||||
}
|
||||
|
||||
resources { 'barbican_config':
|
||||
purge => $purge_config,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class barbican::params {
|
|||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
$common_package_name = 'openstack-barbican-common'
|
||||
$api_package_name = 'openstack-barbican-api'
|
||||
$api_service_name = 'openstack-barbican-api'
|
||||
$worker_package_name = 'openstack-barbican-worker'
|
||||
|
@ -22,6 +23,7 @@ class barbican::params {
|
|||
$barbican_wsgi_script_source = '/usr/bin/barbican-wsgi-api'
|
||||
}
|
||||
'Debian': {
|
||||
$common_package_name = 'barbican-common'
|
||||
$api_service_name = 'barbican-api'
|
||||
$api_package_name = 'barbican-api'
|
||||
$worker_package_name = 'barbican-worker'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The ``barbican`` class now installs the ``barbican-common`` package. Status
|
||||
of the package can be customized by the ``barbican::package_ensure``
|
||||
parameter.
|
||||
|
||||
- |
|
||||
The ``barbican::purge_config`` parameter has been added.
|
|
@ -0,0 +1,49 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'barbican' do
|
||||
|
||||
shared_examples 'barbican' do
|
||||
|
||||
it { is_expected.to contain_class('barbican::deps') }
|
||||
|
||||
context 'with default parameters' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'installs packages' do
|
||||
is_expected.to contain_package('barbican').with(
|
||||
:name => platform_params[:barbican_common_package],
|
||||
:ensure => 'present',
|
||||
:tag => ['openstack', 'barbican-package']
|
||||
)
|
||||
end
|
||||
|
||||
it 'passes purge to resource' do
|
||||
is_expected.to contain_resources('barbican_config').with({
|
||||
:purge => false
|
||||
})
|
||||
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'
|
||||
{ :barbican_common_package => 'barbican-common' }
|
||||
when 'RedHat'
|
||||
{ :barbican_common_package => 'openstack-barbican-common' }
|
||||
end
|
||||
end
|
||||
it_behaves_like 'barbican'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue