From a1de9e33578fd608e9099dab7f60f5e9b6e996e6 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Thu, 3 Aug 2017 09:37:40 +0800 Subject: [PATCH] Add zaqar client install support Change-Id: I8719facdbbc397c45cec7934ba275f3de8589093 --- manifests/client.pp | 24 +++++++++++++++++++++ manifests/params.pp | 2 +- spec/classes/zaqar_client_spec.rb | 35 +++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 manifests/client.pp create mode 100644 spec/classes/zaqar_client_spec.rb diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 0000000..f48b66d --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,24 @@ +# == Class: zaqar::client +# +# Installs the zaqar python library. +# +# === Parameters: +# +# [*ensure*] +# (Optional) Ensure state for pachage. +# Defaults to 'present'. +# +class zaqar::client ( + $ensure = 'present' +) { + + include ::zaqar::deps + include ::zaqar::params + + package { 'python-zaqarclient': + ensure => $ensure, + name => $::zaqar::params::client_package_name, + tag => 'openstack', + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index d4ab958..0239778 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,7 @@ class zaqar::params { include ::openstacklib::defaults - $client_package = 'python-zaqarclient' + $client_package_name = 'python-zaqarclient' case $::osfamily { 'RedHat': { diff --git a/spec/classes/zaqar_client_spec.rb b/spec/classes/zaqar_client_spec.rb new file mode 100644 index 0000000..f294cb3 --- /dev/null +++ b/spec/classes/zaqar_client_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe 'zaqar::client' do + + shared_examples_for 'zaqar client' do + + it { is_expected.to contain_class('zaqar::deps') } + it { is_expected.to contain_class('zaqar::params') } + + it 'installs zaqar client package' do + is_expected.to contain_package('python-zaqarclient').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 + { :client_package_name => 'python-zaqarclient' } + end + + it_behaves_like 'zaqar client' + end + end + +end