diff --git a/.gitignore b/.gitignore index 17d43d8..7a76fca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,11 @@ -## Emacs ## -*~ -\#*\# - -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/spec/examples.txt -/test/tmp/ -/test/version_tmp/ -/tmp/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalization: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc +pkg/ +Gemfile.lock +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml +/openstack/ diff --git a/Gemfile b/Gemfile index b33108e..1fab608 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,21 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" -puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 3.3'] -gem 'puppet', puppetversion -gem 'puppetlabs_spec_helper', '>= 0.8.2' -gem 'puppet-lint', '>= 1.0.0' -gem 'facter', '>= 1.7.0' +group :development, :test, :system_tests do + gem 'puppet-openstack_spec_helper', + :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', + :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/Rakefile b/Rakefile index a16ed29..168d108 100644 --- a/Rakefile +++ b/Rakefile @@ -1,17 +1 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] - -desc "Validate manifests, templates, and ruby files" -task :validate do - Dir['manifests/**/*.pp'].each do |manifest| - sh "puppet parser validate --noop #{manifest}" - end - Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file| - sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ - end - Dir['templates/**/*.erb'].each do |template| - sh "erb -P -x -T '-' #{template} | ruby -c" - end -end +require 'puppet-openstack_spec_helper/rake_tasks' diff --git a/manifests/init.pp b/manifests/init.pp index 4f6b052..21d9171 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,16 +20,17 @@ # (optional) Service host name # Defaults to '127.0.0.1' # -# [*listner_auth_peer*] -# (optional) Require the peer's identity to be authenticated. +# [*listener_auth_peer*] +# (optional) # Defaults to 'no' # -# [*listner_idle_timeout*] -# (optional) Idle timeout, in seconds, for connection through the listener +# [*listener_idle_timeout*] +# (optional) # Defaults to '16' # # [*listener_max_frame_size*] -# (optional) Maximum frame size used for a message delivery over the connection +# (optional) Maximum frame size used for a message delivery over the +# connection # Defaults to '16384' # # [*listener_port*] @@ -134,7 +135,7 @@ class qdr( $enable_service = true, $listener_addr = '127.0.0.1', $listener_auth_peer = 'no', - $listener_idle_timout = '16', + $listener_idle_timeout = '16', $listener_max_frame_size = '16384', $listener_port = '5672', $listener_require_encrypt = 'no', diff --git a/manifests/install.pp b/manifests/install.pp index a129c88..66cd862 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,7 +10,7 @@ class qdr::install inherits qdr { $tools_package_list = $::qdr::params::tools_package_list if $::osfamily == 'Debian' { - include apt + include ::apt Class['apt::update'] -> Package<| provider == 'apt' |> diff --git a/metadata.json b/metadata.json index c02051d..8e8704b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,14 +1,59 @@ { - "name": "ajssmith-qdr", + "name": "openstack-qdr", "version": "0.1.0", - "author": "Andy Smith", - "summary": "This module manages qpid-dispatch-router service", + "author": "OpenStack Contributors", + "summary": "Puppet OpenStack Extras Module", "license": "Apache-2.0", - "source": "https://github.com/ajssmith/puppet-qdr", - "project_page": "https://github.com/ajssmith/puppet-qdr", - "issues_url": "https://github.com/ajssmith/puppet-qdr/issues", + "source": "git://github.com/openstack/puppet-qdr.git", + "project_page": "https://launchpad.net/puppet-qdr", + "issues_url": "https://bugs.launchpad.net/puppet-qdr", + "requirements": [ + { + "name": "pe", + "version_requirement": "3.x" + }, + { + "name": "puppet", + "version_requirement": "3.x" + } + ], + "operatingsystem_support": [ + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Fedora", + "operatingsystemrelease": [ + "20" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "6.5", + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "14.04", + "16.04" + ] + } + ], + "description": "Puppet module to add useful utilities for OpenStack deployments", "dependencies": [ - {"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"} + { + "name": "puppetlabs/apt", + "version_requirement": ">=1.8.0 <3.0.0" + }, + { + "name": "puppetlabs/stdlib", + "version_requirement": ">=4.0.0 <5.0.0" + } ] } - diff --git a/spec/acceptance/nodesets/centos-70-x64.yml b/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..5f097e9 --- /dev/null +++ b/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..486b6a3 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/nodepool-centos7.yml b/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/acceptance/nodesets/nodepool-trusty.yml b/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/acceptance/nodesets/nodepool-xenial.yml b/spec/acceptance/nodesets/nodepool-xenial.yml new file mode 100644 index 0000000..99dd318 --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-xenial.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-16.04-amd64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..8001929 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb new file mode 100644 index 0000000..fec0eac --- /dev/null +++ b/spec/shared_examples.rb @@ -0,0 +1,5 @@ +shared_examples_for "a Puppet::Error" do |description| + it "with message matching #{description.inspect}" do + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d6cae69..cad00b1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,10 @@ -require 'rspec-puppet/spec_helper' -require 'rspec-puppet' - -fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) +require 'puppetlabs_spec_helper/module_spec_helper' +require 'shared_examples' +require 'puppet-openstack_spec_helper/facts' RSpec.configure do |c| - c.module_path = File.join(fixture_path, 'modules') - c.manifest_dir = File.join(fixture_path, 'manifests') - c.environmentpath = File.join(Dir.pwd, 'spec') + c.alias_it_should_behave_like_to :it_configures, 'configures' + c.alias_it_should_behave_like_to :it_raises, 'raises' end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..9196bc9 --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/beaker_spec_helper' diff --git a/spec/unit/type/qdr_address_spec.rb b/spec/unit/type/qdr_address_spec.rb index 3f81586..6e73ead 100644 --- a/spec/unit/type/qdr_address_spec.rb +++ b/spec/unit/type/qdr_address_spec.rb @@ -2,12 +2,12 @@ require 'puppet' require 'puppet/type/qdr_address' describe 'Puppet::Type.type(:qdr_address)' do before :each do - @qdr_address = Puppet::Type.type(:qdr_address).new(:prefix => 'unicast', :distribution => 'closest' ) + @qdr_address = Puppet::Type.type(:qdr_address).new(:name => 'test', :prefix => 'unicast', :distribution => 'closest' ) end it 'should not expect a prefix with a whitespace' do expect { - Puppet::Type.type(:qdr_address).new(:prefix => 'multi cast') + Puppet::Type.type(:qdr_address).new(:name => 'test', :prefix => 'multi cast') }.to raise_error(Puppet::Error, /Parameter prefix failed/) end