From bb9ec20383d879c726f1135378b8c184e037d12c Mon Sep 17 00:00:00 2001 From: Michael Chapman Date: Wed, 5 Jun 2013 17:21:25 +1000 Subject: [PATCH] Add an openstack::client class for client nodes Add a class that can be used to create nodes that contain only the openstack client libraries. Also add ceilometer to fixtures so tests pass. Change-Id: I0b9175a582b42fac5cb9f9a10bd5bc877de8632d --- .fixtures.yml | 1 + manifests/client.pp | 57 +++++++++++++++++++++++++++ spec/classes/openstack_client_spec.rb | 47 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 manifests/client.pp create mode 100644 spec/classes/openstack_client_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml index 36a1df7..5ce53e4 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -7,6 +7,7 @@ fixtures: 'horizon': 'git://github.com/stackforge/puppet-horizon' 'swift' : 'git://github.com/stackforge/puppet-swift' 'quantum': 'git://github.com/stackforge/puppet-quantum' + 'ceilometer' : 'git://github.com/stackforge/puppet-ceilometer' "apt": "git://github.com/puppetlabs/puppetlabs-apt.git" "apache": "git://github.com/puppetlabs/puppetlabs-apache.git" "concat": "git://github.com/ripienaar/puppet-concat.git" diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 0000000..8bc8e66 --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,57 @@ +# +# Installs only the OpenStack client libraries +# +# === Parameters +# +# [ceilometer] +# (optional) Install the Ceilometer client package +# +# [cinder] +# (optional) Install the Cinder client package +# +# [glance] +# (optional) Install the Glance client package +# +# [keystone] +# (optional) Install the Keystone client package +# +# [nova] +# (optional) Install the Nova client package +# +# [quantum] +# (optional) Install the Quantum client package +# + +class openstack::client ( + $ceilometer = true, + $cinder = true, + $glance = true, + $keystone = true, + $nova = true, + $quantum = true +) { + + if $ceilometer { + include 'ceilometer::client' + } + + if $cinder { + include 'cinder::client' + } + + if $glance { + include 'glance::client' + } + + if $keystone { + include 'keystone::client' + } + + if $nova { + include 'nova::client' + } + + if $quantum { + include 'quantum::client' + } +} diff --git a/spec/classes/openstack_client_spec.rb b/spec/classes/openstack_client_spec.rb new file mode 100644 index 0000000..f4374ff --- /dev/null +++ b/spec/classes/openstack_client_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +describe 'openstack::client' do + + let :facts do + { :osfamily => 'Debian', :operatingsystem => 'Ubuntu' } + end + + describe 'with default params' do + it { should include_class('ceilometer::client') } + it { should include_class('cinder::client') } + it { should include_class('glance::client') } + it { should include_class('keystone::client') } + it { should include_class('nova::client') } + it { should include_class('quantum::client') } + end + + describe 'without ceilometer' do + let (:params) { {:ceilometer => false }} + it { should_not include_class('ceilometer::client') } + end + + describe 'without cinder' do + let (:params) { {:cinder => false }} + it { should_not include_class('cinder::client') } + end + + describe 'without glance' do + let (:params) { {:glance => false }} + it { should_not include_class('glance::client') } + end + + describe 'without keystone' do + let (:params) { {:keystone => false }} + it { should_not include_class('keystone::client') } + end + + describe 'without nova' do + let (:params) { {:nova => false }} + it { should_not include_class('nova::client') } + end + + describe 'without quantum' do + let (:params) { {:quantum => false }} + it { should_not include_class('quantum::client') } + end +end