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