From a5f546e5b09900f9987abb7f9fe169fa70b4fe70 Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Tue, 23 Jan 2018 11:58:35 -0500 Subject: [PATCH] Add glare client install support Change-Id: I00b9ececdbac3b0769bd32b3205b0bd75345efcf Related-Bug: #1744972 --- manifests/client.pp | 23 ++++++++++++++++++++ manifests/params.pp | 1 + spec/classes/glare_client_spec.rb | 35 +++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 manifests/client.pp create mode 100644 spec/classes/glare_client_spec.rb diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 0000000..fb1c1b4 --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,23 @@ +# == Class: glare::client +# +# Installs the glare python library. +# +# === Parameters: +# +# [*ensure*] +# (Optional) Ensure state for pachage. +# Defaults to 'present'. +# +class glare::client ( + $ensure = 'present' +) { + + include ::glare::deps + include ::glare::params + + package { 'python-glareclient': + ensure => $ensure, + name => $::glare::params::client_package_name, + tag => 'openstack', + } +} diff --git a/manifests/params.pp b/manifests/params.pp index 473b0bd..b1f8478 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,6 +4,7 @@ class glare::params { include ::openstacklib::defaults $group = 'glare' + $client_package_name = 'python-glareclient' case $::osfamily { 'RedHat': { diff --git a/spec/classes/glare_client_spec.rb b/spec/classes/glare_client_spec.rb new file mode 100644 index 0000000..ce77580 --- /dev/null +++ b/spec/classes/glare_client_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe 'glare::client' do + + shared_examples_for 'glare client' do + + it { is_expected.to contain_class('glare::deps') } + it { is_expected.to contain_class('glare::params') } + + it 'installs glare client package' do + is_expected.to contain_package('python-glareclient').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-glareclient' } + end + + it_behaves_like 'glare client' + end + end + +end