diff --git a/examples/site.pp b/examples/site.pp index 2598a40e..d7e00f53 100644 --- a/examples/site.pp +++ b/examples/site.pp @@ -25,3 +25,5 @@ class { '::gnocchi::statsd': archive_policy_name => 'high', flush_delay => '100', } + +include ::gnocchi::client diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 00000000..f7f20900 --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,21 @@ +# +# Installs the gnocchi python library. +# +# == parameters +# [*ensure*] +# ensure state for package. +# +class gnocchi::client ( + $ensure = 'present' +) { + + include ::gnocchi::params + + package { 'python-gnocchiclient': + ensure => $ensure, + name => $::gnocchi::params::client_package_name, + tag => 'openstack', + } + +} + diff --git a/manifests/params.pp b/manifests/params.pp index d170b9cb..0308dd3e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,6 +12,7 @@ class gnocchi::params { $carbonara_package_name = 'openstack-gnocchi-carbonara' $statsd_package_name = 'openstack-gnocchi-statsd' $statsd_service_name = 'openstack-gnocchi-statsd' + $client_package_name = 'python-gnocchiclient' $gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi' $gnocchi_wsgi_script_source = '/usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi' } @@ -24,6 +25,7 @@ class gnocchi::params { $carbonara_package_name = 'gnocchi-carbonara' $statsd_package_name = 'gnocchi-statsd' $statsd_service_name = 'gnocchi-statsd' + $client_package_name = 'python-gnocchiclient' $gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi' $gnocchi_wsgi_script_source = '/usr/share/gnocchi-common/app.wsgi' } diff --git a/spec/acceptance/basic_gnocchi_spec.rb b/spec/acceptance/basic_gnocchi_spec.rb index 29abe659..b93abe32 100644 --- a/spec/acceptance/basic_gnocchi_spec.rb +++ b/spec/acceptance/basic_gnocchi_spec.rb @@ -47,6 +47,7 @@ describe 'basic gnocchi' do user_id => 'f81e9b1f-9505-4298-bc33-43dfbd9a973b', project_id => '203ef419-e73f-4b8a-a73f-3d599a72b18d', } + class { '::gnocchi::client': } } } EOS diff --git a/spec/classes/gnocchi_client_spec.rb b/spec/classes/gnocchi_client_spec.rb new file mode 100644 index 00000000..87151bc3 --- /dev/null +++ b/spec/classes/gnocchi_client_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe 'gnocchi::client' do + + shared_examples_for 'gnocchi client' do + + it { is_expected.to contain_class('gnocchi::params') } + + it 'installs gnocchi client package' do + is_expected.to contain_package('python-gnocchiclient').with( + :ensure => 'present', + :name => 'python-gnocchiclient', + :tag => 'openstack', + ) + end + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'gnocchi client' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'gnocchi client' + end +end