Introduce senlin::client

This patch aims to add a new class to manage senlin client.

Change-Id: I65f03abfe37e83edeec5106eba97c44ededcb6b0
This commit is contained in:
ZhongShengping 2019-05-16 10:07:27 +08:00
parent b1e61f065c
commit aea92ab404
4 changed files with 72 additions and 2 deletions

26
manifests/client.pp Normal file
View File

@ -0,0 +1,26 @@
# == Class senlin::client
#
# Installs the senlin client.
#
# == Parameters
#
# [*ensure*]
# (Optional) The state for the senlin client package.
# Defaults to 'present'.
#
class senlin::client (
$ensure = 'present'
) {
include ::senlin::deps
include ::senlin::params
package { 'python-senlinclient':
ensure => $ensure,
name => $::senlin::params::client_package_name,
tag => 'openstack',
}
include '::openstacklib::openstackclient'
}

View File

@ -3,10 +3,11 @@
class senlin::params {
include ::senlin::deps
include ::openstacklib::defaults
$pyvers = $::openstacklib::defaults::pyvers
$group = 'senlin'
$client_package_name = "python${pyvers}-senlinclient"
$group = 'senlin'
case $::osfamily {

View File

@ -0,0 +1,3 @@
---
features:
- A new senlin::client class has been added to manage senlin client.

View File

@ -0,0 +1,40 @@
require 'spec_helper'
describe 'senlin::client' do
shared_examples_for 'senlin client' do
it { is_expected.to contain_class('senlin::deps') }
it { is_expected.to contain_class('senlin::params') }
it 'installs senlin client package' do
is_expected.to contain_package('python-senlinclient').with(
:ensure => 'present',
:name => platform_params[:client_package_name],
:tag => 'openstack',
)
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'
{ :client_package_name => 'python3-senlinclient' }
when 'RedHat'
{ :client_package_name => 'python-senlinclient' }
end
end
it_configures 'senlin client'
end
end
end