diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..dc69f75 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,8 @@ +fixtures: + repositories: + "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + "firewall": "git://github.com/puppetlabs/puppetlabs-firewall.git" + "mysql": "git://github.com/rochaporto/puppet-mysql.git" + symlinks: + "cloudstack": "#{source_dir}" + diff --git a/.gitignore b/.gitignore index 26ddfd5..8e898bd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ tests environments .idea *~ +Gemfile.lock +.bundle +vendor +spec/fixtures diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6d27ea1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: ruby +rvm: + - 1.8.7 + - 1.9.3 + - 2.1.4 +script: + - "bundle exec rake spec SPEC_OPTS='--format documentation'" +env: + - PUPPET_VERSION="~> 2.6.0" + - PUPPET_VERSION="~> 2.7.0" + - PUPPET_VERSION="~> 3.0.0" + - PUPPET_VERSION="~> 3.1.0" + - PUPPET_VERSION="~> 3.8.0" + - PUPPET_VERSION="~> 4.2" +matrix: + exclude: + - rvm: 1.8.7 + env: PUPPET_VERSION="~> 4.2" + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.6.0" + - rvm: 2.1.4 + env: PUPPET_VERSION="~> 2.6.0" + - rvm: 2.1.4 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.1.4 + env: PUPPET_VERSION="~> 3.0.0" + - rvm: 2.1.4 + env: PUPPET_VERSION="~> 3.1.0" + +sudo: false diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..5e01bf6 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +puppetversion = ENV['PUPPET_VERSION'] +gem 'puppet', puppetversion, :require => false +gem 'puppet-lint' +gem 'rspec', '~> 3.1.0', :platforms => :ruby_18 +gem 'puppetlabs_spec_helper', '>= 0.1.0' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1a8a8a0 --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +require 'rubygems' +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint' +PuppetLint.configuration.send("disable_80chars") +PuppetLint.configuration.send('disable_class_parameter_defaults') diff --git a/manifests/cluster.pp b/manifests/cluster.pp index a75f4e2..3364709 100644 --- a/manifests/cluster.pp +++ b/manifests/cluster.pp @@ -45,6 +45,6 @@ "/usr/bin/curl \'${teststring_pod}\' | grep ${podid}", "/usr/bin/curl \'${teststring_cluster}\' | grep -v ${cluster}" ], - require => Exec[ 'cloud_setup_databases' ], + require => Exec[ 'cloudstack_setup_databases' ], } } diff --git a/manifests/init.pp b/manifests/init.pp index d1a7c2b..f52a023 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -43,9 +43,8 @@ yumrepo{ 'cloudstack': - descr => 'Cloudstack repo 4.5', + descr => 'Cloudstack repo 4.5', baseurl => 'http://cloudstack.apt-get.eu/rhel/4.5/', - # baseurl => 'http://cloudstack.apt-get.eu/rhel/4.4/', enabled => '1', gpgcheck => '0', } diff --git a/manifests/mgmt.pp b/manifests/mgmt.pp index 2c6c763..243638c 100644 --- a/manifests/mgmt.pp +++ b/manifests/mgmt.pp @@ -72,20 +72,20 @@ file { '/etc/cloudstack/management/tomcat6.conf': - ensure => 'link', - group => '0', - mode => '0777', - owner => '0', - target => 'tomcat6-nonssl.conf', + ensure => 'link', + group => '0', + mode => '0777', + owner => '0', + target => 'tomcat6-nonssl.conf', require => Package[ 'cloudstack-management' ], } file { '/usr/share/cloudstack-management/conf/server.xml': - ensure => 'link', - group => '0', - mode => '0777', - owner => '0', - target => 'server-nonssl.xml', + ensure => 'link', + group => '0', + mode => '0777', + owner => '0', + target => 'server-nonssl.xml', require => Package[ 'cloudstack-management' ], } diff --git a/manifests/nfs-common.pp b/manifests/nfs_common.pp similarity index 96% rename from manifests/nfs-common.pp rename to manifests/nfs_common.pp index 9bda9cc..a438b11 100644 --- a/manifests/nfs-common.pp +++ b/manifests/nfs_common.pp @@ -1,10 +1,10 @@ -# Class: cloudstack::nfs-common +# Class: cloudstack::nfs_common # # this subclass provides NFS for primary and secondary storage # on a single machine. this is not production quality - but useful # for a POC/demo/dev/test environment. # you will either want to significantly alter or use your own nfs class -class cloudstack::nfs-common { +class cloudstack::nfs_common { package {'nfs-utils': diff --git a/manifests/pod.pp b/manifests/pod.pp index af7f198..d934834 100644 --- a/manifests/pod.pp +++ b/manifests/pod.pp @@ -40,6 +40,6 @@ "/usr/bin/curl \'${teststring_zone}\' | grep ${zoneid}", "/usr/bin/curl \'${teststring_pod}\' | grep -v ${pod}", ], - require => Exec[ 'cloud_setup_databases' ], + require => Exec[ 'cloudstack_setup_databases' ], } } diff --git a/manifests/zone.pp b/manifests/zone.pp index f46a3b2..394e8c5 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -32,6 +32,6 @@ exec { "/usr/bin/curl \'${reststring}\'": onlyif => "/usr/bin/curl \'${teststring}\' | grep -v ${name}", - require => Exec[ 'cloud_setup_databases' ], + require => Exec[ 'cloudstack_setup_databases' ], } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb new file mode 100644 index 0000000..021e37e --- /dev/null +++ b/spec/classes/init_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'cloudstack' do + let(:node) { 'cloudstack.example42.com' } + let(:facts) {{ + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + :operatingsystemrelease => '12.10' + }} + + describe 'generic test' do + it { should compile } + it { should contain_class('cloudstack') } + end +end diff --git a/spec/classes/kvmagent_spec.rb b/spec/classes/kvmagent_spec.rb new file mode 100644 index 0000000..6eb0cb4 --- /dev/null +++ b/spec/classes/kvmagent_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'cloudstack::kvmagent' do + let(:node) { 'cloudstack.example42.com' } + let(:pre_condition) { 'include cloudstack' } + let(:facts) {{ + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + :operatingsystemrelease => '12.10' + }} + + describe 'generic test' do + it { should compile } + it { should contain_class('cloudstack::kvmagent') } + end +end diff --git a/spec/classes/mgmt_spec.rb b/spec/classes/mgmt_spec.rb new file mode 100644 index 0000000..ad2d825 --- /dev/null +++ b/spec/classes/mgmt_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'cloudstack::mgmt' do + let(:node) { 'cloudstack.example42.com' } + let(:pre_condition) { 'include cloudstack' } + let(:facts) {{ + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + :operatingsystemrelease => '12.10' + }} + + describe 'generic test' do + it { should compile } + it { should contain_class('cloudstack::mgmt') } + end +end diff --git a/spec/classes/nfs_common_spec.rb b/spec/classes/nfs_common_spec.rb new file mode 100644 index 0000000..bfe6d53 --- /dev/null +++ b/spec/classes/nfs_common_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'cloudstack::nfs_common' do + let(:node) { 'cloudstack.example42.com' } + let(:facts) {{ + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + :operatingsystemrelease => '12.10' + }} + + describe 'generic test' do + it { should compile } + it { should contain_class('cloudstack::nfs_common') } + end +end diff --git a/spec/defines/cluster_spec.rb b/spec/defines/cluster_spec.rb new file mode 100644 index 0000000..0ce665d --- /dev/null +++ b/spec/defines/cluster_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'cloudstack::cluster', :type => :define do + let(:title) { 'example42' } + let(:facts) {{ + :osfamily => 'RedHat', + :operatingsystem => 'CentOS' + }} + let(:params) {{ + :zoneid => 'cloudstack', + :podid => 'example42' + }} + let(:pre_condition) {[ + 'include cloudstack', + 'include cloudstack::mgmt', + ]} + it { should compile } +end diff --git a/spec/defines/pod_spec.rb b/spec/defines/pod_spec.rb new file mode 100644 index 0000000..e88c31e --- /dev/null +++ b/spec/defines/pod_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe 'cloudstack::pod', :type => :define do + let(:title) { 'example42' } + let(:facts) {{ + :osfamily => 'RedHat', + :operatingsystem => 'CentOS' + }} + let(:params) {{ + :gateway => '127.0.0.1', + :netmask => '255.255.0.0', + :startip => '10.0.2.0', + :endip => '10.2.0.3', + :zoneid => 'example42' + }} + let(:pre_condition) {[ + 'include cloudstack', + 'include cloudstack::mgmt' + ]} + it { should compile } +end diff --git a/spec/defines/zone_spec.rb b/spec/defines/zone_spec.rb new file mode 100644 index 0000000..fc5f3ba --- /dev/null +++ b/spec/defines/zone_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'cloudstack::zone', :type => :define do + let(:title) { 'example42' } + let(:facts) {{ + :osfamily => 'RedHat', + :operatingsystem => 'CentOS' + }} + let(:pre_condition) {[ + 'include cloudstack', + 'include cloudstack::mgmt' + ]} + it { should compile } +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2c6f566 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper'