Skip to content

Instantly share code, notes, and snippets.

@pkilambi
Created June 10, 2013 18:32
Show Gist options
  • Save pkilambi/5751084 to your computer and use it in GitHub Desktop.
Save pkilambi/5751084 to your computer and use it in GitHub Desktop.
# pushd modules/openstack;git show -1 --oneline;popd
/usr/share/puppet/modules/openstack /usr/share/puppet
bb9ec20 Add an openstack::client class for client nodes
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_clie
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
(END)
+
+ 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
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment