Add UI support (+ UI extras)
Implement tuskar::ui with: * tuskar UI package * optionaly and disabled by default, tuskar UI extras package * allow to not manage the package This patch also brings consistency with other modules/classes in renaming ensure_package to package_ensure. Change-Id: I8dd03dffbb2c36c7cdfc82681444cecb6e87021c
This commit is contained in:
parent
6cf2a6dc8d
commit
c56dbbce3d
@ -25,7 +25,7 @@
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# [*package_ensure*]
|
||||
# (optional) Whether the tuskar api package will be installed
|
||||
# Defaults to 'present'
|
||||
#
|
||||
@ -103,7 +103,7 @@ class tuskar::api(
|
||||
$log_facility = 'LOG_USER',
|
||||
$purge_config = false,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present',
|
||||
$package_ensure = 'present',
|
||||
) inherits tuskar {
|
||||
|
||||
require keystone::python
|
||||
@ -182,7 +182,7 @@ class tuskar::api(
|
||||
tuskar::generic_service { 'api':
|
||||
enabled => $enabled,
|
||||
manage_service => $manage_service,
|
||||
ensure_package => $ensure_package,
|
||||
package_ensure => $package_ensure,
|
||||
package_name => $::tuskar::params::api_package_name,
|
||||
service_name => $::tuskar::params::api_service_name,
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ define tuskar::generic_service(
|
||||
$service_name,
|
||||
$enabled = false,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present'
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
include tuskar::params
|
||||
@ -45,7 +45,7 @@ define tuskar::generic_service(
|
||||
if ($package_name) {
|
||||
if !defined(Package[$package_name]) {
|
||||
package { $tuskar_title:
|
||||
ensure => $ensure_package,
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
notify => Service[$tuskar_title],
|
||||
}
|
||||
|
@ -7,11 +7,15 @@ class tuskar::params {
|
||||
$client_package_name = 'openstack-tuskar'
|
||||
$api_package_name = 'openstack-tuskar-api'
|
||||
$api_service_name = 'openstack-tuskar-api'
|
||||
$ui_package_name = 'openstack-tuskar-ui'
|
||||
$ui_extras_package_name = 'openstack-tuskar-ui-extras'
|
||||
}
|
||||
'Debian': {
|
||||
$client_package_name = 'python-tuskarclient'
|
||||
$api_package_name = 'tuskar-api'
|
||||
$api_service_name = 'tuskar-api'
|
||||
$ui_package_name = 'tuskar-ui'
|
||||
$ui_extras_package_name = 'tuskar-ui-extras'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem")
|
||||
|
51
manifests/ui.pp
Normal file
51
manifests/ui.pp
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# tuskar::ui
|
||||
#
|
||||
# Install UI (and UI extras)
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) The state of the package
|
||||
# Defaults to present
|
||||
#
|
||||
# [*extras*]
|
||||
# (optional) Also install UI extras
|
||||
# Defaults to false
|
||||
#
|
||||
class tuskar::ui (
|
||||
$package_ensure = 'present',
|
||||
$extras = false,
|
||||
) {
|
||||
|
||||
include ::tuskar::params
|
||||
|
||||
package { 'tuskar-ui':
|
||||
ensure => $package_ensure,
|
||||
name => $::tuskar::params::ui_package_name,
|
||||
}
|
||||
|
||||
if $extras {
|
||||
package { 'tuskar-ui-extras':
|
||||
ensure => $package_ensure,
|
||||
name => $::tuskar::params::ui_extras_package_name,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
75
spec/classes/tuskar_ui_spec.rb
Normal file
75
spec/classes/tuskar_ui_spec.rb
Normal file
@ -0,0 +1,75 @@
|
||||
#
|
||||
# Unit tests for tuskar::ui
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'tuskar::ui' do
|
||||
|
||||
shared_examples_for 'tuskar ui' do
|
||||
|
||||
context 'with default parameters' do
|
||||
it 'installs tuskar-ui package' do
|
||||
should contain_package('tuskar-ui').with(
|
||||
:name => platform_params[:ui_package_name],
|
||||
:ensure => 'present',
|
||||
)
|
||||
should_not contain_package('tuskar-ui-extras')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with extras parameter parameter provided' do
|
||||
let :params do
|
||||
{ :extras => true }
|
||||
end
|
||||
it 'installs tuskar-ui and tuskar-ui-extras packages' do
|
||||
should contain_package('tuskar-ui').with(
|
||||
:name => platform_params[:ui_package_name],
|
||||
:ensure => 'present',
|
||||
)
|
||||
should contain_package('tuskar-ui-extras').with(
|
||||
:name => platform_params[:ui_extras_package_name],
|
||||
:ensure => 'present',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with package_ensure parameter provided' do
|
||||
let :params do
|
||||
{ :package_ensure => 'absent' }
|
||||
end
|
||||
it 'installs tuskar-ui and tuskar-ui-extras packages' do
|
||||
should contain_package('tuskar-ui').with(
|
||||
:name => platform_params[:ui_package_name],
|
||||
:ensure => 'absent',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :ui_package_name => 'tuskar-ui',
|
||||
:ui_extras_package_name => 'tuskar-ui-extras' }
|
||||
end
|
||||
|
||||
it_configures 'tuskar ui'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :ui_package_name => 'openstack-tuskar-ui',
|
||||
:ui_extras_package_name => 'openstack-tuskar-ui-extras' }
|
||||
end
|
||||
|
||||
it_configures 'tuskar ui'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user