diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 0000000..c58b134 --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,24 @@ +# == Class: watcher::client +# +# Installs the watcher python library. +# +# === Parameters: +# +# [*ensure*] +# (Optional) Ensure state for pachage. +# Defaults to 'present'. +# +class watcher::client ( + $ensure = 'present' +) { + + include ::watcher::deps + include ::watcher::params + + package { 'python-watcherclient': + ensure => $ensure, + name => $::watcher::params::client_package_name, + tag => 'openstack', + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index 607cb11..829dba1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,6 +12,7 @@ class watcher::params { $applier_service_name = 'openstack-watcher-applier' $decision_engine_package_name = 'openstack-watcher-decision-engine' $decision_engine_service_name = 'openstack-watcher-decision-engine' + $client_package_name = undef } 'Debian': { $api_service_name = 'watcher-api' @@ -21,6 +22,7 @@ class watcher::params { $applier_service_name = 'watcher-applier' $decision_engine_package_name = 'watcher-decision-engine' $decision_engine_service_name = 'watcher-decision-engine' + $client_package_name = 'python-watcherclient' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem") diff --git a/spec/classes/watcher_client_spec.rb b/spec/classes/watcher_client_spec.rb new file mode 100644 index 0000000..bb19806 --- /dev/null +++ b/spec/classes/watcher_client_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe 'watcher::client' do + + shared_examples_for 'watcher client' do + + it { is_expected.to contain_class('watcher::deps') } + it { is_expected.to contain_class('watcher::params') } + + it 'installs watcher client package' do + is_expected.to contain_package('python-watcherclient').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-watcherclient' } + end + + it_behaves_like 'watcher client' + end + end + +end