From ce7d0b9955ae048dda45c3f0ad6b7a0d88568011 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:08:28 +0100 Subject: [PATCH 01/22] Update apache to cc61615850f7cfb70f1d85e5674045e1bf68a39d cc61615850f7cfb70f1d85e5674045e1bf68a39d Merge pull request #1071 from niklas/master 2e6c08b8bcd3af25ca90c28ad48bc8456bdfe8a6 Merge pull request #1063 from igalic/expires 3f88b47a7d9365de1f5e842e0d1d956327ff93de Merge pull request #1065 from igalic/remoteip 53d7c4207a81d5cf6cab2526896364c965e64290 Merge pull request #1077 from ivaldi/configurable_options_for_userdir 3fd21313b1e2772eec4c29e97bb67f6da9d36611 Merge pull request #1086 from btreecat/master 51a226e18dfaaa5e03a1f5b3e9862d58ec7421b9 Merge pull request #1085 from anodelman/master d0b9e8207d730360060465fef4e5accadc73b94f Fixed setting multiple env_var in a location block for proxy pass. 0cf9df0118c8872aee13d1490ddf5592c1d4db6b Merge pull request #1084 from cmurphy/rspec-puppet-2 92b04aaeee8776ab9031a56c31ac12548bb196df (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... 0cba3904c5ba02f79dea17750bd71cf73cc6c068 Merge pull request #1083 from roman-mueller/MODULES-1789 4182dcf269c3dfc1e209d2968e59d9ceb2795d85 Update .travis.yml a7afbdb3450a8af6269a4de77c2b652529269638 Put Puppet 2.7 envs in .sync.yml c46221e169ab3d0874eeef22c5b7a717d3c1ee98 Remove unneeded gem dependencies 85269f1c7bb385ea8b2c52a3b15374627e702f97 Update vhost spec for future parser 09afbcacc82b8fe535695980464baedfd66efccc Packages can't have undef names in future parser 6314dec51c4e8b5d8a7133754b2fd32c5bf721cd Update tests for rspec-puppet 2.0 fefaa40ed3fe7b5fc35b6028a3bf1c908c688be9 Fix variable names, convert flags to bool and use bool2httpd function 43c5c5e7fcd444a790f4d38d4103422042e0346d MODULES-1789 add initial mod_geoip support 66c66516c48c8a9241d4cf2208c6a54ac09d1668 Make Options directive configurable for mod userdir 9b96fc1452902530572a6a29d39311f9b261a4b8 allow acess to userdirs again 12232f76e1c4c070610a8eac882a3e051509e5ec remoteip: force-cast and flatten arguments to arrays e0255bdf8d983654fb35d2a3d3dcd3deccfcc4df Add mod_remoteip module 07f7240ce52cd3f4f01b4641d2b054d7b3a85d1a add parameters to globall configure expires --- Puppetfile | 2 +- apache/.sync.yml | 8 +-- apache/.travis.yml | 23 ++++--- apache/Gemfile | 24 +++++-- apache/README.md | 64 +++++++++++++++++ apache/manifests/dev.pp | 8 ++- apache/manifests/mod/expires.pp | 19 ++++- apache/manifests/mod/geoip.pp | 29 ++++++++ apache/manifests/mod/remoteip.pp | 27 ++++++++ apache/manifests/mod/userdir.pp | 1 + apache/manifests/params.pp | 1 + apache/spec/classes/apache_spec.rb | 6 +- apache/spec/classes/mod/expires_spec.rb | 84 +++++++++++++++++++++++ apache/spec/classes/mod/fcgid_spec.rb | 2 +- apache/spec/classes/mod/peruser_spec.rb | 2 +- apache/spec/classes/mod/remoteip_spec.rb | 53 ++++++++++++++ apache/spec/classes/mod/ssl_spec.rb | 2 +- apache/spec/classes/mod/wsgi_spec.rb | 4 +- apache/spec/classes/params_spec.rb | 5 +- apache/spec/classes/service_spec.rb | 4 +- apache/spec/defines/custom_config_spec.rb | 6 +- apache/spec/defines/vhost_spec.rb | 2 - apache/templates/mod/expires.conf.erb | 11 +++ apache/templates/mod/geoip.conf.erb | 22 ++++++ apache/templates/mod/remoteip.conf.erb | 23 +++++++ apache/templates/mod/userdir.conf.erb | 6 +- apache/templates/vhost/_directories.erb | 3 + apache/templates/vhost/_proxy.erb | 2 +- 28 files changed, 399 insertions(+), 44 deletions(-) create mode 100644 apache/manifests/mod/geoip.pp create mode 100644 apache/manifests/mod/remoteip.pp create mode 100644 apache/spec/classes/mod/expires_spec.rb create mode 100644 apache/spec/classes/mod/remoteip_spec.rb create mode 100644 apache/templates/mod/expires.conf.erb create mode 100644 apache/templates/mod/geoip.conf.erb create mode 100644 apache/templates/mod/remoteip.conf.erb diff --git a/Puppetfile b/Puppetfile index ffbd6c96b..b4a2ac141 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,5 +1,5 @@ mod 'apache', - :commit => '7dde9fc31e68a8acb2bd313fbcbc92ae33e0c440', + :commit => 'cc61615850f7cfb70f1d85e5674045e1bf68a39d', :git => 'https://github.com/puppetlabs/puppetlabs-apache.git' mod 'aviator', diff --git a/apache/.sync.yml b/apache/.sync.yml index 96d3c2bdb..9c89f6918 100644 --- a/apache/.sync.yml +++ b/apache/.sync.yml @@ -1,10 +1,10 @@ --- .travis.yml: extras: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" Rakefile: extra_disabled_lint_checks: - 'disable_only_variable_string' diff --git a/apache/.travis.yml b/apache/.travis.yml index bd66c7d1c..d1a0d7cd9 100644 --- a/apache/.travis.yml +++ b/apache/.travis.yml @@ -1,21 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 1.8.7 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false diff --git a/apache/Gemfile b/apache/Gemfile index 62c569397..fcd27d534 100644 --- a/apache/Gemfile +++ b/apache/Gemfile @@ -1,18 +1,34 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do - gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end diff --git a/apache/README.md b/apache/README.md index ee8897274..a6e3258d6 100644 --- a/apache/README.md +++ b/apache/README.md @@ -16,11 +16,13 @@ * [Classes: apache::mod::*](#classes-apachemodname) * [Class: apache::mod::alias](#class-apachemodalias) * [Class: apache::mod::event](#class-apachemodevent) + * [Class: apache::mod::geoip](#class-apachemodgeoip) * [Class: apache::mod::info](#class-apachemodinfo) * [Class: apache::mod::pagespeed](#class-apachemodpagespeed) * [Class: apache::mod::php](#class-apachemodphp) * [Class: apache::mod::ssl](#class-apachemodssl) * [Class: apache::mod::status](#class-apachemodstatus) + * [Class: apache::mod::expires](#class-apachemodexpires) * [Class: apache::mod::wsgi](#class-apachemodwsgi) * [Class: apache::mod::fcgid](#class-apachemodfcgid) * [Class: apache::mod::negotiation](#class-apachemodnegotiation) @@ -572,6 +574,7 @@ There are many `apache::mod::[name]` classes within this module that can be decl * `proxy_http` * `python` * `reqtimeout` +* `remoteip`* * `rewrite` * `rpaf`* * `setenvif` @@ -624,6 +627,25 @@ Installs and manages mod_auth_cas. The parameters `cas_login_url` and `cas_valid Full documentation on mod_auth_cas is available from [JASIG](https://github.com/Jasig/mod_auth_cas). +####Class: `apache::mod::geoip` + +Installs and manages mod_geoip. + +Full documentation on mod_geoip is available from [MaxMind](http://dev.maxmind.com/geoip/legacy/mod_geoip2/). + +These are the default settings: + +```puppet + class {'apache::mod::geoip': + $enable => false, + $db_file => '/usr/share/GeoIP/GeoIP.dat', + $flag => 'Standard', + $output => 'All', + } +``` + +The parameter `db_file` can be a single directory or a hash of directories. + ####Class: `apache::mod::info` Installs and manages mod_info which provides a comprehensive overview of the server configuration. @@ -798,6 +820,32 @@ Installs Apache mod_status and uses the status.conf.erb template. These are the } ``` +####Class: `apache::mod::expires` + +Installs Apache mod_expires and uses the expires.conf.erb template. These are the defaults: + +```puppet + class { 'apache::mod::expires': + expires_active = true, + expires_default = undef, + expires_by_type = undef, +){ + + + } +``` + +`expires_by_type` is an array of Hashes, describing a set of types and their expire times: + +```puppet + class { 'apache::mod::expires': + expires_by_type = [ + { 'text/json' => 'access plus 1 month' }, + { 'text/html' => 'access plus 1 year' }, + ] + } +``` + ####Class: `apache::mod::wsgi` Enables Python support in the WSGI module. To use, simply `include 'apache::mod::wsgi'`. @@ -1829,6 +1877,22 @@ An array of hashes used to override the [ErrorDocument](https://httpd.apache.org } ``` +######`geoip_enable` + +Sets the [GeoIPEnable](http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Configuration) directive. +Note that you must declare `class {'apache::mod::geoip': }` before using this directive. + +```puppet + apache::vhost { 'first.example.com': + docroot => '/var/www/first', + directories => [ + { path => '/var/www/first', + geoip_enable => true, + }, + ], + } +``` + ######`headers` Adds lines for [Header](http://httpd.apache.org/docs/current/mod/mod_headers.html#header) directives. diff --git a/apache/manifests/dev.pp b/apache/manifests/dev.pp index 4eaeb5578..6bd865606 100644 --- a/apache/manifests/dev.pp +++ b/apache/manifests/dev.pp @@ -4,8 +4,10 @@ } include ::apache::params $packages = $::apache::params::dev_packages - package { $packages: - ensure => present, - require => Package['httpd'], + if $packages { # FreeBSD doesn't have dev packages to install + package { $packages: + ensure => present, + require => Package['httpd'], + } } } diff --git a/apache/manifests/mod/expires.pp b/apache/manifests/mod/expires.pp index aae4c59d9..8c1ce8441 100644 --- a/apache/manifests/mod/expires.pp +++ b/apache/manifests/mod/expires.pp @@ -1,3 +1,20 @@ -class apache::mod::expires { +class apache::mod::expires ( + $expires_active = true, + $expires_default = undef, + $expires_by_type = undef, +) { ::apache::mod { 'expires': } + + # Template uses + # $expries_active + # $expries_default + # $expries_by_type + file { 'expires.conf': + ensure => file, + path => "${::apache::mod_dir}/expires.conf", + content => template('apache/mod/expires.conf.erb'), + require => Exec["mkdir ${::apache::mod_dir}"], + before => File[$::apache::mod_dir], + notify => Class['apache::service'], + } } diff --git a/apache/manifests/mod/geoip.pp b/apache/manifests/mod/geoip.pp new file mode 100644 index 000000000..4e87cb96a --- /dev/null +++ b/apache/manifests/mod/geoip.pp @@ -0,0 +1,29 @@ +class apache::mod::geoip ( + $enable = false, + $db_file = '/usr/share/GeoIP/GeoIP.dat', + $flag = 'Standard', + $output = 'All', + $enable_utf8 = undef, + $scan_proxy_headers = undef, + $use_last_xforwarededfor_ip = undef, +) { + ::apache::mod { 'geoip': } + + # Template uses: + # - enable + # - db_file + # - flag + # - output + # - enable_utf8 + # - scan_proxy_headers + # - use_last_xforwarededfor_ip + file { 'geoip.conf': + ensure => file, + path => "${::apache::mod_dir}/geoip.conf", + content => template('apache/mod/geoip.conf.erb'), + require => Exec["mkdir ${::apache::mod_dir}"], + before => File[$::apache::mod_dir], + notify => Class['apache::service'], + } + +} diff --git a/apache/manifests/mod/remoteip.pp b/apache/manifests/mod/remoteip.pp new file mode 100644 index 000000000..564390e94 --- /dev/null +++ b/apache/manifests/mod/remoteip.pp @@ -0,0 +1,27 @@ +class apache::mod::remoteip ( + $header = 'X-Forwarded-For', + $proxy_ips = [ '127.0.0.1' ], + $proxies_header = undef, + $trusted_proxy_ips = undef, + $apache_version = $::apache::apache_version +) { + if versioncmp($apache_version, '2.4') < 0 { + fail('mod_remoteip is only available in Apache 2.4') + } + + ::apache::mod { 'remoteip': } + + # Template uses: + # - $header + # - $proxy_ips + # - $proxies_header + # - $trusted_proxy_ips + file { 'remoteip.conf': + ensure => file, + path => "${::apache::mod_dir}/remoteip.conf", + content => template('apache/mod/remoteip.conf.erb'), + require => Exec["mkdir ${::apache::mod_dir}"], + before => File[$::apache::mod_dir], + notify => Service['httpd'], + } +} diff --git a/apache/manifests/mod/userdir.pp b/apache/manifests/mod/userdir.pp index 038e0790b..4b3d0b8e8 100644 --- a/apache/manifests/mod/userdir.pp +++ b/apache/manifests/mod/userdir.pp @@ -3,6 +3,7 @@ $dir = 'public_html', $disable_root = true, $apache_version = $::apache::apache_version, + $options = [ 'MultiViews', 'Indexes', 'SymLinksIfOwnerMatch', 'IncludesNoExec' ], ) { ::apache::mod { 'userdir': } diff --git a/apache/manifests/params.pp b/apache/manifests/params.pp index 54b74e64b..ce5edec12 100644 --- a/apache/manifests/params.pp +++ b/apache/manifests/params.pp @@ -77,6 +77,7 @@ }, 'fastcgi' => 'mod_fastcgi', 'fcgid' => 'mod_fcgid', + 'geoip' => 'mod_geoip', 'ldap' => $::apache::version::distrelease ? { '7' => 'mod_ldap', default => undef, diff --git a/apache/spec/classes/apache_spec.rb b/apache/spec/classes/apache_spec.rb index 2be2ef346..07ef1cc27 100644 --- a/apache/spec/classes/apache_spec.rb +++ b/apache/spec/classes/apache_spec.rb @@ -487,7 +487,7 @@ let :params do { :mpm_module => 'breakme' } end - it { expect { subject }.to raise_error Puppet::Error, /does not match/ } + it { expect { catalogue }.to raise_error Puppet::Error, /does not match/ } end end @@ -561,7 +561,7 @@ end it "should fail" do expect do - subject + catalogue end.to raise_error(Puppet::Error, /"foo" does not match/) end end @@ -794,7 +794,7 @@ it do expect { - should compile + catalogue }.to raise_error(Puppet::Error, /Unsupported osfamily/) end end diff --git a/apache/spec/classes/mod/expires_spec.rb b/apache/spec/classes/mod/expires_spec.rb new file mode 100644 index 000000000..e6eab7c48 --- /dev/null +++ b/apache/spec/classes/mod/expires_spec.rb @@ -0,0 +1,84 @@ +require 'spec_helper' + +describe 'apache::mod::expires', :type => :class do + let :pre_condition do + 'include apache' + end + context "with expires active", :compile do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + :is_pe => false, + } + end + it { is_expected.to contain_apache__mod("expires") } + it { is_expected.to contain_file("expires.conf").with(:content => /ExpiresActive On\n/) } + end + context "with expires default", :compile do + let :pre_condition do + 'class { apache: default_mods => false }' + end + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemrelease => '7', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + :is_pe => false, + } + end + let :params do + { + 'expires_default' => 'access plus 1 month' + } + end + it { is_expected.to contain_apache__mod("expires") } + it { is_expected.to contain_file("expires.conf").with_content( + "ExpiresActive On\n" \ + "ExpiresDefault \"access plus 1 month\"\n" + ) + } + end + context "with expires by type", :compile do + let :pre_condition do + 'class { apache: default_mods => false }' + end + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemrelease => '7', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + :is_pe => false, + } + end + let :params do + { + 'expires_by_type' => [ + { 'text/json' => 'mod plus 1 day' }, + { 'text/html' => 'access plus 1 year' }, + ] + } + end + it { is_expected.to contain_apache__mod("expires") } + it { is_expected.to contain_file("expires.conf").with_content( + "ExpiresActive On\n" \ + "ExpiresByType text/json \"mod plus 1 day\"\n" \ + "ExpiresByType text/html \"access plus 1 year\"\n" + ) + } + end +end diff --git a/apache/spec/classes/mod/fcgid_spec.rb b/apache/spec/classes/mod/fcgid_spec.rb index f772ff7a2..096717d35 100644 --- a/apache/spec/classes/mod/fcgid_spec.rb +++ b/apache/spec/classes/mod/fcgid_spec.rb @@ -57,7 +57,7 @@ } end it 'should contain the correct config' do - content = subject.resource('file', 'fcgid.conf').send(:parameters)[:content] + content = catalogue.resource('file', 'fcgid.conf').send(:parameters)[:content] expect(content.split("\n").reject { |c| c =~ /(^#|^$)/ }).to eq([ '', ' AddHandler fcgid-script .fcgi', diff --git a/apache/spec/classes/mod/peruser_spec.rb b/apache/spec/classes/mod/peruser_spec.rb index f39cbcf6c..097a36fff 100644 --- a/apache/spec/classes/mod/peruser_spec.rb +++ b/apache/spec/classes/mod/peruser_spec.rb @@ -19,7 +19,7 @@ end it do expect { - should compile + catalogue }.to raise_error(Puppet::Error, /Unsupported osfamily FreeBSD/) end end diff --git a/apache/spec/classes/mod/remoteip_spec.rb b/apache/spec/classes/mod/remoteip_spec.rb new file mode 100644 index 000000000..e3d095351 --- /dev/null +++ b/apache/spec/classes/mod/remoteip_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +describe 'apache::mod::remoteip', :type => :class do + let :pre_condition do + [ + 'include apache', + ] + end + context "on a Debian OS" do + let :facts do + { + :osfamily => 'Debian', + :operatingsystemrelease => '8', + :concat_basedir => '/dne', + :lsbdistcodename => 'jessie', + :operatingsystem => 'Debian', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + let :params do + { :apache_version => '2.4' } + end + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('remoteip') } + it { is_expected.to contain_file('remoteip.conf').with({ + 'path' => '/etc/apache2/mods-available/remoteip.conf', + }) } + + describe "with header X-Forwarded-For" do + let :params do + { :header => 'X-Forwarded-For' } + end + it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPHeader X-Forwarded-For$/) } + end + describe "with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]" do + let :params do + { :proxy_ips => [ '10.42.17.8', '10.42.18.99' ] } + end + it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPInternalProxy 10.42.17.8$/) } + it { is_expected.to contain_file('remoteip.conf').with_content(/^RemoteIPInternalProxy 10.42.18.99$/) } + end + describe "with Apache version < 2.4" do + let :params do + { :apache_version => '2.2' } + end + it 'should fail' do + expect { subject }.to raise_error(Puppet::Error, /mod_remoteip is only available in Apache 2.4/) + end + end + end +end diff --git a/apache/spec/classes/mod/ssl_spec.rb b/apache/spec/classes/mod/ssl_spec.rb index 7ef8fba5c..50aa8292f 100644 --- a/apache/spec/classes/mod/ssl_spec.rb +++ b/apache/spec/classes/mod/ssl_spec.rb @@ -17,7 +17,7 @@ :is_pe => false, } end - it { expect { subject }.to raise_error(Puppet::Error, /Unsupported osfamily:/) } + it { expect { catalogue }.to raise_error(Puppet::Error, /Unsupported osfamily:/) } end context 'on a RedHat OS' do diff --git a/apache/spec/classes/mod/wsgi_spec.rb b/apache/spec/classes/mod/wsgi_spec.rb index 3f03ec907..5fe313acf 100644 --- a/apache/spec/classes/mod/wsgi_spec.rb +++ b/apache/spec/classes/mod/wsgi_spec.rb @@ -93,7 +93,7 @@ :mod_path => '/foo/bar/baz', } end - it { expect { subject }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ } + it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ } end describe "with mod_path but no package_name" do let :params do @@ -101,7 +101,7 @@ :package_name => '/foo/bar/baz', } end - it { expect { subject }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ } + it { expect { catalogue }.to raise_error Puppet::Error, /apache::mod::wsgi - both package_name and mod_path must be specified!/ } end end context "on a FreeBSD OS" do diff --git a/apache/spec/classes/params_spec.rb b/apache/spec/classes/params_spec.rb index 92b314f92..d02209497 100644 --- a/apache/spec/classes/params_spec.rb +++ b/apache/spec/classes/params_spec.rb @@ -17,11 +17,8 @@ end it { is_expected.to contain_apache__params } - # There are 4 resources in this class currently - # there should not be any more resources because it is a params class - # The resources are class[apache::version], class[apache::params], class[main], class[settings], stage[main] it "Should not contain any resources" do - expect(subject.resources.size).to eq(5) + should have_resource_count(0) end end end diff --git a/apache/spec/classes/service_spec.rb b/apache/spec/classes/service_spec.rb index 09906b0d3..42935aea6 100644 --- a/apache/spec/classes/service_spec.rb +++ b/apache/spec/classes/service_spec.rb @@ -57,7 +57,7 @@ let (:params) {{ :service_enable => 'not-a-boolean' }} it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /is not a boolean/) + expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/) end end @@ -65,7 +65,7 @@ let (:params) {{ :service_manage => 'not-a-boolean' }} it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /is not a boolean/) + expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/) end end diff --git a/apache/spec/defines/custom_config_spec.rb b/apache/spec/defines/custom_config_spec.rb index 4a38a1fcf..a5efd15a2 100644 --- a/apache/spec/defines/custom_config_spec.rb +++ b/apache/spec/defines/custom_config_spec.rb @@ -110,14 +110,14 @@ end it do expect { - should compile + catalogue }.to raise_error(Puppet::Error, /Only one of \$content and \$source can be specified\./) end end context 'neither content nor source' do it do expect { - should compile + catalogue }.to raise_error(Puppet::Error, /One of \$content and \$source must be specified\./) end end @@ -130,7 +130,7 @@ end it do expect { - should compile + catalogue }.to raise_error(Puppet::Error, /is not supported for ensure/) end end diff --git a/apache/spec/defines/vhost_spec.rb b/apache/spec/defines/vhost_spec.rb index add8a2b4a..865fe963d 100644 --- a/apache/spec/defines/vhost_spec.rb +++ b/apache/spec/defines/vhost_spec.rb @@ -168,7 +168,6 @@ 'log_level' => 'crit', 'access_log' => false, 'access_log_file' => 'httpd_access_log', - 'access_log_pipe' => '', 'access_log_syslog' => true, 'access_log_format' => '%h %l %u %t \"%r\" %>s %b', 'access_log_env_var' => '', @@ -187,7 +186,6 @@ ], 'error_log' => false, 'error_log_file' => 'httpd_error_log', - 'error_log_pipe' => '', 'error_log_syslog' => true, 'error_documents' => 'true', 'fallbackresource' => '/index.php', diff --git a/apache/templates/mod/expires.conf.erb b/apache/templates/mod/expires.conf.erb new file mode 100644 index 000000000..7660cfcd0 --- /dev/null +++ b/apache/templates/mod/expires.conf.erb @@ -0,0 +1,11 @@ +ExpiresActive <%= scope.function_bool2httpd([@expires_active]) %> +<%- if ! @expires_default.nil? and ! @expires_default.empty? -%> +ExpiresDefault "<%= @expires_default %>" +<%- end -%> +<%- if ! @expires_by_type.nil? and ! @expires_by_type.empty? -%> +<%- [@expires_by_type].flatten.each do |line| -%> +<%- line.map do |type, seconds| -%> +ExpiresByType <%= type %> "<%= seconds -%>" +<%- end -%> +<%- end -%> +<%- end -%> diff --git a/apache/templates/mod/geoip.conf.erb b/apache/templates/mod/geoip.conf.erb new file mode 100644 index 000000000..84b5dfe92 --- /dev/null +++ b/apache/templates/mod/geoip.conf.erb @@ -0,0 +1,22 @@ +GeoIPEnable <%= scope.function_bool2httpd([@enable]) %> + +<%- if @db_file and ! [ false, 'false', '' ].include?(@db_file) -%> + <%- if @db_file.kind_of?(Array) -%> + <%- Array(@db_file).each do |file| -%> +GeoIPDBFile <%= file %> <%= @flag %> + <%- end -%> + <%- else -%> +GeoIPDBFile <%= @db_file %> <%= @flag %> + <%- end -%> +<%- end -%> +GeoIPOutput <%= @output %> +<% if ! @enable_utf8.nil? -%> +GeoIPEnableUTF8 <%= scope.function_bool2httpd([@enable_utf8]) %> +<% end -%> +<% if ! @scan_proxy_headers.nil? -%> +GeoIPScanProxyHeaders <%= scope.function_bool2httpd([@scan_proxy_headers]) %> +<% end -%> +<% if ! @use_last_xforwarededfor_ip.nil? -%> +GeoIPUseLastXForwardedForIP <%= scope.function_bool2httpd([@use_last_xforwarededfor_ip]) %> +<% end -%> + diff --git a/apache/templates/mod/remoteip.conf.erb b/apache/templates/mod/remoteip.conf.erb new file mode 100644 index 000000000..b4518f9b0 --- /dev/null +++ b/apache/templates/mod/remoteip.conf.erb @@ -0,0 +1,23 @@ +# Declare the header field which should be parsed for useragent IP addresses +RemoteIPHeader <%= @header %> + +<%- if @proxy_ips -%> +# Declare client intranet IP addresses trusted to present +# the RemoteIPHeader value +<%- [@proxy_ips].flatten.each do |proxy| -%> +RemoteIPInternalProxy <%= proxy %> +<%- end -%> +<%- end -%> + +<%- if @proxies_header -%> +# Declare the header field which will record all intermediate IP addresses +RemoteIPProxiesHeader <%= @proxies_header %> +<%- end -%> + +<%- if @trusted_proxy_ips -%> +# Declare client intranet IP addresses trusted to present +# the RemoteIPHeader value + <%- [@trusted_proxy_ips].flatten.each do |proxy| -%> +RemoteIPTrustedProxy <%= proxy %> + <%- end -%> +<%- end -%> diff --git a/apache/templates/mod/userdir.conf.erb b/apache/templates/mod/userdir.conf.erb index add525d5e..9032a3acc 100644 --- a/apache/templates/mod/userdir.conf.erb +++ b/apache/templates/mod/userdir.conf.erb @@ -6,10 +6,10 @@ /*/<%= @dir %>"> AllowOverride FileInfo AuthConfig Limit Indexes - Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec + Options <%= @options.join(' ') %> <%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%> - Require all denied + Require all granted <%- else -%> Order allow,deny Allow from all @@ -17,7 +17,7 @@ <%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%> - Require all denied + Require all granted <%- else -%> Order allow,deny Allow from all diff --git a/apache/templates/vhost/_directories.erb b/apache/templates/vhost/_directories.erb index 4f40cace4..43afb0397 100644 --- a/apache/templates/vhost/_directories.erb +++ b/apache/templates/vhost/_directories.erb @@ -34,6 +34,9 @@ Header <%= header %> <%- end -%> <%- end -%> + <%- if ! directory['geoip_enable'].nil? -%> + GeoIPEnable <%= scope.function_bool2httpd([directory['geoip_enable']]) %> + <%- end -%> <%- if directory['options'] -%> Options <%= Array(directory['options']).join(' ') %> <%- end -%> diff --git a/apache/templates/vhost/_proxy.erb b/apache/templates/vhost/_proxy.erb index 67c8eb274..f290fcb76 100644 --- a/apache/templates/vhost/_proxy.erb +++ b/apache/templates/vhost/_proxy.erb @@ -27,7 +27,7 @@ <%- end -%> <%- if proxy['setenv'] -%> <%- Array(proxy['setenv']).each do |setenv_var| -%> - SetEnv <%= setenv_var -%> + SetEnv <%= setenv_var %> <%- end -%> <%- end -%> From bfeba31bc61731fbbf3c545b969e38d3aa90095c Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:08:41 +0100 Subject: [PATCH 02/22] Update cinder to 77e1c466564dbe33606696ecc9f5507d8811d48b 77e1c466564dbe33606696ecc9f5507d8811d48b Merge "Make scheduler_driver option can be clean up" a8552ca2badd7c7ea5938d6a3782f6221aa5bdb8 Fix spelling of unsupported. 54d77c27ae0725e91165ab9d26f87a9c56ba4d2b Make scheduler_driver option can be clean up --- Puppetfile | 2 +- cinder/manifests/backend/rbd.pp | 2 +- cinder/manifests/params.pp | 2 +- cinder/manifests/scheduler.pp | 4 ++++ cinder/spec/classes/cinder_scheduler_spec.rb | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Puppetfile b/Puppetfile index b4a2ac141..69f5236ae 100644 --- a/Puppetfile +++ b/Puppetfile @@ -15,7 +15,7 @@ mod 'certmonger', :git => 'https://github.com/rcritten/puppet-certmonger.git' mod 'cinder', - :commit => '9b0ff06b6a46d32f29d3cd4b8d0f08fa029551e7', + :commit => '77e1c466564dbe33606696ecc9f5507d8811d48b', :git => 'https://github.com/stackforge/puppet-cinder.git' mod 'common', diff --git a/cinder/manifests/backend/rbd.pp b/cinder/manifests/backend/rbd.pp index 7976fb3e2..444f99846 100644 --- a/cinder/manifests/backend/rbd.pp +++ b/cinder/manifests/backend/rbd.pp @@ -92,7 +92,7 @@ $override_match = '^export CEPH_ARGS=' } default: { - fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms") + fail("unsupported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms") } } diff --git a/cinder/manifests/params.pp b/cinder/manifests/params.pp index 9801f66e2..2a91a2179 100644 --- a/cinder/manifests/params.pp +++ b/cinder/manifests/params.pp @@ -55,6 +55,6 @@ } } else { - fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms") + fail("unsupported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms") } } diff --git a/cinder/manifests/scheduler.pp b/cinder/manifests/scheduler.pp index 0884085f0..9ddd9c0d1 100644 --- a/cinder/manifests/scheduler.pp +++ b/cinder/manifests/scheduler.pp @@ -38,6 +38,10 @@ cinder_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; } + } else { + cinder_config { + 'DEFAULT/scheduler_driver': ensure => absent; + } } if $::cinder::params::scheduler_package { diff --git a/cinder/spec/classes/cinder_scheduler_spec.rb b/cinder/spec/classes/cinder_scheduler_spec.rb index 9cdab1db4..9e5571a09 100644 --- a/cinder/spec/classes/cinder_scheduler_spec.rb +++ b/cinder/spec/classes/cinder_scheduler_spec.rb @@ -11,11 +11,12 @@ describe 'with default parameters' do it { is_expected.to contain_class('cinder::params') } + it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_ensure('absent') } it { is_expected.to contain_package('cinder-scheduler').with( :name => 'cinder-scheduler', :ensure => 'present', - :before => 'Service[cinder-scheduler]' + :before => ['Cinder_config[DEFAULT/scheduler_driver]','Service[cinder-scheduler]'], ) } it { is_expected.to contain_service('cinder-scheduler').with( From 97df7a726ffddc152144c56140690c067e7a8c05 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:08:47 +0100 Subject: [PATCH 03/22] Update concat to 52d0f1d6809c9f1d8453f9e3ca10d792e67acc89 52d0f1d6809c9f1d8453f9e3ca10d792e67acc89 Merge pull request #283 from anodelman/master da601a118751b45c43de87d19bdb55aa3cb31ae2 Merge pull request #281 from psoloway/master 1a9e0170ab9ac16e78e699e25299a4bdea23b5ed README overhaul 6cfd1e536a9bdaa92195ab4d6927680c18574582 (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... --- Puppetfile | 2 +- concat/Gemfile | 6 +- concat/README.md | 372 ++++++++++++++--------------------------------- 3 files changed, 112 insertions(+), 268 deletions(-) diff --git a/Puppetfile b/Puppetfile index 69f5236ae..e5d5228f1 100644 --- a/Puppetfile +++ b/Puppetfile @@ -23,7 +23,7 @@ mod 'common', :git => 'https://github.com/purpleidea/puppet-common.git' mod 'concat', - :commit => 'c4a14b40451effa90542c6aa4ccbb599274e8e94', + :commit => '52d0f1d6809c9f1d8453f9e3ca10d792e67acc89', :git => 'https://github.com/puppetlabs/puppetlabs-concat.git' mod 'firewall', diff --git a/concat/Gemfile b/concat/Gemfile index a9e0734a4..cc4048aec 100644 --- a/concat/Gemfile +++ b/concat/Gemfile @@ -21,11 +21,15 @@ group :development, :unit_tests do gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do + if beaker_version + gem 'beaker', *location_for(beaker_version) + end if beaker_rspec_version gem 'beaker-rspec', *location_for(beaker_rspec_version) - else + else gem 'beaker-rspec', :require => false end gem 'serverspec', :require => false diff --git a/concat/README.md b/concat/README.md index b1cb66b64..873f6478a 100644 --- a/concat/README.md +++ b/concat/README.md @@ -1,4 +1,4 @@ -#Concat +#concat ####Table of Contents @@ -6,41 +6,40 @@ 2. [Module Description - What the module does and why it is useful](#module-description) 3. [Setup - The basics of getting started with concat](#setup) * [What concat affects](#what-concat-affects) - * [Setup requirements](#setup-requirements) * [Beginning with concat](#beginning-with-concat) 4. [Usage - Configuration options and additional functionality](#usage) - * [API _deprecations_](#api-deprecations) 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) -5. [Limitations - OS compatibility, etc.](#limitations) -6. [Development - Guide for contributing to the module](#development) + * [Public Defines](#public-defines) + * [Parameters](#parameters) + * [Deprecations](#deprecations) +6. [Limitations - OS compatibility, etc.](#limitations) +7. [Development - Guide for contributing to the module](#development) ##Overview -This module constructs files from multiple fragments in an ordered way. +The concat module lets you construct files from multiple ordered fragments of text. ##Module Description -This module lets you use many concat::fragment{} resources throughout -your modules to construct a single file at the end. It does this through -a shell (or ruby) script and a temporary holding space for the fragments. +The concat module lets you gather `concat::fragment` resources from your other modules and order them through a single `concat` resource into a coherent file. It does this through a Ruby script and a temporary holding space for the fragments. ##Setup ###What concat affects -* Installs concatfragments.[sh|rb] based on platform. -* Adds a concat/ directory into Puppets `vardir`. +* Installs `concatfragments.rb`. +* Adds a `concat/` directory into Puppet's `vardir`. ###Beginning with concat To start using concat you need to create: * A concat{} resource for the final file. -* One or more concat::fragment{}'s. +* One or more concat::fragment{}s. A minimal example might be: -```puppet +~~~ concat { '/tmp/file': ensure => present, } @@ -50,29 +49,15 @@ concat::fragment { 'tmpfile': content => 'test contents', order => '01' } -``` +~~~ ##Usage -Please be aware that there have been a number of [API -_deprecations_](#api-deprecations). +###Maintain a list of the major modules on a node -If you wanted a /etc/motd file that listed all the major modules -on the machine. And that would be maintained automatically even -if you just remove the include lines for other modules you could -use code like below, a sample /etc/motd would be: +To maintain an motd file that lists the modules on one of your nodes, first create a class to frame up the file: -
-Puppet modules on this server:
-
-    -- Apache
-    -- MySQL
-
- -Local sysadmins can also append to the file by just editing /etc/motd.local -their changes will be incorporated into the puppet managed motd. - -```puppet +~~~ class motd { $motd = '/etc/motd' @@ -88,7 +73,7 @@ class motd { order => '01' } - # local users on the machine can append to motd by just creating + # let local users add to the motd by creating a file called # /etc/motd.local concat::fragment{ 'motd_local': target => $motd, @@ -97,7 +82,7 @@ class motd { } } -# used by other modules to register themselves in the motd +# let other modules register themselves in the motd define motd::register($content="", $order='10') { if $content == "" { $body = $name @@ -111,333 +96,188 @@ define motd::register($content="", $order='10') { content => " -- $body\n" } } -``` +~~~ -To use this you'd then do something like: +Then, in the declarations for each module on the node, add `motd::register{ 'Apache': }` to register the module in the motd. -```puppet +~~~ class apache { include apache::install, apache::config, apache::service motd::register{ 'Apache': } } -``` +~~~ -##Reference +These two steps populate the /etc/motd file with a list of the installed and registered modules, which stays updated even if you just remove the registered modules' `include` lines. System administrators can append text to the list by writing to /etc/motd.local. -###Classes +When you're finished, the motd file will look something like this: -####Public classes +~~~ + Puppet modules on this server: -####Private classes -* `concat::setup`: Sets up the concat script/directories. + -- Apache + -- MySQL -###Parameters + +~~~ -###Defines +##Reference -####concat +**Note**: Several of this module's parameters and features have been deprecated. See the [Deprecations](#deprecations) section below. -#####`ensure` -Controls if the combined file is present or absent. +###Public defines +* `concat`: Manages a file, compiled from one or more text fragments. +* `concat::fragment`: Manages a fragment of text to be compiled into a file. -######Example -- ensure => present -- ensure => absent +###Parameters -#####`path` -Controls the destination of the file to create. +####`concat` -######Example -- path => '/tmp/filename' +All the parameters listed below are optional. -#####`owner` -Set the owner of the combined file. +#####`backup` -######Example -- owner => 'root' +Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's [native `file` resource](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-backup) for execution. Valid options: 'true', 'false', or a string representing either a target filebucket or a filename extension beginning with ".". Default value: 'puppet'. -#####`group` -Set the group of the combined file. +#####`ensure` -######Example -- group => 'root' +Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and negates the effect of any other parameters. Valid options: 'present' and 'absent'. Default value: 'present'. -#####`mode` -Set the mode of the combined file. -######Example -- mode => '0644' - -#####`warn` -Determine if a warning message should be added at the top of the file to let -users know it was autogenerated by Puppet. It should be a boolean or a string -containing the contents of the warning message. +#####`ensure_newline` -######Example -- warn => true -- warn => false -- warn => '# This file is autogenerated!' +Specifies whether to ensure there's a new line at the end of each fragment. Valid options: 'true' and 'false'. Default value: 'false'. #####`force` -Determine if empty files are allowed when no fragments were added. -######Example -- force => true -- force => false +In case no fragments have been added, this parameter specifies whether to go ahead and create a potentially empty file. Valid options: 'true' and 'false'. Default value: 'false'. -#####`backup` -Controls the filebucket behavior used for the file. +#####`group` -######Example -- backup => 'puppet' +Specifies a permissions group for the destination file. Valid options: a string containing a group name. Default value: undefined. -#####`replace` -Controls if Puppet should replace the destination file if it already exists. +#####`mode` -######Example -- replace => true -- replace => false +Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. Default value: '0644'. #####`order` -Controls the way in which the shell script chooses to sort the files. It's -rare you'll need to adjust this. -######Allowed Values -- order => 'alpha' -- order => 'numeric' +Specifies a method for sorting your fragments by name within the destination file. Valid options: 'alpha' (e.g., '1, 10, 2') or 'numeric' (e.g., '1, 2, 10'). Default value: 'alpha'. -#####`ensure_newline` -Ensure there's a newline at the end of the fragments. +You can override this setting for individual fragments by adjusting the `order` parameter in their `concat::fragment` declarations. -######Example -- ensure_newline => true -- ensure_newline => false +#####`owner` -#####`validate_cmd` -Ensure the destination file passes the following validation command. -Only supported on Puppet >= 3.5.0. -######Example -- validate_cmd => '/usr/sbin/apache2 -t -f %' -- validate_cmd => '/usr/sbin/visudo -c -f %' +Specifies the owner of the destination file. Valid options: a string containing a username. Default value: undefined. -####concat::fragment +#####`path` -#####`target` -Choose the destination file of the fragment. -######Example -- target => '/tmp/testfile' +Specifies a destination file for the combined fragments. Valid options: a string containing an absolute path. Default value: the title of your declared resource. -#####`content` -Create the content of the fragment. +#####`replace` -######Example -- content => 'test file contents' +Specifies whether to overwrite the destination file if it already exists. Valid options: 'true' and 'false'. Default value: 'true'. -#####`source` -Find the sources within Puppet of the fragment. +#####`validate_cmd` -######Example -- source => 'puppet:///modules/test/testfile' -- source => ['puppet:///modules/test/1', 'puppet:///modules/test/2'] +Specifies a validation command to apply to the destination file. Requires Puppet version 3.5 or newer. Valid options: a string to be passed to a file resource. Default value: undefined. -#####`order` -Order the fragments. +#####`warn` -######Example -- order => '01' +Specifies whether to add a warning message at the top of the destination file so users know it was autogenerated by Puppet. Valid options: 'true', 'false', or a string to be delivered as a warning message. Default value: 'false'. -Best practice is to pass a string to this parameter but integer values are accepted. -#####`ensure` -Control the file of fragment created. +If you set this parameter to 'true', Puppet adds the following message: -######Example -- ensure => 'present' -- ensure => 'absent' +~~~ +# This file is managed by Puppet. DO NOT EDIT. +~~~ -#####`mode` -Set the mode of the fragment. +####`concat::fragment` -######Example -- mode => '0644' - -#####`owner` -Set the owner of the fragment. -######Example -- owner => 'root' +Except where noted, all the below parameters are optional. -#####`group` -Set the group of the fragment. +#####`content` -######Example -- group => 'root' +Supplies the content of the fragment. **Note**: You must supply either a `content` parameter or a `source` parameter. Valid options: a string. Default value: undef. -#####`backup` -Control the filebucket behavior for the fragment. +#####`ensure` -######Example -- backup => 'puppet' +Specifies whether the fragment should be included in the destination file or discarded. Valid options: 'present' and 'absent'. Default value: 'present'. -### API _deprecations_ +#####`order` -#### Since version `1.0.0` +Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. Valid options: a string (recommended) or an integer. Default value: '10'. -##### `concat{}` `warn` parameter +#####`source` -```puppet -concat { '/tmp/file': - ensure => present, - warn => 'true', # generates stringified boolean value warning -} -``` +Specifies a file to read into the content of the fragment. **Note**: You must supply either a `content` parameter or a `source` parameter. Valid options: a string or an array, containing one or more Puppet URLs. Default value: undefined. -Using stringified Boolean values as the `warn` parameter to `concat` is -deprecated, generates a catalog compile time warning, and will be silently -treated as the concatenated file header/warning message in a future release. +#####`target` -The following strings are considered a stringified Boolean value: +*Required.* Specifies the destination file of the fragment. Valid options: a string containing an absolute path. - * `'true'` - * `'yes'` - * `'on'` - * `'false'` - * `'no'` - * `'off'` +###Deprecations -Please migrate to using the Puppet DSL's native [Boolean data -type](http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#booleans). +**`concat` has the following deprecations** -##### `concat{}` `gnu` parameter +#####`gnu` -```puppet -concat { '/tmp/file': - ensure => present, - gnu => $foo, # generates deprecation warning -} -``` +Generates a catalog compile time warning and has no effect. This parameter was silently ignored in version `1.0.0` and will be removed in a future release. -The `gnu` parameter to `concat` is deprecated, generates a catalog compile time -warning, and has no effect. This parameter will be removed in a future -release. +#####stringified 'true'/'false' values deprecated in `warn` -Note that this parameter was silently ignored in the `1.0.0` release. +Passing stringified boolean values (strings of 'true' and 'false') to the `warn` parameter of `concat` is deprecated. Generates a catalog compile time warning, and will be silently treated as the concatenated file header/warning message in a future release. -##### `concat::fragment{}` `ensure` parameter +Please migrate to using the Puppet DSL's native [Boolean data +type](http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#booleans). -```puppet -concat::fragment { 'cpuinfo': - ensure => '/proc/cpuinfo', # generates deprecation warning - target => '/tmp/file', -} -``` - -Passing a value other than `'present'` or `'absent'` as the `ensure` parameter -to `concat::fragment` is deprecated and generates a catalog compile time -warning. The warning will become a catalog compilation failure in a future -release. - -This type emulates the Puppet core `file` type's disfavored [`ensure` -semantics](http://docs.puppetlabs.com/references/latest/type.html#file-attribute-ensure) -of treating a file path as a directive to create a symlink. This feature is -problematic in several ways. It copies an API semantic of another type that is -both frowned upon and not generally well known. It's behavior may be -surprising in that the target concatenated file will not be a symlink nor is -there any common file system that has a concept of a section of a plain file -being symbolically linked to another file. Additionally, the behavior is -generally inconsistent with most Puppet types in that a missing source file -will be silently ignored. - -If you want to use the content of a file as a fragment please use the `source` -parameter. - -##### `concat::fragment{}` `mode/owner/group` parameters - -```puppet -concat::fragment { 'foo': - target => '/tmp/file', - content => 'foo', - mode => $mode, # generates deprecation warning - owner => $owner, # generates deprecation warning - group => $group, # generates deprecation warning -} -``` -The `mode` parameter to `concat::fragment` is deprecated, generates a catalog compile time warning, and has no effect. +**`concat::fragment` has the following deprecations** -The `owner` parameter to `concat::fragment` is deprecated, generates a catalog -compile time warning, and has no effect. +#####`backup` -The `group` parameter to `concat::fragment` is deprecated, generates a catalog -compile time warning, and has no effect. +Generates a catalog compile time warning and has no effect. In the `1.0.0` release this parameter controlled file bucketing of the file fragment. Bucketing the fragment(s) is redundant with bucketing the final concatenated file and this feature has been removed. -These parameters had no user visible effect in version `1.0.0` and will be -removed in a future release. -##### `concat::fragment{}` `backup` parameter +#####`group` -```puppet -concat::fragment { 'foo': - target => '/tmp/file', - content => 'foo', - backup => 'bar', # generates deprecation warning -} -``` +Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release. -The `backup` parameter to `concat::fragment` is deprecated, generates a catalog -compile time warning, and has no effect. It will be removed in a future -release. +#####`mode` -In the `1.0.0` release this parameter controlled file bucketing of the file -fragment. Bucketting the fragment(s) is redundant with bucketting the final -concatenated file and this feature has been removed. +Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release. -##### `class { 'concat::setup': }` -```puppet -include concat::setup # generates deprecation warning +#####`owner` -class { 'concat::setup': } # generates deprecation warning -``` +Generates a catalog compile time warning and has no effect. Had no user-visible effect in version `1.0.0` and will be removed in a future release. -The `concat::setup` class is deprecated as a public API of this module and -should no longer be directly included in the manifest. This class may be -removed in a future release. +#####file paths are deprecated in `ensure` -##### Parameter validation +Passing a value other than 'present' or 'absent' in the `ensure` parameter of `concat::fragment` is **deprecated**, and generates a catalog compile time warning. The warning will become a catalog compilation failure in a future release. -While not an API depreciation, users should be aware that all public parameters -in this module are now validated for at least variable type. This may cause -validation errors in a manifest that was previously silently misbehaving. +If you want to use the content of a file as a fragment please use the [`source`](#source) parameter. -##Limitations +####`concat::setup` -This module has been tested on: +The `concat::setup` class should no longer be directly included in the manifest. It will be removed in a future release. -* RedHat Enterprise Linux (and Centos) 5/6 -* Debian 6/7 -* Ubuntu 12.04 +##Limitations -Testing on other platforms has been light and cannot be guaranteed. +This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. -#Development +##Development -Puppet Labs modules on the Puppet Forge are open projects, and community -contributions are essential for keeping them great. We can’t access the -huge number of platforms and myriad of hardware, software, and deployment -configurations that Puppet is intended to serve. +Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. -We want to keep it as easy as possible to contribute changes so that our -modules work in your environment. There are a few guidelines that we need -contributors to follow so that we can have a chance of keeping on top of things. +We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. -You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing) +For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html) ###Contributors -The list of contributors can be found at: - -https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors +To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors) \ No newline at end of file From 04f74d6b1d542b65276ee2129c3a5d3a61098c35 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:08:52 +0100 Subject: [PATCH 04/22] Update firewall to eaa2fac5152c7712b1676de5d30a7c8d6307ab4d eaa2fac5152c7712b1676de5d30a7c8d6307ab4d Merge pull request #460 from Zlo/MODULES-1636 292b9abaab456d1bf431975d27a47b050a1adbbd Merge pull request #503 from anodelman/master d0d070ffc0938f0bf48038836dc260554b6ed453 Merge pull request #500 from petems/MAINT-add_redhat_7_acceptance_test 30b39298595aff09f2e44cd364da5d0ac2f3ce33 Merge pull request #502 from cmurphy/rspec-puppet-2 41b536742f15d9ba126bd3c0c30dbfb860362cfb (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... 9861dc25818ba54dbe1455dea1b9ecf2659d4922 Update .travis.yml 60ea993b7739b3a2bcf83dee868205deb33bd0d1 Keep testing on puppet 2.7 0cf4866aaef7479f4952edb0b75d0b0d0e736b40 Ensure lint fail on warnings 7be1592064d97aa74d2e176f878e526d351971f1 Unpin rspec gems and remove unneeded dependencies c2613de74c3805e2a8ff449531f3d8cb597f44c7 (MAINT) Adds an acceptance test for RHEL 7 07667a03f4e113643bdb5ac499fa226dae94c0a2 MODULES-1636: add iptables --checksum-fill support --- Puppetfile | 2 +- firewall/.sync.yml | 6 ++ firewall/.travis.yml | 19 +++++-- firewall/Gemfile | 24 ++++++-- firewall/README.markdown | 2 + firewall/Rakefile | 2 +- .../lib/puppet/provider/firewall/ip6tables.rb | 6 +- .../lib/puppet/provider/firewall/iptables.rb | 4 +- firewall/lib/puppet/type/firewall.rb | 14 +++++ firewall/spec/acceptance/firewall_spec.rb | 56 +++++++++++++++++++ .../spec/acceptance/nodesets/centos-7-x64.yml | 11 ++++ firewall/spec/acceptance/rhel7_spec.rb | 30 ++++++++++ firewall/spec/spec_helper_acceptance.rb | 15 +++++ 13 files changed, 178 insertions(+), 13 deletions(-) create mode 100644 firewall/spec/acceptance/nodesets/centos-7-x64.yml create mode 100644 firewall/spec/acceptance/rhel7_spec.rb diff --git a/Puppetfile b/Puppetfile index e5d5228f1..8cdec8776 100644 --- a/Puppetfile +++ b/Puppetfile @@ -27,7 +27,7 @@ mod 'concat', :git => 'https://github.com/puppetlabs/puppetlabs-concat.git' mod 'firewall', - :commit => '7ac535981bc43a1821e8c047e7834bbcee8c5a40', + :commit => 'eaa2fac5152c7712b1676de5d30a7c8d6307ab4d', :git => 'https://github.com/puppetlabs/puppetlabs-firewall.git' mod 'galera', diff --git a/firewall/.sync.yml b/firewall/.sync.yml index 66a03c649..ac8379073 100644 --- a/firewall/.sync.yml +++ b/firewall/.sync.yml @@ -1,3 +1,9 @@ --- +.travis.yml: + extras: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" spec/spec_helper.rb: unmanaged: true diff --git a/firewall/.travis.yml b/firewall/.travis.yml index 6cf8b0044..d1a0d7cd9 100644 --- a/firewall/.travis.yml +++ b/firewall/.travis.yml @@ -1,17 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false diff --git a/firewall/Gemfile b/firewall/Gemfile index 62c569397..fcd27d534 100644 --- a/firewall/Gemfile +++ b/firewall/Gemfile @@ -1,18 +1,34 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do - gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end diff --git a/firewall/README.markdown b/firewall/README.markdown index 01e8dc114..8e46d36f4 100644 --- a/firewall/README.markdown +++ b/firewall/README.markdown @@ -437,6 +437,8 @@ If Puppet is managing the iptables or iptables-persistent packages, and the prov * `chain`: Name of the chain to use. You can provide a user-based chain or use one of the following built-in chains:'INPUT','FORWARD','OUTPUT','PREROUTING', or 'POSTROUTING'. The default value is 'INPUT'. Values must match '/^[a-zA-Z0-9\-_]+$/'. Requires the `iptables` feature. + * `checksum_fill`: When using a `jump` value of 'CHECKSUM' this boolean will make sure that a checksum is calculated and filled in a packet that lacks a checksum. Valid values are true or false. Requires the `iptables` feature. + * `connlimit_above`: Connection limiting value for matched connections above n. Values must match '/^\d+$/'. Requires the `connection_limiting` feature. * `connlimit_mask`: Connection limiting by subnet mask for matched connections. Apply a subnet mask of /0 to /32 for IPv4, and a subnet mask of /0 to /128 for IPv6. Values must match '/^\d+$/'. Requires the `connection_limiting` feature. diff --git a/firewall/Rakefile b/firewall/Rakefile index e3be95b0b..181157e6e 100644 --- a/firewall/Rakefile +++ b/firewall/Rakefile @@ -1,7 +1,7 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') diff --git a/firewall/lib/puppet/provider/firewall/ip6tables.rb b/firewall/lib/puppet/provider/firewall/ip6tables.rb index b1e390220..8acae8f2e 100644 --- a/firewall/lib/puppet/provider/firewall/ip6tables.rb +++ b/firewall/lib/puppet/provider/firewall/ip6tables.rb @@ -65,6 +65,7 @@ def self.iptables_save(*args) @resource_map = { :burst => "--limit-burst", + :checksum_fill => "--checksum-fill", :connlimit_above => "-m connlimit --connlimit-above", :connlimit_mask => "--connlimit-mask", :connmark => "-m connmark --mark", @@ -128,6 +129,7 @@ def self.iptables_save(*args) # These are known booleans that do not take a value, but we want to munge # to true if they exist. @known_booleans = [ + :checksum_fill, :ishasmorefrags, :islastfrag, :isfirstfrag, @@ -198,7 +200,7 @@ def self.iptables_save(*args) :dst_type, :socket, :pkttype, :name, :ipsec_dir, :ipsec_policy, :state, :ctstate, :icmp, :hop_limit, :limit, :burst, :recent, :rseconds, :reap, :rhitcount, :rttl, :rname, :mask, :rsource, :rdest, :ipset, :jump, :todest, - :tosource, :toports, :log_level, :log_prefix, :reject, :set_mark, - :connlimit_above, :connlimit_mask, :connmark] + :tosource, :toports, :checksum_fill, :log_level, :log_prefix, :reject, + :set_mark, :connlimit_above, :connlimit_mask, :connmark] end diff --git a/firewall/lib/puppet/provider/firewall/iptables.rb b/firewall/lib/puppet/provider/firewall/iptables.rb index b4713eefa..089689cdf 100644 --- a/firewall/lib/puppet/provider/firewall/iptables.rb +++ b/firewall/lib/puppet/provider/firewall/iptables.rb @@ -51,6 +51,7 @@ @resource_map = { :burst => "--limit-burst", + :checksum_fill => "--checksum-fill", :connlimit_above => "-m connlimit --connlimit-above", :connlimit_mask => "--connlimit-mask", :connmark => "-m connmark --mark", @@ -113,6 +114,7 @@ # These are known booleans that do not take a value, but we want to munge # to true if they exist. @known_booleans = [ + :checksum_fill, :isfragment, :random, :rdest, @@ -223,7 +225,7 @@ def munge_resource_map_from_resource(resource_map_original, compare) :src_type, :dst_type, :socket, :pkttype, :name, :ipsec_dir, :ipsec_policy, :state, :ctstate, :icmp, :limit, :burst, :recent, :rseconds, :reap, :rhitcount, :rttl, :rname, :mask, :rsource, :rdest, :ipset, :jump, :todest, - :tosource, :toports, :to, :random, :log_prefix, :log_level, :reject, :set_mark, + :tosource, :toports, :to, :checksum_fill, :random, :log_prefix, :log_level, :reject, :set_mark, :connlimit_above, :connlimit_mask, :connmark ] diff --git a/firewall/lib/puppet/type/firewall.rb b/firewall/lib/puppet/type/firewall.rb index 46756e341..3add88788 100644 --- a/firewall/lib/puppet/type/firewall.rb +++ b/firewall/lib/puppet/type/firewall.rb @@ -1060,6 +1060,14 @@ def insync?(is) EOS end + newproperty(:checksum_fill, :required_features => :iptables) do + desc <<-EOS + Compute and fill missing packet checksums. + EOS + + newvalues(:true, :false) + end + newparam(:line) do desc <<-EOS Read-only property for caching the rule line. @@ -1252,5 +1260,11 @@ def insync?(is) self.fail "Parameter 'stat_probability' requires 'stat_mode' to be set to 'random'" end + if value(:checksum_fill) + unless value(:jump).to_s == "CHECKSUM" && value(:table).to_s == "mangle" + self.fail "Parameter checksum_fill requires jump => CHECKSUM and table => mangle" + end + end + end end diff --git a/firewall/spec/acceptance/firewall_spec.rb b/firewall/spec/acceptance/firewall_spec.rb index 8c29dee36..331d831ae 100644 --- a/firewall/spec/acceptance/firewall_spec.rb +++ b/firewall/spec/acceptance/firewall_spec.rb @@ -833,6 +833,62 @@ class { '::firewall': } end end + describe 'checksum_fill' do + context 'virbr' do + it 'applies' do + pp = <<-EOS + class { '::firewall': } + firewall { '576 - test': + proto => udp, + table => 'mangle', + outiface => 'virbr0', + chain => 'POSTROUTING', + dport => '68', + jump => 'CHECKSUM', + checksum_fill => true, + provider => iptables, + } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + it 'should contain the rule' do + shell('iptables-save -t mangle') do |r| + expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + end + end + end + end + + describe 'checksum_fill6' do + context 'virbr' do + it 'applies' do + pp = <<-EOS + class { '::firewall': } + firewall { '576 - test': + proto => udp, + table => 'mangle', + outiface => 'virbr0', + chain => 'POSTROUTING', + dport => '68', + jump => 'CHECKSUM', + checksum_fill => true, + provider => ip6tables, + } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + it 'should contain the rule' do + shell('ip6tables-save -t mangle') do |r| + expect(r.stdout).to match(/-A POSTROUTING -o virbr0 -p udp -m multiport --dports 68 -m comment --comment "576 - test" -j CHECKSUM --checksum-fill/) + end + end + end + end + # RHEL5 does not support --random if default['platform'] !~ /el-5/ describe 'random' do diff --git a/firewall/spec/acceptance/nodesets/centos-7-x64.yml b/firewall/spec/acceptance/nodesets/centos-7-x64.yml new file mode 100644 index 000000000..f20fe44d9 --- /dev/null +++ b/firewall/spec/acceptance/nodesets/centos-7-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-7-x64: + roles: + - master + platform: el-7-x86_64 + box : puppetlabs/centos-7.0-64-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-7.0-64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss + log_level: verbose \ No newline at end of file diff --git a/firewall/spec/acceptance/rhel7_spec.rb b/firewall/spec/acceptance/rhel7_spec.rb new file mode 100644 index 000000000..5754adae8 --- /dev/null +++ b/firewall/spec/acceptance/rhel7_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper_acceptance' + +describe 'firewall on RHEL7', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) || !is_rhel7( !is_rhel7( fact('osfamily'), fact('operatingsystem'), fact('operatingsystemrelease') ) ) do + before :all do + iptables_flush_all_tables + end + + it 'should run successfully' do + pp = " + class { 'firewall': + remove_firewalld => true, + } + -> + resources { 'firewall': + purge => true, + } + -> + firewall { '555 - test': + proto => tcp, + port => '555', + action => accept, + } + " + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true, :debug => true) + expect(apply_manifest(pp, :catch_failures => true, :debug => true).exit_code).to be_zero + end + +end diff --git a/firewall/spec/spec_helper_acceptance.rb b/firewall/spec/spec_helper_acceptance.rb index b9af87641..28910a286 100644 --- a/firewall/spec/spec_helper_acceptance.rb +++ b/firewall/spec/spec_helper_acceptance.rb @@ -12,6 +12,21 @@ def ip6tables_flush_all_tables end end +def is_rhel7(osfamily, operatingsystem, operatingsystemrelease) + if osfamily == 'RedHat' + case operatingsystem + when 'Amazon' + false + when 'Fedora' + operatingsystemrelease >= '7.0' + else + operatingsystemrelease >= '15' + end + else + false + end +end + unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' # This will install the latest available package on el and deb based # systems fail on windows and osx, and install via gem on other *nixes From a7a7683c705c9bad4884cc2314a501acdfd57256 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:08:58 +0100 Subject: [PATCH 05/22] Update glance to 101ca5b088f3aec5d70c567f29dfdfa5609524ab 101ca5b088f3aec5d70c567f29dfdfa5609524ab Move rbd related options into glance_store section --- Puppetfile | 2 +- glance/manifests/backend/rbd.pp | 10 +++++----- glance/spec/classes/glance_backend_rbd_spec.rb | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Puppetfile b/Puppetfile index 8cdec8776..4a8340d8b 100644 --- a/Puppetfile +++ b/Puppetfile @@ -35,7 +35,7 @@ mod 'galera', :git => 'https://github.com/redhat-openstack/puppet-galera.git' mod 'glance', - :commit => '0eed538b35d636f38bec93bf9d3cefa6803efae8', + :commit => '101ca5b088f3aec5d70c567f29dfdfa5609524ab', :git => 'https://github.com/stackforge/puppet-glance.git' mod 'gluster', diff --git a/glance/manifests/backend/rbd.pp b/glance/manifests/backend/rbd.pp index 903b91a8b..edd830106 100644 --- a/glance/manifests/backend/rbd.pp +++ b/glance/manifests/backend/rbd.pp @@ -42,11 +42,11 @@ # == class: glance::backend::rbd } glance_api_config { - 'DEFAULT/rbd_store_ceph_conf': value => $rbd_store_ceph_conf; - 'DEFAULT/rbd_store_user': value => $rbd_store_user; - 'DEFAULT/rbd_store_pool': value => $rbd_store_pool; - 'DEFAULT/rbd_store_chunk_size': value => $rbd_store_chunk_size; - 'glance_store/default_store': value => 'rbd'; + 'glance_store/default_store': value => 'rbd'; + 'glance_store/rbd_store_ceph_conf': value => $rbd_store_ceph_conf; + 'glance_store/rbd_store_user': value => $rbd_store_user; + 'glance_store/rbd_store_pool': value => $rbd_store_pool; + 'glance_store/rbd_store_chunk_size': value => $rbd_store_chunk_size; } package { 'python-ceph': diff --git a/glance/spec/classes/glance_backend_rbd_spec.rb b/glance/spec/classes/glance_backend_rbd_spec.rb index 8c6492203..4ca1c18db 100644 --- a/glance/spec/classes/glance_backend_rbd_spec.rb +++ b/glance/spec/classes/glance_backend_rbd_spec.rb @@ -15,9 +15,9 @@ end it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('rbd') } - it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_pool').with_value('images') } - it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') } - it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('8') } + it { is_expected.to contain_glance_api_config('glance_store/rbd_store_pool').with_value('images') } + it { is_expected.to contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') } + it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('8') } it { is_expected.to contain_package('python-ceph').with( :name => 'python-ceph', @@ -34,8 +34,8 @@ :package_ensure => 'latest', } end - it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_user').with_value('user') } - it { is_expected.to contain_glance_api_config('DEFAULT/rbd_store_chunk_size').with_value('2') } + it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('user') } + it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') } it { is_expected.to contain_package('python-ceph').with( :name => 'python-ceph', :ensure => 'latest' From 03311437988432e9e1b97dc675cee3269e499824 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:10 +0100 Subject: [PATCH 06/22] Update haproxy to 8790b5e9f45982da8e57cbfccc25506eed0ecbf4 8790b5e9f45982da8e57cbfccc25506eed0ecbf4 Merge pull request #169 from anodelman/master 8dbfa37ba93076c14f580abea6040bd41068a36f (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... --- Puppetfile | 2 +- haproxy/Gemfile | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Puppetfile b/Puppetfile index 4a8340d8b..c5687c813 100644 --- a/Puppetfile +++ b/Puppetfile @@ -47,7 +47,7 @@ mod 'gnocchi', :git => 'https://github.com/stackforge/puppet-gnocchi.git' mod 'haproxy', - :commit => 'e06cc633e23dcacb272af1106924b8ba6b28a256', + :commit => '8790b5e9f45982da8e57cbfccc25506eed0ecbf4', :git => 'https://github.com/puppetlabs/puppetlabs-haproxy.git' mod 'heat', diff --git a/haproxy/Gemfile b/haproxy/Gemfile index 62c569397..e1ae0fa56 100644 --- a/haproxy/Gemfile +++ b/haproxy/Gemfile @@ -1,5 +1,15 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false @@ -11,8 +21,17 @@ group :development, :unit_tests do gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end From bec3acea51ef2f9670db6954849f76563dbc3294 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:13 +0100 Subject: [PATCH 07/22] Update heat to 6c2de4990c9f732a972783e85aaaec22ea98b1a1 6c2de4990c9f732a972783e85aaaec22ea98b1a1 Merge "Added missing enable_stack_abandon configuration option." c67c563416f1983e7de09b391ab5ae5b968b2ab9 Added missing enable_stack_abandon configuration option. --- Puppetfile | 2 +- heat/manifests/engine.pp | 6 ++++++ heat/spec/classes/heat_engine_spec.rb | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Puppetfile b/Puppetfile index c5687c813..a187b579f 100644 --- a/Puppetfile +++ b/Puppetfile @@ -51,7 +51,7 @@ mod 'haproxy', :git => 'https://github.com/puppetlabs/puppetlabs-haproxy.git' mod 'heat', - :commit => '8c09567b62040245ae196d36ac8f2c94b3a9b6c9', + :commit => '6c2de4990c9f732a972783e85aaaec22ea98b1a1', :git => 'https://github.com/stackforge/puppet-heat.git' mod 'horizon', diff --git a/heat/manifests/engine.pp b/heat/manifests/engine.pp index c3aea1de6..d7554bb19 100644 --- a/heat/manifests/engine.pp +++ b/heat/manifests/engine.pp @@ -30,6 +30,10 @@ # (optional) URL of the Heat cloudwatch server # Defaults to 'http://127.0.0.1:8003' # +# [*enable_stack_abandon*] +# (optional) Whether to allow the stack-abandon operation. +# Defaults to false +# # [*engine_life_check_timeout*] # (optional) RPC timeout (in seconds) for the engine liveness check that is # used for stack locking @@ -65,6 +69,7 @@ $deferred_auth_method = 'trusts', $trusts_delegated_roles = ['heat_stack_owner'], #DEPRECATED $configure_delegated_roles = true, #DEPRECATED + $enable_stack_abandon = false, ) { include ::heat::params @@ -115,5 +120,6 @@ 'DEFAULT/engine_life_check_timeout' : value => $engine_life_check_timeout; 'DEFAULT/trusts_delegated_roles' : value => $trusts_delegated_roles; 'DEFAULT/deferred_auth_method' : value => $deferred_auth_method; + 'DEFAULT/enable_stack_abandon' : value => $enable_stack_abandon; } } diff --git a/heat/spec/classes/heat_engine_spec.rb b/heat/spec/classes/heat_engine_spec.rb index b20255e72..4a129ea30 100644 --- a/heat/spec/classes/heat_engine_spec.rb +++ b/heat/spec/classes/heat_engine_spec.rb @@ -75,6 +75,27 @@ end end + context 'stack-abandon enabled' do + before do + params.merge!( + :enable_stack_abandon => true, + ) + end + + it { is_expected.to contain_heat_config('DEFAULT/enable_stack_abandon').with_value(true) } + end + + context 'stack-abandon disabled' do + before do + params.merge!( + :enable_stack_abandon => false, + ) + end + + it { is_expected.to contain_heat_config('DEFAULT/enable_stack_abandon').with_value(false) } + end + + context 'with disabled service managing' do before do params.merge!({ From d428281ed0acdf527e4892a029b9d84e4a5d336e Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:24 +0100 Subject: [PATCH 08/22] Update inifile to 57c68ba9ec6b5c255e89b28f91e56b2bfab50202 57c68ba9ec6b5c255e89b28f91e56b2bfab50202 Merge pull request #154 from psoloway/master 9789615104b8269d842c27b5b56e38b4d5a9caa3 Updates README per DOC-1502 --- Puppetfile | 2 +- inifile/README.markdown | 210 +++++++++++++++++++++------------------- 2 files changed, 113 insertions(+), 99 deletions(-) diff --git a/Puppetfile b/Puppetfile index a187b579f..3c42bbb3e 100644 --- a/Puppetfile +++ b/Puppetfile @@ -59,7 +59,7 @@ mod 'horizon', :git => 'https://github.com/stackforge/puppet-horizon.git' mod 'inifile', - :commit => '606de6971d019fa9557d0866e90942a3d6e06a97', + :commit => '57c68ba9ec6b5c255e89b28f91e56b2bfab50202', :git => 'https://github.com/puppetlabs/puppetlabs-inifile.git' mod 'ipa', diff --git a/inifile/README.markdown b/inifile/README.markdown index 2a2f8f87a..e5f740a66 100644 --- a/inifile/README.markdown +++ b/inifile/README.markdown @@ -1,6 +1,4 @@ - - -#INI file +#inifile [![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-inifile.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-inifile) @@ -9,74 +7,77 @@ 1. [Overview](#overview) 2. [Module Description - What the module does and why it is useful](#module-description) 3. [Setup - The basics of getting started with inifile module](#setup) - * [Setup requirements](#setup-requirements) * [Beginning with inifile](#beginning-with-inifile) 4. [Usage - Configuration options and additional functionality](#usage) 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) -##Overview +##Overview -This module adds resource types to manage settings in INI-style configuration files. +The inifile module lets Puppet manage settings stored in INI-style configuration files. ##Module Description -The inifile module adds two resource types so that you can use Puppet to manage settings and subsettings in INI-style configuration files. - -This module tries hard not to manipulate your file any more than it needs to. In most cases, it should leave the original whitespace, comments, ordering, etc. intact. - -###Noteworthy module features include: - - * Supports comments starting with either '#' or ';'. - * Supports either whitespace or no whitespace around '='. - * Adds any missing sections to the INI file. +Many applications use INI-style configuration files to store their settings. This module supplies two custom resource types to let you manage those settings through Puppet. ##Setup -##Beginning with inifile +###Beginning with inifile -To manage an INI file, add the resource type `ini_setting` or `ini_subsetting` to a class. -##Usage +To manage a single setting in an INI file, add the `ini_setting` type to a class: -Manage individual settings in INI files by adding the `ini_setting` resource type to a class. For example: - -``` +~~~ ini_setting { "sample setting": ensure => present, path => '/tmp/foo.ini', - section => 'foo', - setting => 'foosetting', - value => 'FOO!', + section => 'bar', + setting => 'baz', + value => 'quux', } -``` +~~~ + +##Usage + + +The inifile module tries hard not to manipulate your file any more than it needs to. In most cases, it doesn't affect the original whitespace, comments, ordering, etc. -To control multiple values in a setting, use `ini_subsetting`. For example: -``` + * Supports comments starting with either '#' or ';'. + * Supports either whitespace or no whitespace around '='. + * Adds any missing sections to the INI file. + +###Manage multiple values in a setting + +Use the `ini_subsetting` type: + +~~~ JAVA_ARGS="-Xmx192m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/pe-puppetdb/puppetdb-oom.hprof " ini_subsetting {'sample subsetting': - ensure => present, - section => '', + ensure => present, + section => '', key_val_separator => '=', - path => '/etc/default/pe-puppetdb', - setting => 'JAVA_ARGS', - subsetting => '-Xmx', - value => '512m', + path => '/etc/default/pe-puppetdb', + setting => 'JAVA_ARGS', + subsetting => '-Xmx', + value => '512m', } -``` +~~~ + +###Implement child providers -###Implementing child providers: -You can set up custom child providers that inherit the `ini_setting` provider. This allows you to implement custom resources to manage INI settings for specific configuration files without copying all the code or writing your own code from scratch. This also allows resource purging to be used. +You might want to create child providers that inherit the `ini_setting` provider, for one or both of these purposes: -To implement child providers, you'll need to specify your own type. This type needs to implement a namevar (name) and a property called value: + * Make a custom resource to manage an application that stores its settings in INI files, without recreating the code to manage the files themselves. -For example: + * [Purge all unmanaged settings](https://docs.puppetlabs.com/references/latest/type.html#resources-attribute-purge) from a managed INI file. -``` +To implement child providers, first specify a custom type. Have it implement a namevar called `name` and a property called `value`: + +~~~ #my_module/lib/puppet/type/glance_api_config.rb Puppet::Type.newtype(:glance_api_config) do ensurable @@ -86,17 +87,17 @@ Puppet::Type.newtype(:glance_api_config) do newvalues(/\S+\/\S+/) end newproperty(:value) do - desc 'The value of the setting to be defined.' + desc 'The value of the setting to define' munge do |v| v.to_s.strip end end end -``` +~~~ -This type must also have a provider that uses the `ini_setting` provider as its parent. For example: +Your type also needs a provider that uses the `ini_setting` provider as its parent: -``` +~~~ # my_module/lib/puppet/provider/glance_api_config/ini_setting.rb Puppet::Type.type(:glance_api_config).provide( :ini_setting, @@ -116,111 +117,124 @@ Puppet::Type.type(:glance_api_config).provide( '/etc/glance/glance-api.conf' end end -``` +~~~ -Now the individual settings of the /etc/glance/glance-api.conf file can be managed as individual resources: +Now the settings in /etc/glance/glance-api.conf file can be managed as individual resources: -``` +~~~ glance_api_config { 'HEADER/important_config': value => 'secret_value', } -``` +~~~ -If the self.file_path has been implemented, you can purge with the following Puppet syntax: +If you've implemented self.file_path, you can have Puppet purge the file of all lines that aren't implemented as Puppet resources: -``` +~~~ resources { 'glance_api_config' purge => true, } -``` - -If the above code is added, the resulting configured file will contain only lines implemented as Puppet resources. +~~~ ##Reference -###Type: ini_setting +###Public Types + + * [`ini_setting`](#type-ini_setting) + + * [`ini_subsetting`](#type-ini_subsetting) + +### Type: ini_setting + +Manages a setting within an INI file. #### Parameters -* `ensure`: Ensures that the resource is present. Valid values are 'present', 'absent'. +##### `ensure` + +Determines whether the specified setting should exist. Valid options: 'present' and 'absent'. Default value: 'present'. + +##### `key_val_separator` + +*Optional.* Specifies a string to use between each setting name and value (e.g., to determine whether the separator includes whitespace). Valid options: a string. Default value: ' = '. + +##### `name` + +*Optional.* Specifies an arbitrary name to identify the resource. Valid options: a string. Default value: the title of your declared resource. -* `key_val_separator`: The separator string to use between each setting name and value. Defaults to ' = ', but you could use this to override the default (e.g., whether or not the separator should include whitespace). +##### `path` -* `name`: An arbitrary name used as the identity of the resource. +*Required.* Specifies an INI file containing the setting to manage. Valid options: a string containing an absolute path. -* `path`: The INI file in which Puppet ensures the specified setting. +##### `section` -* `provider`: The specific backend to use for this `ini_setting` resource. You will seldom need to specify this --- Puppet usually discovers the appropriate provider for your platform. The only available provider for `ini_setting` is ruby. +*Required.* Designates a section of the specified INI file containing the setting to manage. To manage a global setting (at the beginning of the file, before any named sections) enter "". Valid options: a string. -* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by specifying a section name of "". +##### `setting` -* `setting`: The name of the INI file setting to be defined. +*Required.* Designates a setting to manage within the specified INI file and section. Valid options: a string. -* `value`: The value of the INI file setting to be defined. +##### `value` -###Type: ini_subsetting +*Optional.* Supplies a value for the specified setting. Valid options: a string. Default value: undefined. + +### Type: ini_subsetting + + +Manages multiple values within the same INI setting. #### Parameters -* `ensure`: Ensures that the resource is present. Valid values are 'present', 'absent'. +##### `ensure` -* `key_val_separator`: The separator string to use between each setting name and value. Defaults to ' = ', but you could use this to override the default (e.g., whether or not the separator should include whitespace). +Specifies whether the subsetting should be present. Valid options: 'present' and 'absent'. Default value: 'present'. -* `name`: An arbitrary name used as the identity of the resource. +##### `key_val_separator` -* `path`: The INI file in which Puppet ensures the specified setting. +*Optional.* Specifies a string to use between subsetting name and value (e.g., to determine whether the separator includes whitespace). Valid options: a string. Default value: ' = '. -* `provider`: The specific backend to use for this `ini_subsetting` resource. You will seldom need to specify this --- Puppet usually discovers the appropriate provider for your platform. The only available provider for `ini_subsetting` is ruby. +##### `path` -* `quote_char`: The character used to quote the entire value of the setting. Valid values are '', '"', and "'". Defaults to ''. +*Required.* Specifies an INI file containing the subsetting to manage. Valid options: a string containing an absolute path. -* `section`: The name of the INI file section in which the setting should be defined. Add a global section --- settings that appear at the beginning of the file, before any named sections --- by specifying a section name of "". +##### `quote_char` -* `setting`: The name of the INI file setting to be defined. +*Optional.* The character used to quote the entire value of the setting. Valid values are '', '"', and "'". Defaults to ''. Valid options: '', '"' and "'". Default value: ''. -* `subsetting`: The name of the INI file subsetting to be defined. +##### `section` -* `subsetting_separator`: The separator string used between subsettings. Defaults to " ". +*Required.* Designates a section of the specified INI file containing the subsetting to manage. To manage a global setting (at the beginning of the file, before any named sections) enter "". Valid options: a string, or "". -* `value`: The value of the INI file subsetting to be defined. +##### `setting` -##Limitations +*Required.* Designates a setting within the specified section containing the subsetting to manage. Valid options: a string. -This module is officially [supported](https://forge.puppetlabs.com/supported) on : +##### `subsetting` -* Red Hat Enterprise Linux (RHEL) 5, 6, 7 -* CentOS 5, 6, 7 -* Oracle Linux 5, 6, 7 -* Scientific Linux 5, 6, 7 -* SLES 11 SP1 or greater -* Debian 6, 7 -* Ubuntu 10.04 LTS, 12.04 LTS, 14.04 LTS -* Solaris 10, 11 -* Windows Server 2003/2008 R2, 2012/2012 R2 -* AIX 5.3, 6.1, 7.1 +*Required.* Designates a subsetting to manage within the specified setting. Valid options: a string. -This module has also been tested, but is not officially supported, on: -* Red Hat Enterprise Linux (RHEL) 4 -* Windows 7 -* Mac OSX 10.9 (Mavericks) +##### `subsetting_separator` -### Agent run failure with Puppet Enterprise +*Optional.* Specifies a string to use between subsettings. Valid options: a string. Default value: " ". -As of Puppet Enterprise 3.3, agent runs on master fail if you are using an older, manually installed version of inifile. To solve this problem, upgrade your inifile module to version 1.1.0 or later. +##### `value` -##Development - -Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. +*Optional.* Supplies a value for the specified subsetting. Valid options: a string. Default value: undefined. -We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. +##Limitations -You can read the complete module contribution guide in [CONTRIBUTING.md](./CONTRIBUTING.md) +This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. Additionally, it is tested (but not supported) on Windows 7 and Mac OS X 10.9. -##Contributors +##Development -The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors). +#Development +Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. + +We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. +For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html) +###Contributors +To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-inifile/graphs/contributors) \ No newline at end of file From 68e6b9d50acbf2e55cfc8c2bd0085ec3f80c790d Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:33 +0100 Subject: [PATCH 09/22] Update ironic to f1ca7eb98a959c6de8365913b3bd0624b85fc1e7 f1ca7eb98a959c6de8365913b3bd0624b85fc1e7 spec: updates for rspec-puppet 2.x and rspec 3.x --- Puppetfile | 2 +- ironic/Gemfile | 5 +- ironic/spec/classes/ironic_api_spec.rb | 34 ++++----- ironic/spec/classes/ironic_client_spec.rb | 4 +- ironic/spec/classes/ironic_conductor_spec.rb | 14 ++-- ironic/spec/classes/ironic_db_mysql_spec.rb | 4 +- .../spec/classes/ironic_drivers_ipmi_spec.rb | 4 +- .../spec/classes/ironic_drivers_pxe_spec.rb | 36 +++++----- ironic/spec/classes/ironic_init_spec.rb | 70 +++++++++---------- .../spec/classes/ironic_keystone_auth_spec.rb | 38 +++++----- ironic/spec/classes/ironic_policy_spec.rb | 2 +- ironic/spec/shared_examples.rb | 2 +- ironic/spec/unit/provider/ironic_spec.rb | 4 +- 13 files changed, 108 insertions(+), 111 deletions(-) diff --git a/Puppetfile b/Puppetfile index 3c42bbb3e..114cd7baa 100644 --- a/Puppetfile +++ b/Puppetfile @@ -67,7 +67,7 @@ mod 'ipa', :git => 'https://github.com/xbezdick/puppet-ipa-1.git' mod 'ironic', - :commit => '1b44b7d826813a4628683754091774d945223ac2', + :commit => 'f1ca7eb98a959c6de8365913b3bd0624b85fc1e7', :git => 'https://github.com/stackforge/puppet-ironic.git' mod 'keystone', diff --git a/ironic/Gemfile b/ironic/Gemfile index aca61249d..9af5bb4a1 100644 --- a/ironic/Gemfile +++ b/ironic/Gemfile @@ -2,8 +2,8 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false + gem 'rspec-puppet', '~> 2.0.0', :require => false - gem 'puppet-lint', '~> 1.1.0' gem 'metadata-json-lint' gem 'puppet-lint-absolute_classname-check' gem 'puppet-lint-absolute_template_path' @@ -15,9 +15,6 @@ group :development, :test do gem 'puppet-lint-variable_contains_upcase' gem 'puppet-lint-numericvariable' - gem 'rspec-puppet', '~> 1.0.1' - gem 'rake', '10.1.1' - gem 'rspec', '< 2.99' gem 'json' gem 'webmock' end diff --git a/ironic/spec/classes/ironic_api_spec.rb b/ironic/spec/classes/ironic_api_spec.rb index 48e619b7c..b6b79be87 100644 --- a/ironic/spec/classes/ironic_api_spec.rb +++ b/ironic/spec/classes/ironic_api_spec.rb @@ -41,32 +41,32 @@ default_params.merge(params) end - it { should contain_class('ironic::params') } - it { should contain_class('ironic::policy') } + it { is_expected.to contain_class('ironic::params') } + it { is_expected.to contain_class('ironic::policy') } it 'installs ironic api package' do if platform_params.has_key?(:api_package) - should contain_package('ironic-api').with( + is_expected.to contain_package('ironic-api').with( :name => platform_params[:api_package], :ensure => p[:package_ensure] ) - should contain_package('ironic-api').with_before(/Ironic_config\[.+\]/) - should contain_package('ironic-api').with_before(/Service\[ironic-api\]/) + is_expected.to contain_package('ironic-api').with_before(/Ironic_config\[.+\]/) + is_expected.to contain_package('ironic-api').with_before(/Service\[ironic-api\]/) end end it 'ensure ironic api service is running' do - should contain_service('ironic-api').with('hasstatus' => true) + is_expected.to contain_service('ironic-api').with('hasstatus' => true) end it 'configures ironic.conf' do - should contain_ironic_config('api/port').with_value(p[:port]) - should contain_ironic_config('api/host_ip').with_value(p[:host_ip]) - should contain_ironic_config('api/max_limit').with_value(p[:max_limit]) - should contain_ironic_config('keystone_authtoken/admin_password').with_value(p[:admin_password]) - should contain_ironic_config('keystone_authtoken/admin_user').with_value(p[:admin_user]) - should contain_ironic_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/') - should contain_ironic_config('neutron/url').with_value('http://127.0.0.1:9696/') + is_expected.to contain_ironic_config('api/port').with_value(p[:port]) + is_expected.to contain_ironic_config('api/host_ip').with_value(p[:host_ip]) + is_expected.to contain_ironic_config('api/max_limit').with_value(p[:max_limit]) + is_expected.to contain_ironic_config('keystone_authtoken/admin_password').with_value(p[:admin_password]) + is_expected.to contain_ironic_config('keystone_authtoken/admin_user').with_value(p[:admin_user]) + is_expected.to contain_ironic_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/') + is_expected.to contain_ironic_config('neutron/url').with_value('http://127.0.0.1:9696/') end context 'when overriding parameters' do @@ -80,10 +80,10 @@ ) end it 'should replace default parameter with new value' do - should contain_ironic_config('api/port').with_value(p[:port]) - should contain_ironic_config('api/host_ip').with_value(p[:host_ip]) - should contain_ironic_config('api/max_limit').with_value(p[:max_limit]) - should contain_ironic_config('keystone_authtoken/auth_uri').with_value('https://1.2.3.4:5000/') + is_expected.to contain_ironic_config('api/port').with_value(p[:port]) + is_expected.to contain_ironic_config('api/host_ip').with_value(p[:host_ip]) + is_expected.to contain_ironic_config('api/max_limit').with_value(p[:max_limit]) + is_expected.to contain_ironic_config('keystone_authtoken/auth_uri').with_value('https://1.2.3.4:5000/') end end diff --git a/ironic/spec/classes/ironic_client_spec.rb b/ironic/spec/classes/ironic_client_spec.rb index fa473f019..b4b4eb49c 100644 --- a/ironic/spec/classes/ironic_client_spec.rb +++ b/ironic/spec/classes/ironic_client_spec.rb @@ -27,7 +27,7 @@ { :osfamily => 'Debian' } end - it { should contain_class('ironic::client') } + it { is_expected.to contain_class('ironic::client') } end context 'on RedHat platforms' do @@ -35,6 +35,6 @@ { :osfamily => 'RedHat' } end - it { should contain_class('ironic::client') } + it { is_expected.to contain_class('ironic::client') } end end diff --git a/ironic/spec/classes/ironic_conductor_spec.rb b/ironic/spec/classes/ironic_conductor_spec.rb index f523a0623..5b7f6cd97 100644 --- a/ironic/spec/classes/ironic_conductor_spec.rb +++ b/ironic/spec/classes/ironic_conductor_spec.rb @@ -37,25 +37,25 @@ default_params.merge(params) end - it { should contain_class('ironic::params') } + it { is_expected.to contain_class('ironic::params') } it 'installs ironic conductor package' do if platform_params.has_key?(:conductor_package) - should contain_package('ironic-conductor').with( + is_expected.to contain_package('ironic-conductor').with( :name => platform_params[:conductor_package], :ensure => p[:package_ensure] ) - should contain_package('ironic-conductor').with_before(/Ironic_config\[.+\]/) - should contain_package('ironic-conductor').with_before(/Service\[ironic-conductor\]/) + is_expected.to contain_package('ironic-conductor').with_before(/Ironic_config\[.+\]/) + is_expected.to contain_package('ironic-conductor').with_before(/Service\[ironic-conductor\]/) end end it 'ensure ironic conductor service is running' do - should contain_service('ironic-conductor').with('hasstatus' => true) + is_expected.to contain_service('ironic-conductor').with('hasstatus' => true) end it 'configures ironic.conf' do - should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) + is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) end context 'when overriding parameters' do @@ -63,7 +63,7 @@ params.merge!(:max_time_interval => '50') end it 'should replace default parameter with new value' do - should contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) + is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) end end diff --git a/ironic/spec/classes/ironic_db_mysql_spec.rb b/ironic/spec/classes/ironic_db_mysql_spec.rb index 84b9941de..1560c9532 100644 --- a/ironic/spec/classes/ironic_db_mysql_spec.rb +++ b/ironic/spec/classes/ironic_db_mysql_spec.rb @@ -39,7 +39,7 @@ { :osfamily => 'Debian' } end - it { should contain_openstacklib__db__mysql('ironic').with( + it { is_expected.to contain_openstacklib__db__mysql('ironic').with( :user => 'ironic', :password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3', :charset => 'utf8' @@ -51,7 +51,7 @@ { :osfamily => 'RedHat' } end - it { should contain_openstacklib__db__mysql('ironic').with( + it { is_expected.to contain_openstacklib__db__mysql('ironic').with( :user => 'ironic', :password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3', :charset => 'utf8' diff --git a/ironic/spec/classes/ironic_drivers_ipmi_spec.rb b/ironic/spec/classes/ironic_drivers_ipmi_spec.rb index 798149e05..315f9d514 100644 --- a/ironic/spec/classes/ironic_drivers_ipmi_spec.rb +++ b/ironic/spec/classes/ironic_drivers_ipmi_spec.rb @@ -36,7 +36,7 @@ end it 'configures ironic.conf' do - should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) + is_expected.to contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) end context 'when overriding parameters' do @@ -44,7 +44,7 @@ params.merge!(:retry_timeout => '50') end it 'should replace default parameter with new value' do - should contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) + is_expected.to contain_ironic_config('ipmi/retry_timeout').with_value(p[:retry_timeout]) end end diff --git a/ironic/spec/classes/ironic_drivers_pxe_spec.rb b/ironic/spec/classes/ironic_drivers_pxe_spec.rb index afe903ccd..26c13a2c9 100644 --- a/ironic/spec/classes/ironic_drivers_pxe_spec.rb +++ b/ironic/spec/classes/ironic_drivers_pxe_spec.rb @@ -43,14 +43,14 @@ end it 'configures ironic.conf' do - should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) - should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) - should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) - should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) - should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) - should contain_ironic_config('pxe/images_path').with_value(p[:images_path]) - should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) - should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) + is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) + is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) + is_expected.to contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) + is_expected.to contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) + is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) + is_expected.to contain_ironic_config('pxe/images_path').with_value(p[:images_path]) + is_expected.to contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) + is_expected.to contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) end context 'when overriding parameters' do @@ -70,16 +70,16 @@ end it 'should replace default parameter with new value' do - should contain_ironic_config('pxe/deploy_kernel').with_value(p[:deploy_kernel]) - should contain_ironic_config('pxe/deploy_ramdisk').with_value(p[:deploy_ramdisk]) - should contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) - should contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) - should contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) - should contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) - should contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) - should contain_ironic_config('pxe/images_path').with_value(p[:images_path]) - should contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) - should contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) + is_expected.to contain_ironic_config('pxe/deploy_kernel').with_value(p[:deploy_kernel]) + is_expected.to contain_ironic_config('pxe/deploy_ramdisk').with_value(p[:deploy_ramdisk]) + is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value(p[:pxe_append_params]) + is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template]) + is_expected.to contain_ironic_config('pxe/pxe_deploy_timeout').with_value(p[:pxe_deploy_timeout]) + is_expected.to contain_ironic_config('pxe/tftp_server').with_value(p[:tftp_server]) + is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root]) + is_expected.to contain_ironic_config('pxe/images_path').with_value(p[:images_path]) + is_expected.to contain_ironic_config('pxe/tftp_master_path').with_value(p[:tftp_master_path]) + is_expected.to contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path]) end end diff --git a/ironic/spec/classes/ironic_init_spec.rb b/ironic/spec/classes/ironic_init_spec.rb index 383862a72..84194a630 100644 --- a/ironic/spec/classes/ironic_init_spec.rb +++ b/ironic/spec/classes/ironic_init_spec.rb @@ -78,14 +78,14 @@ before do params.merge!(:database_connection => 'sqlite:////var/lib/ironic/ironic.sqlite') end - it { should contain_package('ironic-database-backend').with_name('python-pysqlite2')} + it { is_expected.to contain_package('ironic-database-backend').with_name('python-pysqlite2')} end context 'with postgresql database backend' do before do params.merge!(:database_connection => 'postgresql://ironic:ironic@localhost/ironic') end - it { should contain_package('ironic-database-backend').with_name('python-psycopg2')} + it { is_expected.to contain_package('ironic-database-backend').with_name('python-psycopg2')} end it_configures 'with syslog disabled' @@ -95,10 +95,10 @@ shared_examples_for 'a ironic base installation' do - it { should contain_class('ironic::params') } + it { is_expected.to contain_class('ironic::params') } it 'configures ironic configuration folder' do - should contain_file('/etc/ironic/').with( + is_expected.to contain_file('/etc/ironic/').with( :ensure => 'directory', :owner => 'root', :group => 'ironic', @@ -108,7 +108,7 @@ end it 'configures ironic configuration file' do - should contain_file('/etc/ironic/ironic.conf').with( + is_expected.to contain_file('/etc/ironic/ironic.conf').with( :owner => 'root', :group => 'ironic', :mode => '0640', @@ -117,62 +117,62 @@ end it 'installs ironic package' do - should contain_package('ironic-common').with( + is_expected.to contain_package('ironic-common').with( :ensure => 'present', :name => platform_params[:common_package_name], ) end it 'configures enabled_drivers' do - should contain_ironic_config('DEFAULT/enabled_drivers').with_value( params[:enabled_drivers] ) + is_expected.to contain_ironic_config('DEFAULT/enabled_drivers').with_value( params[:enabled_drivers] ) end it 'configures credentials for rabbit' do - should contain_ironic_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_user] ) - should contain_ironic_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ) - should contain_ironic_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] ) - should contain_ironic_config('DEFAULT/rabbit_password').with_secret( true ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_userid').with_value( params[:rabbit_user] ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_password').with_value( params[:rabbit_password] ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_password').with_secret( true ) end it 'should perform default database configuration' do - should contain_ironic_config('database/connection').with_value(params[:database_connection]) - should contain_ironic_config('database/max_retries').with_value(params[:database_max_retries]) - should contain_ironic_config('database/idle_timeout').with_value(params[:database_idle_timeout]) - should contain_ironic_config('database/retry_interval').with_value(params[:database_retry_interval]) + is_expected.to contain_ironic_config('database/connection').with_value(params[:database_connection]) + is_expected.to contain_ironic_config('database/max_retries').with_value(params[:database_max_retries]) + is_expected.to contain_ironic_config('database/idle_timeout').with_value(params[:database_idle_timeout]) + is_expected.to contain_ironic_config('database/retry_interval').with_value(params[:database_retry_interval]) end it 'configures glance connection' do - should contain_ironic_config('glance/glance_num_retries').with_value(params[:glance_num_retries]) - should contain_ironic_config('glance/glance_api_insecure').with_value(params[:glance_api_insecure]) + is_expected.to contain_ironic_config('glance/glance_num_retries').with_value(params[:glance_num_retries]) + is_expected.to contain_ironic_config('glance/glance_api_insecure').with_value(params[:glance_api_insecure]) end it 'configures ironic.conf' do - should contain_ironic_config('DEFAULT/verbose').with_value( params[:verbose] ) - should contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone') - should contain_ironic_config('DEFAULT/control_exchange').with_value('openstack') + is_expected.to contain_ironic_config('DEFAULT/verbose').with_value( params[:verbose] ) + is_expected.to contain_ironic_config('DEFAULT/auth_strategy').with_value('keystone') + is_expected.to contain_ironic_config('DEFAULT/control_exchange').with_value('openstack') end end shared_examples_for 'rabbit HA with a single virtual host' do it 'in ironic.conf' do - should_not contain_ironic_config('DEFAULT/rabbit_host') - should_not contain_ironic_config('DEFAULT/rabbit_port') - should contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts] ) - should contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true) + is_expected.not_to contain_ironic_config('DEFAULT/rabbit_host') + is_expected.not_to contain_ironic_config('DEFAULT/rabbit_port') + is_expected.to contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts] ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true) end end shared_examples_for 'rabbit HA with multiple hosts' do it 'in ironic.conf' do - should_not contain_ironic_config('DEFAULT/rabbit_host') - should_not contain_ironic_config('DEFAULT/rabbit_port') - should contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) - should contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true) + is_expected.not_to contain_ironic_config('DEFAULT/rabbit_host') + is_expected.not_to contain_ironic_config('DEFAULT/rabbit_port') + is_expected.to contain_ironic_config('DEFAULT/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) + is_expected.to contain_ironic_config('DEFAULT/rabbit_ha_queues').with_value(true) end end shared_examples_for 'with syslog disabled' do - it { should contain_ironic_config('DEFAULT/use_syslog').with_value(false) } + it { is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(false) } end shared_examples_for 'with syslog enabled' do @@ -181,8 +181,8 @@ end it do - should contain_ironic_config('DEFAULT/use_syslog').with_value(true) - should contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') + is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(true) + is_expected.to contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') end end @@ -195,8 +195,8 @@ end it do - should contain_ironic_config('DEFAULT/use_syslog').with_value(true) - should contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') + is_expected.to contain_ironic_config('DEFAULT/use_syslog').with_value(true) + is_expected.to contain_ironic_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') end end @@ -206,7 +206,7 @@ end it 'should configure one glance server' do - should contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers]) + is_expected.to contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers]) end end @@ -216,7 +216,7 @@ end it 'should configure one glance server' do - should contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers].join(',')) + is_expected.to contain_ironic_config('glance/glance_api_servers').with_value(p[:glance_api_servers].join(',')) end end diff --git a/ironic/spec/classes/ironic_keystone_auth_spec.rb b/ironic/spec/classes/ironic_keystone_auth_spec.rb index cabccead0..d7b6e4100 100644 --- a/ironic/spec/classes/ironic_keystone_auth_spec.rb +++ b/ironic/spec/classes/ironic_keystone_auth_spec.rb @@ -32,24 +32,24 @@ :tenant => 'foobar' } end - it { should contain_keystone_user('ironic').with( + it { is_expected.to contain_keystone_user('ironic').with( :ensure => 'present', :password => 'ironic_password', :tenant => 'foobar' ) } - it { should contain_keystone_user_role('ironic@foobar').with( + it { is_expected.to contain_keystone_user_role('ironic@foobar').with( :ensure => 'present', :roles => 'admin' )} - it { should contain_keystone_service('ironic').with( + it { is_expected.to contain_keystone_service('ironic').with( :ensure => 'present', :type => 'baremetal', :description => 'Ironic Networking Service' ) } - it { should contain_keystone_endpoint('RegionOne/ironic').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/ironic').with( :ensure => 'present', :public_url => "http://127.0.0.1:6385/", :admin_url => "http://127.0.0.1:6385/", @@ -81,7 +81,7 @@ :admin_address => '10.10.10.12' } end - it { should contain_keystone_endpoint('RegionOne/ironic').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/ironic').with( :ensure => 'present', :public_url => "https://10.10.10.10:80/", :internal_url => "http://10.10.10.11:81/", @@ -95,10 +95,10 @@ :auth_name => 'ironicy' } end - it { should contain_keystone_user('ironicy') } - it { should contain_keystone_user_role('ironicy@services') } - it { should contain_keystone_service('ironicy') } - it { should contain_keystone_endpoint('RegionOne/ironicy') } + it { is_expected.to contain_keystone_user('ironicy') } + it { is_expected.to contain_keystone_user_role('ironicy@services') } + it { is_expected.to contain_keystone_service('ironicy') } + it { is_expected.to contain_keystone_endpoint('RegionOne/ironicy') } end describe 'when overriding service name' do @@ -109,10 +109,10 @@ } end - it { should contain_keystone_user('ironic') } - it { should contain_keystone_user_role('ironic@services') } - it { should contain_keystone_service('ironic_service') } - it { should contain_keystone_endpoint('RegionOne/ironic_service') } + it { is_expected.to contain_keystone_user('ironic') } + it { is_expected.to contain_keystone_user_role('ironic@services') } + it { is_expected.to contain_keystone_service('ironic_service') } + it { is_expected.to contain_keystone_endpoint('RegionOne/ironic_service') } end describe 'when disabling user configuration' do @@ -124,11 +124,11 @@ } end - it { should_not contain_keystone_user('ironic') } + it { is_expected.not_to contain_keystone_user('ironic') } - it { should contain_keystone_user_role('ironic@services') } + it { is_expected.to contain_keystone_user_role('ironic@services') } - it { should contain_keystone_service('ironic').with( + it { is_expected.to contain_keystone_service('ironic').with( :ensure => 'present', :type => 'baremetal', :description => 'Ironic Networking Service' @@ -146,11 +146,11 @@ } end - it { should_not contain_keystone_user('ironic') } + it { is_expected.not_to contain_keystone_user('ironic') } - it { should_not contain_keystone_user_role('ironic@services') } + it { is_expected.not_to contain_keystone_user_role('ironic@services') } - it { should contain_keystone_service('ironic').with( + it { is_expected.to contain_keystone_service('ironic').with( :ensure => 'present', :type => 'baremetal', :description => 'Ironic Networking Service' diff --git a/ironic/spec/classes/ironic_policy_spec.rb b/ironic/spec/classes/ironic_policy_spec.rb index f239c2b71..8e029ff2b 100644 --- a/ironic/spec/classes/ironic_policy_spec.rb +++ b/ironic/spec/classes/ironic_policy_spec.rb @@ -16,7 +16,7 @@ end it 'set up the policies' do - should contain_openstacklib__policy__base('context_is_admin').with({ + is_expected.to contain_openstacklib__policy__base('context_is_admin').with({ :key => 'context_is_admin', :value => 'foo:bar' }) diff --git a/ironic/spec/shared_examples.rb b/ironic/spec/shared_examples.rb index d92156a36..fec0eacc9 100644 --- a/ironic/spec/shared_examples.rb +++ b/ironic/spec/shared_examples.rb @@ -1,5 +1,5 @@ shared_examples_for "a Puppet::Error" do |description| it "with message matching #{description.inspect}" do - expect { should have_class_count(1) }.to raise_error(Puppet::Error, description) + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) end end diff --git a/ironic/spec/unit/provider/ironic_spec.rb b/ironic/spec/unit/provider/ironic_spec.rb index cf81ead2a..edab35810 100644 --- a/ironic/spec/unit/provider/ironic_spec.rb +++ b/ironic/spec/unit/provider/ironic_spec.rb @@ -61,7 +61,7 @@ def klass it 'should use specified host/port/protocol in the auth endpoint' do conf = {'keystone_authtoken' => credential_hash} klass.expects(:ironic_conf).returns(conf) - klass.get_auth_endpoint.should == auth_endpoint + expect(klass.get_auth_endpoint).to eq(auth_endpoint) end end @@ -103,7 +103,7 @@ def klass EOT klass.expects(:auth_ironic).returns(output) result = klass.list_ironic_resources('foo') - result.should eql(['net1', 'net2']) + expect(result).to eql(['net1', 'net2']) end end From 810ed72fa4abf5714f357218bf0655b5ff7ef581 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:36 +0100 Subject: [PATCH 10/22] Update keystone to 501f1f44b1e23fa2daff84e85106b942841c0199 501f1f44b1e23fa2daff84e85106b942841c0199 Parameter duplication 0ca426fa058161e6adbd9544136dc71af6f43808 Add manage_service feature --- Puppetfile | 2 +- keystone/manifests/init.pp | 16 +++++++++++----- keystone/manifests/service.pp | 4 ++-- .../spec/classes/keystone_service_spec.rb | 4 ++-- keystone/spec/classes/keystone_spec.rb | 19 ++++++++++++++++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Puppetfile b/Puppetfile index 114cd7baa..4aa958894 100644 --- a/Puppetfile +++ b/Puppetfile @@ -71,7 +71,7 @@ mod 'ironic', :git => 'https://github.com/stackforge/puppet-ironic.git' mod 'keystone', - :commit => '2fcfc94b424c19d28e79bfd9d2c4f61cf5e23f3a', + :commit => '501f1f44b1e23fa2daff84e85106b942841c0199', :git => 'https://github.com/stackforge/puppet-keystone.git' mod 'manila', diff --git a/keystone/manifests/init.pp b/keystone/manifests/init.pp index fd5574c45..7227eaef3 100644 --- a/keystone/manifests/init.pp +++ b/keystone/manifests/init.pp @@ -105,6 +105,10 @@ # (optional) Toggle for token system caching. This has no effects unless 'memcache_servers' is set. # Default to true. # +# [*manage_service*] +# (Optional) If Puppet should manage service startup / shutdown. +# Defaults to true. +# # [*enabled*] # (optional) If the keystone services should be enabled. # Default to true. @@ -372,7 +376,6 @@ $admin_bind_host = '0.0.0.0', $public_port = '5000', $admin_port = '35357', - $compute_port = '8774', $verbose = false, $debug = false, $log_dir = '/var/log/keystone', @@ -396,6 +399,7 @@ $ssl_cert_subject = '/C=US/ST=Unset/L=Unset/O=Unset/CN=localhost', $cache_dir = '/var/cache/keystone', $memcache_servers = false, + $manage_service = true, $cache_backend = 'keystone.common.cache.noop', $cache_backend_argument = undef, $debug_cache_backend = false, @@ -749,10 +753,12 @@ 'DEFAULT/public_workers': value => $public_workers; } - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' + if $manage_service { + if $enabled { + $service_ensure = 'running' + } else { + $service_ensure = 'stopped' + } } if $service_name == 'keystone' { diff --git a/keystone/manifests/service.pp b/keystone/manifests/service.pp index ba6f89869..46312144a 100644 --- a/keystone/manifests/service.pp +++ b/keystone/manifests/service.pp @@ -10,7 +10,7 @@ # # [*ensure*] # (optional) The desired state of the keystone service -# Defaults to 'running' +# Defaults to undef # # [*service_name*] # (optional) The name of the keystone service @@ -64,7 +64,7 @@ # Defaults to undef # class keystone::service( - $ensure = 'running', + $ensure = undef, $service_name = $::keystone::params::service_name, $enable = true, $hasstatus = true, diff --git a/keystone/spec/classes/keystone_service_spec.rb b/keystone/spec/classes/keystone_service_spec.rb index cd2d2057a..3aa302d63 100644 --- a/keystone/spec/classes/keystone_service_spec.rb +++ b/keystone/spec/classes/keystone_service_spec.rb @@ -4,7 +4,7 @@ describe "with default parameters" do it { is_expected.to contain_service('keystone').with( - :ensure => 'running', + :ensure => nil, :enable => true, :hasstatus => true, :hasrestart => true @@ -21,7 +21,7 @@ end it { is_expected.to contain_service('keystone').with( - :ensure => 'running', + :ensure => nil, :enable => true, :hasstatus => true, :hasrestart => true diff --git a/keystone/spec/classes/keystone_spec.rb b/keystone/spec/classes/keystone_spec.rb index 752debad6..b8a463da8 100644 --- a/keystone/spec/classes/keystone_spec.rb +++ b/keystone/spec/classes/keystone_spec.rb @@ -43,6 +43,7 @@ 'ssl_ca_key' => '/etc/keystone/ssl/private/cakey.pem', 'ssl_cert_subject' => '/C=US/ST=Unset/L=Unset/O=Unset/CN=localhost', 'enabled' => true, + 'manage_service' => true, 'database_connection' => 'sqlite:////var/lib/keystone/keystone.db', 'database_idle_timeout' => '200', 'enable_pki_setup' => true, @@ -78,6 +79,7 @@ 'ssl_ca_key' => '/etc/keystone/ssl/private/cakey.pem', 'ssl_cert_subject' => '/C=US/ST=Unset/L=Unset/O=Unset/CN=localhost', 'enabled' => false, + 'manage_service' => true, 'database_connection' => 'mysql://a:b@c/d', 'database_idle_timeout' => '300', 'enable_pki_setup' => true, @@ -220,7 +222,7 @@ it_configures 'core keystone examples', param_hash it { is_expected.to contain_service('keystone').with( - 'ensure' => param_hash['enabled'] ? 'running' : 'stopped', + 'ensure' => (param_hash['manage_service'] && param_hash['enabled']) ? 'running' : 'stopped', 'enable' => param_hash['enabled'], 'hasstatus' => true, 'hasrestart' => true @@ -248,6 +250,21 @@ end + describe 'with disabled service managing' do + let :params do + { :admin_token => 'service_token', + :manage_service => false, + :enabled => false } + end + + it { is_expected.to contain_service('keystone').with( + 'ensure' => nil, + 'enable' => false, + 'hasstatus' => true, + 'hasrestart' => true + ) } + end + describe 'when configuring signing token provider' do describe 'when configuring as UUID' do From 9708e16679cfb0a5d751f44f58dff660e4e931e0 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:09:42 +0100 Subject: [PATCH 11/22] Update manila to 96e95f5c06fe504c0f1b92cca1a00bb9df20bea0 96e95f5c06fe504c0f1b92cca1a00bb9df20bea0 Merge "Remove enabled_share_backends param from NetApp backend" 7be3b62bc68e6c257f959b0949af5ec4a7bec65c Remove enabled_share_backends param from NetApp backend --- Puppetfile | 2 +- manila/manifests/backend/netapp.pp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Puppetfile b/Puppetfile index 4aa958894..ed1bf78b4 100644 --- a/Puppetfile +++ b/Puppetfile @@ -75,7 +75,7 @@ mod 'keystone', :git => 'https://github.com/stackforge/puppet-keystone.git' mod 'manila', - :commit => '3d8d00d613cb4335d992319a72bd328517f73fd8', + :commit => '96e95f5c06fe504c0f1b92cca1a00bb9df20bea0', :git => 'https://github.com/stackforge/puppet-manila.git' mod 'memcached', diff --git a/manila/manifests/backend/netapp.pp b/manila/manifests/backend/netapp.pp index aaf6f3d08..f17269a88 100644 --- a/manila/manifests/backend/netapp.pp +++ b/manila/manifests/backend/netapp.pp @@ -72,7 +72,6 @@ $netapp_share_driver = 'manila.share.drivers.netapp.cluster_mode.NetAppClusteredShareDriver' manila_config { - 'DEFAULT/enabled_share_backends': value => $share_backend_name; "${share_backend_name}/share_backend_name": value => $share_backend_name; "${share_backend_name}/share_driver": value => $netapp_share_driver; "${share_backend_name}/netapp_nas_transport_type": value => $netapp_nas_transport_type; From 4ec96dd162771e25ce7dd333d9bd34aaaf806074 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:02 +0100 Subject: [PATCH 12/22] Update mongodb to b41a706f7c1f3f01b84391972ecd6e135d113ab7 b41a706f7c1f3f01b84391972ecd6e135d113ab7 Merge pull request #184 from enovance/fix_debian_mongos_params_scope 9bc349266de8f5d438c7edac16acbf83b9d5facc Merge pull request #187 from cmurphy/rspec-puppet-2 f656c2875b085968e50c630245badc89313a30f7 Fix lint errors c2a0b49848cb1eb2536aad3f752602eaaa14481f Update .travis.yml b35c1432c637eeaab9a8eaee5d48435bac9260ca Keep testing on puppet 2.7 f30e1cefb2491f47fd8240385f6d8aa756f46872 Sync with modulesync a2a3218dacc87ddf78201aa044fceba709206a6b Don't manage the spec helper with modulesync 45298db818a00fb88a73252953bcc24b6b5a57a1 Unpin rspec-core and remove unneeded dependencies 4b7107282bb97e22774559d4c8aae5699b0dc0a7 Fix Debian mongos_* parameters scope. --- Puppetfile | 2 +- mongodb/.gitignore | 14 +- mongodb/.sync.yml | 9 + mongodb/.travis.yml | 19 +- mongodb/CONTRIBUTING.md | 220 ++++++++++++++++++ mongodb/Gemfile | 5 +- mongodb/Rakefile | 9 + mongodb/manifests/params.pp | 4 - .../acceptance/nodesets/centos-59-x64.yml | 10 + .../acceptance/nodesets/centos-65-x64.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 11 + mongodb/spec/spec.opts | 6 + mongodb/tests/sharding.pp | 6 +- 13 files changed, 304 insertions(+), 21 deletions(-) create mode 100644 mongodb/.sync.yml create mode 100644 mongodb/CONTRIBUTING.md create mode 100644 mongodb/spec/acceptance/nodesets/centos-59-x64.yml create mode 100644 mongodb/spec/acceptance/nodesets/centos-65-x64.yml create mode 100644 mongodb/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 mongodb/spec/spec.opts diff --git a/Puppetfile b/Puppetfile index ed1bf78b4..451efa580 100644 --- a/Puppetfile +++ b/Puppetfile @@ -91,7 +91,7 @@ mod 'module-data', :git => 'https://github.com/ripienaar/puppet-module-data.git' mod 'mongodb', - :commit => '1ae7406589e3abf6f65a337005217ca0e0323840', + :commit => 'b41a706f7c1f3f01b84391972ecd6e135d113ab7', :git => 'https://github.com/puppetlabs/puppetlabs-mongodb.git' mod 'mysql', diff --git a/mongodb/.gitignore b/mongodb/.gitignore index 3149ad990..b5db85e05 100644 --- a/mongodb/.gitignore +++ b/mongodb/.gitignore @@ -1,9 +1,9 @@ -Gemfile.lock -*.idea -*.swp -*.tmp -tmp/ pkg/ -spec/fixtures/manifests -.rspec_system/ +Gemfile.lock +vendor/ +spec/fixtures/ .vagrant/ +.bundle/ +coverage/ +.idea/ +*.iml diff --git a/mongodb/.sync.yml b/mongodb/.sync.yml new file mode 100644 index 000000000..ac8379073 --- /dev/null +++ b/mongodb/.sync.yml @@ -0,0 +1,9 @@ +--- +.travis.yml: + extras: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" +spec/spec_helper.rb: + unmanaged: true diff --git a/mongodb/.travis.yml b/mongodb/.travis.yml index 6cf8b0044..d1a0d7cd9 100644 --- a/mongodb/.travis.yml +++ b/mongodb/.travis.yml @@ -1,17 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false diff --git a/mongodb/CONTRIBUTING.md b/mongodb/CONTRIBUTING.md new file mode 100644 index 000000000..f1cbde4bb --- /dev/null +++ b/mongodb/CONTRIBUTING.md @@ -0,0 +1,220 @@ +Checklist (and a short version for the impatient) +================================================= + + * Commits: + + - Make commits of logical units. + + - Check for unnecessary whitespace with "git diff --check" before + committing. + + - Commit using Unix line endings (check the settings around "crlf" in + git-config(1)). + + - Do not check in commented out code or unneeded files. + + - The first line of the commit message should be a short + description (50 characters is the soft limit, excluding ticket + number(s)), and should skip the full stop. + + - Associate the issue in the message. The first line should include + the issue number in the form "(#XXXX) Rest of message". + + - The body should provide a meaningful commit message, which: + + - uses the imperative, present tense: "change", not "changed" or + "changes". + + - includes motivation for the change, and contrasts its + implementation with the previous behavior. + + - Make sure that you have tests for the bug you are fixing, or + feature you are adding. + + - Make sure the test suites passes after your commit: + `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below + + - When introducing a new feature, make sure it is properly + documented in the README.md + + * Submission: + + * Pre-requisites: + + - Make sure you have a [GitHub account](https://github.com/join) + + - [Create a ticket](https://tickets.puppetlabs.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppetlabs.com/browse/) you are patching for. + + * Preferred method: + + - Fork the repository on GitHub. + + - Push your changes to a topic branch in your fork of the + repository. (the format ticket/1234-short_description_of_change is + usually preferred for this project). + + - Submit a pull request to the repository in the puppetlabs + organization. + +The long version +================ + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on "master". + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +Testing +======= + +Getting Started +--------------- + +Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby +package manager such as [bundler](http://bundler.io/) what Ruby packages, +or Gems, are required to build, develop, and test this software. + +Please make sure you have [bundler installed](http://bundler.io/#getting-started) +on your system, then use it to install all dependencies needed for this project, +by running + +```shell +% bundle install +Fetching gem metadata from https://rubygems.org/........ +Fetching gem metadata from https://rubygems.org/.. +Using rake (10.1.0) +Using builder (3.2.2) +-- 8><-- many more --><8 -- +Using rspec-system-puppet (2.2.0) +Using serverspec (0.6.3) +Using rspec-system-serverspec (1.0.0) +Using bundler (1.3.5) +Your bundle is complete! +Use `bundle show [gemname]` to see where a bundled gem is installed. +``` + +NOTE some systems may require you to run this command with sudo. + +If you already have those gems installed, make sure they are up-to-date: + +```shell +% bundle update +``` + +With all dependencies in place and up-to-date we can now run the tests: + +```shell +% rake spec +``` + +This will execute all the [rspec tests](http://rspec-puppet.com/) tests +under [spec/defines](./spec/defines), [spec/classes](./spec/classes), +and so on. rspec tests may have the same kind of dependencies as the +module they are testing. While the module defines in its [Modulefile](./Modulefile), +rspec tests define them in [.fixtures.yml](./fixtures.yml). + +Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker) +tests. These tests spin up a virtual machine under +[VirtualBox](https://www.virtualbox.org/)) with, controlling it with +[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test +scenarios. In order to run these, you will need both of those tools +installed on your system. + +You can run them by issuing the following command + +```shell +% rake spec_clean +% rspec spec/acceptance +``` + +This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), +install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) +and then run all the tests under [spec/acceptance](./spec/acceptance). + +Writing Tests +------------- + +XXX getting started writing tests. + +If you have commit access to the repository +=========================================== + +Even if you have commit access to the repository, you will still need to +go through the process above, and have someone else review and merge +in your changes. The rule is that all changes must be reviewed by a +developer on the project (that did not write the code) to ensure that +all changes go through a code review process. + +Having someone other than the author of the topic branch recorded as +performing the merge is the record that they performed the code +review. + + +Additional Resources +==================== + +* [Getting additional help](http://puppetlabs.com/community/get-help) + +* [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests) + +* [Patchwork](https://patchwork.puppetlabs.com) + +* [General GitHub documentation](http://help.github.com/) + +* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) + diff --git a/mongodb/Gemfile b/mongodb/Gemfile index 340dc984a..cc77f38cf 100644 --- a/mongodb/Gemfile +++ b/mongodb/Gemfile @@ -1,14 +1,11 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false + gem 'rspec-core', '3.1.7', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false - gem 'rspec-core', '3.1.7' end group :system_tests do diff --git a/mongodb/Rakefile b/mongodb/Rakefile index cd3d37995..181157e6e 100644 --- a/mongodb/Rakefile +++ b/mongodb/Rakefile @@ -1 +1,10 @@ require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' + +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] diff --git a/mongodb/manifests/params.pp b/mongodb/manifests/params.pp index de691c547..8c40937f1 100644 --- a/mongodb/manifests/params.pp +++ b/mongodb/manifests/params.pp @@ -137,10 +137,6 @@ $dbpath = '/var/lib/mongodb' $logpath = '/var/log/mongodb/mongodb.log' $bind_ip = pick($::mongodb::globals::bind_ip, ['127.0.0.1']) - $mongos_pidfilepath = undef - $mongos_unixsocketprefix = undef - $mongos_logpath = undef - $mongos_fork = undef } else { # although we are living in a free world, # I would not recommend to use the prepacked diff --git a/mongodb/spec/acceptance/nodesets/centos-59-x64.yml b/mongodb/spec/acceptance/nodesets/centos-59-x64.yml new file mode 100644 index 000000000..2ad90b86a --- /dev/null +++ b/mongodb/spec/acceptance/nodesets/centos-59-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-59-x64: + roles: + - master + platform: el-5-x86_64 + box : centos-59-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/mongodb/spec/acceptance/nodesets/centos-65-x64.yml b/mongodb/spec/acceptance/nodesets/centos-65-x64.yml new file mode 100644 index 000000000..4e2cb809e --- /dev/null +++ b/mongodb/spec/acceptance/nodesets/centos-65-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-vbox436-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/mongodb/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/mongodb/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..cba1cd04c --- /dev/null +++ b/mongodb/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + 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: git diff --git a/mongodb/spec/spec.opts b/mongodb/spec/spec.opts new file mode 100644 index 000000000..91cd6427e --- /dev/null +++ b/mongodb/spec/spec.opts @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/mongodb/tests/sharding.pp b/mongodb/tests/sharding.pp index 4dc1ebfaa..0470ae8b5 100644 --- a/mongodb/tests/sharding.pp +++ b/mongodb/tests/sharding.pp @@ -14,7 +14,11 @@ }-> mongodb_shard { 'rs1' : member => 'rs1/mongod1:27018', - keys => [{'rs1.foo' => {'name' => 1}}], + keys => [{ + 'rs1.foo' => { + 'name' => 1 + } + }], } } From dd0b23f15eb8ee38bf527210f3774fba44e0a23e Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:08 +0100 Subject: [PATCH 13/22] Update mysql to 85a5d8be6ff165942e4ee66667db9c5e8a5800a9 85a5d8be6ff165942e4ee66667db9c5e8a5800a9 Merge pull request #695 from anodelman/master 519371ff0ade782d760fb1e751ba674b1ffd95e1 (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... c05952a39894f0e58ff66582543c93836313d9fc Merge pull request #694 from cmurphy/rspec-puppet-2 6104cfa445e95d5810e0aec496c3e791d2e861ca Update .travis.yml 0e2e148a82959840953591c2eeb95578d133b0b0 Keep testing on puppet 2.7 9b977ec9433bb66ad164d62207b8ed3d33184e76 Remove unneeded dependencies a59c68b165a1e985cf2b5aaa6248e6c5411a3ab1 Update tests for rspec-puppet 2 and future parser --- Puppetfile | 2 +- mysql/.sync.yml | 6 ++++++ mysql/.travis.yml | 19 +++++++++++++++---- mysql/Gemfile | 24 ++++++++++++++++++++---- mysql/spec/classes/mysql_server_spec.rb | 2 +- mysql/spec/defines/mysql_db_spec.rb | 4 ++-- 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/Puppetfile b/Puppetfile index 451efa580..767dbf945 100644 --- a/Puppetfile +++ b/Puppetfile @@ -95,7 +95,7 @@ mod 'mongodb', :git => 'https://github.com/puppetlabs/puppetlabs-mongodb.git' mod 'mysql', - :commit => 'd8b7a9011ec27c45cd7b30e61f56fe197edb0c25', + :commit => '85a5d8be6ff165942e4ee66667db9c5e8a5800a9', :git => 'https://github.com/puppetlabs/puppetlabs-mysql.git' mod 'n1k_vsm', diff --git a/mysql/.sync.yml b/mysql/.sync.yml index 66a03c649..ac8379073 100644 --- a/mysql/.sync.yml +++ b/mysql/.sync.yml @@ -1,3 +1,9 @@ --- +.travis.yml: + extras: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" spec/spec_helper.rb: unmanaged: true diff --git a/mysql/.travis.yml b/mysql/.travis.yml index 6cf8b0044..d1a0d7cd9 100644 --- a/mysql/.travis.yml +++ b/mysql/.travis.yml @@ -1,17 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false diff --git a/mysql/Gemfile b/mysql/Gemfile index 62c569397..fcd27d534 100644 --- a/mysql/Gemfile +++ b/mysql/Gemfile @@ -1,18 +1,34 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do - gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end diff --git a/mysql/spec/classes/mysql_server_spec.rb b/mysql/spec/classes/mysql_server_spec.rb index c7ea0ac92..bc36fe07d 100644 --- a/mysql/spec/classes/mysql_server_spec.rb +++ b/mysql/spec/classes/mysql_server_spec.rb @@ -110,7 +110,7 @@ :max_queries_per_hour => nil, :max_updates_per_hour => nil, :max_user_connections => nil, - :password_hash => '' + :password_hash => nil )} end diff --git a/mysql/spec/defines/mysql_db_spec.rb b/mysql/spec/defines/mysql_db_spec.rb index a71560861..7ff3b9c38 100644 --- a/mysql/spec/defines/mysql_db_spec.rb +++ b/mysql/spec/defines/mysql_db_spec.rb @@ -16,7 +16,7 @@ it 'should report an error when ensure is not present or absent' do params.merge!({'ensure' => 'invalid_val'}) - expect { subject }.to raise_error(Puppet::Error, + expect { catalogue }.to raise_error(Puppet::Error, /invalid_val is not supported for ensure\. Allowed values are 'present' and 'absent'\./) end @@ -47,7 +47,7 @@ it 'should report an error if sql isn\'t a string or an array' do params.merge!({'sql' => {'foo' => 'test_sql', 'bar' => 'test_2_sql'}}) - expect { subject }.to raise_error(Puppet::Error, + expect { catalogue }.to raise_error(Puppet::Error, /\$sql must be either a string or an array\./) end From ad6b77238d661f01da2ece90d7b6f3ebbe7ddfca Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:16 +0100 Subject: [PATCH 14/22] Update neutron to 5ee1d6aa3d0e00ed80f4340862d839f42d549a80 5ee1d6aa3d0e00ed80f4340862d839f42d549a80 Merge "Revert "Notify the ovs-agent service if the config changes"" 635c9c3fbbcb4a6ddc493373a2da3f99b06f9859 Merge "Add lbaas package for Kilo in Red Hat platforms" f3fd385bf452f32969b03224f7a46dea90b735cc Allow l3_ha to be disabled 9174962c336cfcf77ea93ae3c49a97a7e6a5fb9d Add lbaas package for Kilo in Red Hat platforms 73d7599665b6d499280d29b5f59c26124ad5e643 Fix catalog compilation when not configuring endpoint 79fee4fef10ee353c1cec34781f4c0038d474259 Revert "Notify the ovs-agent service if the config changes" --- Puppetfile | 2 +- neutron/manifests/agents/lbaas.pp | 18 ++++++------------ neutron/manifests/agents/ml2/ovs.pp | 1 - neutron/manifests/keystone/auth.pp | 4 +++- neutron/manifests/params.pp | 2 +- neutron/manifests/server.pp | 4 ++++ .../spec/classes/neutron_agents_lbaas_spec.rb | 19 ++++++++----------- .../classes/neutron_keystone_auth_spec.rb | 13 +++++++++++++ neutron/spec/classes/neutron_server_spec.rb | 9 +++++++++ 9 files changed, 45 insertions(+), 27 deletions(-) diff --git a/Puppetfile b/Puppetfile index 767dbf945..ba2409b74 100644 --- a/Puppetfile +++ b/Puppetfile @@ -107,7 +107,7 @@ mod 'nagios', :git => 'https://github.com/gildub/puppet-nagios-openstack.git' mod 'neutron', - :commit => 'ac06cb7c9685b361e1bfe1e0740f02e656d3ee75', + :commit => '5ee1d6aa3d0e00ed80f4340862d839f42d549a80', :git => 'https://github.com/stackforge/puppet-neutron.git' mod 'nova', diff --git a/neutron/manifests/agents/lbaas.pp b/neutron/manifests/agents/lbaas.pp index 3668f8552..5b47539fd 100644 --- a/neutron/manifests/agents/lbaas.pp +++ b/neutron/manifests/agents/lbaas.pp @@ -77,18 +77,12 @@ 'haproxy/user_group': value => $user_group; } - if $::neutron::params::lbaas_agent_package { - Package['neutron'] -> Package['neutron-lbaas-agent'] - Package['neutron-lbaas-agent'] -> Neutron_config<||> - Package['neutron-lbaas-agent'] -> Neutron_lbaas_agent_config<||> - package { 'neutron-lbaas-agent': - ensure => $package_ensure, - name => $::neutron::params::lbaas_agent_package, - } - } else { - # Some platforms (RedHat) do not provide a neutron LBaaS agent package. - # The neutron LBaaS agent config file is provided by the neutron package. - Package['neutron'] -> Neutron_lbaas_agent_config<||> + Package['neutron'] -> Package['neutron-lbaas-agent'] + Package['neutron-lbaas-agent'] -> Neutron_config<||> + Package['neutron-lbaas-agent'] -> Neutron_lbaas_agent_config<||> + package { 'neutron-lbaas-agent': + ensure => $package_ensure, + name => $::neutron::params::lbaas_agent_package, } if $manage_service { diff --git a/neutron/manifests/agents/ml2/ovs.pp b/neutron/manifests/agents/ml2/ovs.pp index f551a5ab1..0817a71ed 100644 --- a/neutron/manifests/agents/ml2/ovs.pp +++ b/neutron/manifests/agents/ml2/ovs.pp @@ -228,7 +228,6 @@ if $enabled { $service_ensure = 'running' - Neutron_config<||> ~> Service['neutron-ovs-agent-service'] } else { $service_ensure = 'stopped' } diff --git a/neutron/manifests/keystone/auth.pp b/neutron/manifests/keystone/auth.pp index d7de78522..9ec835868 100644 --- a/neutron/manifests/keystone/auth.pp +++ b/neutron/manifests/keystone/auth.pp @@ -92,7 +92,9 @@ $real_public_port = $public_port } - Keystone_endpoint["${region}/${real_service_name}"] ~> Service <| title == 'neutron-server' |> + if $configure_endpoint { + Keystone_endpoint["${region}/${real_service_name}"] ~> Service <| title == 'neutron-server' |> + } if $configure_user_role { Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| title == 'neutron-server' |> diff --git a/neutron/manifests/params.pp b/neutron/manifests/params.pp index 4b5346506..ca0b9757b 100644 --- a/neutron/manifests/params.pp +++ b/neutron/manifests/params.pp @@ -38,7 +38,7 @@ $dnsmasq_packages = ['dnsmasq', 'dnsmasq-utils'] - $lbaas_agent_package = false + $lbaas_agent_package = 'openstack-neutron-lbaas' $lbaas_agent_service = 'neutron-lbaas-agent' $haproxy_package = 'haproxy' diff --git a/neutron/manifests/server.pp b/neutron/manifests/server.pp index 073394b74..e3605a0a0 100644 --- a/neutron/manifests/server.pp +++ b/neutron/manifests/server.pp @@ -252,6 +252,10 @@ } else { fail('min_l3_agents_per_router should be less than or equal to max_l3_agents_per_router.') } + } else { + neutron_config { + 'DEFAULT/l3_ha': value => false; + } } if $mysql_module { diff --git a/neutron/spec/classes/neutron_agents_lbaas_spec.rb b/neutron/spec/classes/neutron_agents_lbaas_spec.rb index b66407780..7378703db 100644 --- a/neutron/spec/classes/neutron_agents_lbaas_spec.rb +++ b/neutron/spec/classes/neutron_agents_lbaas_spec.rb @@ -41,17 +41,13 @@ end it 'installs neutron lbaas agent package' do - if platform_params.has_key?(:lbaas_agent_package) - is_expected.to contain_package('neutron-lbaas-agent').with( - :name => platform_params[:lbaas_agent_package], - :ensure => p[:package_ensure] - ) - is_expected.to contain_package('neutron').with_before(/Package\[neutron-lbaas-agent\]/) - is_expected.to contain_package('neutron-lbaas-agent').with_before(/Neutron_lbaas_agent_config\[.+\]/) - is_expected.to contain_package('neutron-lbaas-agent').with_before(/Neutron_config\[.+\]/) - else - is_expected.to contain_package('neutron').with_before(/Neutron_lbaas_agent_config\[.+\]/) - end + is_expected.to contain_package('neutron-lbaas-agent').with( + :name => platform_params[:lbaas_agent_package], + :ensure => p[:package_ensure] + ) + is_expected.to contain_package('neutron').with_before(/Package\[neutron-lbaas-agent\]/) + is_expected.to contain_package('neutron-lbaas-agent').with_before(/Neutron_lbaas_agent_config\[.+\]/) + is_expected.to contain_package('neutron-lbaas-agent').with_before(/Neutron_config\[.+\]/) end it 'configures neutron lbaas agent service' do @@ -127,6 +123,7 @@ class { 'neutron': rabbit_password => 'passw0rd' }" let :platform_params do { :haproxy_package => 'haproxy', + :lbaas_agent_package => 'openstack-neutron-lbaas', :nobody_user_group => 'nobody', :lbaas_agent_service => 'neutron-lbaas-agent' } end diff --git a/neutron/spec/classes/neutron_keystone_auth_spec.rb b/neutron/spec/classes/neutron_keystone_auth_spec.rb index f7d3e4159..35cde4703 100644 --- a/neutron/spec/classes/neutron_keystone_auth_spec.rb +++ b/neutron/spec/classes/neutron_keystone_auth_spec.rb @@ -175,4 +175,17 @@ end + describe 'when disabling endpoint configuration' do + + let :params do + { + :password => 'neutron_password', + :configure_endpoint => false + } + end + + it { is_expected.to_not contain_keystone_endpoint('RegionOne/neutron') } + + end + end diff --git a/neutron/spec/classes/neutron_server_spec.rb b/neutron/spec/classes/neutron_server_spec.rb index ddf87c675..8388465b2 100644 --- a/neutron/spec/classes/neutron_server_spec.rb +++ b/neutron/spec/classes/neutron_server_spec.rb @@ -130,6 +130,15 @@ end end + context 'with HA routers disabled' do + before :each do + params.merge!(:l3_ha => false) + end + it 'should disable HA routers' do + is_expected.to contain_neutron_config('DEFAULT/l3_ha').with_value(false) + end + end + context 'with HA routers enabled with unlimited l3 agents per router' do before :each do params.merge!(:l3_ha => true, From 77487f3152e10ca426fef1e3f369b045bf3983f8 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:20 +0100 Subject: [PATCH 15/22] Update nova to a0d934b6e2adc24b32508d3c33722733ab23e8c8 a0d934b6e2adc24b32508d3c33722733ab23e8c8 Use versioncmp for ::operatingsystemmajrelease comparison --- Puppetfile | 2 +- nova/manifests/params.pp | 2 +- nova/spec/classes/nova_compute_libvirt_spec.rb | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Puppetfile b/Puppetfile index ba2409b74..2601f5149 100644 --- a/Puppetfile +++ b/Puppetfile @@ -111,7 +111,7 @@ mod 'neutron', :git => 'https://github.com/stackforge/puppet-neutron.git' mod 'nova', - :commit => 'd1a2f9606d29b429414bd56b87ac8fcc3fb696cf', + :commit => 'a0d934b6e2adc24b32508d3c33722733ab23e8c8', :git => 'https://github.com/stackforge/puppet-nova.git' mod 'nssdb', diff --git a/nova/manifests/params.pp b/nova/manifests/params.pp index 647a2d9ab..b24ec182d 100644 --- a/nova/manifests/params.pp +++ b/nova/manifests/params.pp @@ -48,7 +48,7 @@ $special_service_provider = undef } 'RedHat', 'CentOS', 'Scientific': { - if ($::operatingsystemmajrelease < 7) { + if (versioncmp($::operatingsystemmajrelease, '7') < 0) { $special_service_provider = 'init' } else { $special_service_provider = undef diff --git a/nova/spec/classes/nova_compute_libvirt_spec.rb b/nova/spec/classes/nova_compute_libvirt_spec.rb index 4e7d4010c..7a75e0687 100644 --- a/nova/spec/classes/nova_compute_libvirt_spec.rb +++ b/nova/spec/classes/nova_compute_libvirt_spec.rb @@ -129,7 +129,8 @@ describe 'on rhel platforms' do let :facts do { :operatingsystem => 'RedHat', :osfamily => 'RedHat', - :operatingsystemrelease => 6.5 } + :operatingsystemrelease => 6.5, + :operatingsystemmajrelease => '6' } end describe 'with default parameters' do @@ -145,7 +146,7 @@ :name => 'libvirtd', :enable => true, :ensure => 'running', - :provider => nil, + :provider => 'init', :require => 'Package[libvirt]', :before => 'Service[nova-compute]' )} @@ -153,12 +154,13 @@ :ensure => 'running', :enable => true, :before => 'Service[libvirt]', - :provider => nil + :provider => 'init' ) } describe 'on rhel 7' do let :facts do super().merge(:operatingsystemrelease => 7.0) + super().merge(:operatingsystemmajrelease => '7') end it { is_expected.to contain_service('libvirt').with( From 0227784d7f49f8bed944aaad78f5a2c7d070e4f2 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:28 +0100 Subject: [PATCH 16/22] Update ntp to 286acbacdb9aaa3f1255d7486078730e380195f4 286acbacdb9aaa3f1255d7486078730e380195f4 Merge pull request #252 from anodelman/master d4ef5a528afc404f6f01a70ac5597b0f592e044b (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... b6d8f57a27d94c6e7a2766b0a70aeedc8bc19630 Merge pull request #251 from cmurphy/rspec-puppet-2 dffe18dd5cfc07f17e7f6530d75bba729e9c0d60 Update .travis.yml fbb80430444c5773aee4dd4f1045efb17d5a240c Keep testing on puppet 2.7 78183a1bd2d1873122183531205811a3edd83e5d Fix lint warnings and ensure lint fails on warnings 44dd10715e36a3f3d119e06d0cbc7025695b89cb Remove unneeded dependencies 3a0e7802a8eb1ac7ff58deacea5acfd1cd06dd99 Update tests for rspec-puppet 2 --- Puppetfile | 2 +- ntp/.sync.yml | 6 ++++++ ntp/.travis.yml | 19 +++++++++++++++---- ntp/Gemfile | 24 ++++++++++++++++++++---- ntp/Rakefile | 2 +- ntp/manifests/config.pp | 16 ++++++++-------- ntp/manifests/install.pp | 6 +++--- ntp/manifests/service.pp | 10 +++++----- ntp/spec/classes/ntp_spec.rb | 4 ++-- 9 files changed, 61 insertions(+), 28 deletions(-) diff --git a/Puppetfile b/Puppetfile index 2601f5149..90597eac7 100644 --- a/Puppetfile +++ b/Puppetfile @@ -119,7 +119,7 @@ mod 'nssdb', :git => 'https://github.com/rcritten/puppet-nssdb.git' mod 'ntp', - :commit => 'c1eef64924a51a5fb7281a4ccd0f098f0effd270', + :commit => '286acbacdb9aaa3f1255d7486078730e380195f4', :git => 'https://github.com/puppetlabs/puppetlabs-ntp' mod 'openstack_extras', diff --git a/ntp/.sync.yml b/ntp/.sync.yml index 66a03c649..ac8379073 100644 --- a/ntp/.sync.yml +++ b/ntp/.sync.yml @@ -1,3 +1,9 @@ --- +.travis.yml: + extras: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" spec/spec_helper.rb: unmanaged: true diff --git a/ntp/.travis.yml b/ntp/.travis.yml index 6cf8b0044..d1a0d7cd9 100644 --- a/ntp/.travis.yml +++ b/ntp/.travis.yml @@ -1,17 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false diff --git a/ntp/Gemfile b/ntp/Gemfile index 62c569397..fcd27d534 100644 --- a/ntp/Gemfile +++ b/ntp/Gemfile @@ -1,18 +1,34 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do - gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end diff --git a/ntp/Rakefile b/ntp/Rakefile index e3be95b0b..181157e6e 100644 --- a/ntp/Rakefile +++ b/ntp/Rakefile @@ -1,7 +1,7 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') diff --git a/ntp/manifests/config.pp b/ntp/manifests/config.pp index 91990ba11..e54feff0f 100644 --- a/ntp/manifests/config.pp +++ b/ntp/manifests/config.pp @@ -1,22 +1,22 @@ # class ntp::config inherits ntp { - if $keys_enable { - $directory = ntp_dirname($keys_file) + if $ntp::keys_enable { + $directory = ntp_dirname($ntp::keys_file) file { $directory: - ensure => directory, - owner => 0, - group => 0, - mode => '0755', + ensure => directory, + owner => 0, + group => 0, + mode => '0755', } } - file { $config: + file { $ntp::config: ensure => file, owner => 0, group => 0, mode => '0644', - content => template($config_template), + content => template($ntp::config_template), } } diff --git a/ntp/manifests/install.pp b/ntp/manifests/install.pp index 49f4044bf..9709d708d 100644 --- a/ntp/manifests/install.pp +++ b/ntp/manifests/install.pp @@ -1,10 +1,10 @@ # class ntp::install inherits ntp { - if $package_manage { + if $ntp::package_manage { - package { $package_name: - ensure => $package_ensure, + package { $ntp::package_name: + ensure => $ntp::package_ensure, } } diff --git a/ntp/manifests/service.pp b/ntp/manifests/service.pp index 3f1ada0b7..6bc951bf6 100644 --- a/ntp/manifests/service.pp +++ b/ntp/manifests/service.pp @@ -1,15 +1,15 @@ # class ntp::service inherits ntp { - if ! ($service_ensure in [ 'running', 'stopped' ]) { + if ! ($ntp::service_ensure in [ 'running', 'stopped' ]) { fail('service_ensure parameter must be running or stopped') } - if $service_manage == true { + if $ntp::service_manage == true { service { 'ntp': - ensure => $service_ensure, - enable => $service_enable, - name => $service_name, + ensure => $ntp::service_ensure, + enable => $ntp::service_enable, + name => $ntp::service_name, hasstatus => true, hasrestart => true, } diff --git a/ntp/spec/classes/ntp_spec.rb b/ntp/spec/classes/ntp_spec.rb index 4864e8883..522afbd00 100644 --- a/ntp/spec/classes/ntp_spec.rb +++ b/ntp/spec/classes/ntp_spec.rb @@ -411,8 +411,8 @@ }) end - it { expect{ subject }.to raise_error( - /^The ntp module is not supported on an unsupported based system./ + it { expect{ catalogue }.to raise_error( + /The ntp module is not supported on an unsupported based system./ )} end end From 2c113b55c3b6253a8de3d68c1479b0fe1801ba2f Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:48 +0100 Subject: [PATCH 17/22] Update rabbitmq to 91c767e2ac2ee62162ad79ea392c3c9ca77074c3 91c767e2ac2ee62162ad79ea392c3c9ca77074c3 Merge pull request #334 from cybertron/patch-1 377828ec9d20519b8f849b8f14b18df66f582e02 Remove duplicate $ssl_interface 8e69912718efa7129b1d45e59e8a47e8cc22e339 Merge pull request #331 from jbehrends/interface_fix 75f17a145d4a04ca534b1be8d530a9922c99b4e5 Merge pull request #330 from cmurphy/rspec-puppet-2 6eeb68be0b94e255fe84e14467502be1ee5797ae Added missing config params used in the rabbitmq.conf template. 5ba917b672db5ec1f659f72a5a0e9ac9f913ca65 Fix future parser errors f47dc9e6eac954569f003a328f25bd0f45f0bf12 Update .travis.yml ef3d9fb32a5020c6a431ad6e4250bf7d73c68523 Reorder fail-on-warning lint rule 1304ce61142e9cc8338aeade3c1280b5c04bf83d Sync with modulesync --- Puppetfile | 2 +- rabbitmq/.gitignore | 15 +- rabbitmq/.travis.yml | 13 +- rabbitmq/CONTRIBUTING.md | 220 ++++++++++++++++++ rabbitmq/Gemfile | 4 +- rabbitmq/Rakefile | 5 +- rabbitmq/manifests/config.pp | 5 + rabbitmq/manifests/init.pp | 25 +- .../acceptance/nodesets/centos-59-x64.yml | 10 + .../acceptance/nodesets/centos-64-x64-pe.yml | 12 + .../acceptance/nodesets/centos-65-x64.yml | 10 + .../nodesets/ubuntu-server-10044-x64.yml | 10 + .../nodesets/ubuntu-server-12042-x64.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 4 +- 14 files changed, 321 insertions(+), 24 deletions(-) create mode 100644 rabbitmq/CONTRIBUTING.md create mode 100644 rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml create mode 100644 rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml create mode 100644 rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml create mode 100644 rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml create mode 100644 rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml diff --git a/Puppetfile b/Puppetfile index 90597eac7..8f4de4bcc 100644 --- a/Puppetfile +++ b/Puppetfile @@ -143,7 +143,7 @@ mod 'qpid', :git => 'https://github.com/dprince/puppet-qpid' mod 'rabbitmq', - :commit => 'c9a4951e032ca76b00559ef5441515b96b2be23c', + :commit => '91c767e2ac2ee62162ad79ea392c3c9ca77074c3', :git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git' mod 'redis', diff --git a/rabbitmq/.gitignore b/rabbitmq/.gitignore index f751a15d6..b5db85e05 100644 --- a/rabbitmq/.gitignore +++ b/rabbitmq/.gitignore @@ -1,8 +1,9 @@ -.pkg +pkg/ Gemfile.lock -vendor -spec/fixtures -.rspec_system -.bundle -.vagrant -.*sw* +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.iml diff --git a/rabbitmq/.travis.yml b/rabbitmq/.travis.yml index 0618715a1..fef870d32 100644 --- a/rabbitmq/.travis.yml +++ b/rabbitmq/.travis.yml @@ -1,4 +1,5 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" @@ -6,8 +7,18 @@ matrix: fast_finish: true include: - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 1.8.7 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" notifications: email: false diff --git a/rabbitmq/CONTRIBUTING.md b/rabbitmq/CONTRIBUTING.md new file mode 100644 index 000000000..f1cbde4bb --- /dev/null +++ b/rabbitmq/CONTRIBUTING.md @@ -0,0 +1,220 @@ +Checklist (and a short version for the impatient) +================================================= + + * Commits: + + - Make commits of logical units. + + - Check for unnecessary whitespace with "git diff --check" before + committing. + + - Commit using Unix line endings (check the settings around "crlf" in + git-config(1)). + + - Do not check in commented out code or unneeded files. + + - The first line of the commit message should be a short + description (50 characters is the soft limit, excluding ticket + number(s)), and should skip the full stop. + + - Associate the issue in the message. The first line should include + the issue number in the form "(#XXXX) Rest of message". + + - The body should provide a meaningful commit message, which: + + - uses the imperative, present tense: "change", not "changed" or + "changes". + + - includes motivation for the change, and contrasts its + implementation with the previous behavior. + + - Make sure that you have tests for the bug you are fixing, or + feature you are adding. + + - Make sure the test suites passes after your commit: + `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below + + - When introducing a new feature, make sure it is properly + documented in the README.md + + * Submission: + + * Pre-requisites: + + - Make sure you have a [GitHub account](https://github.com/join) + + - [Create a ticket](https://tickets.puppetlabs.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppetlabs.com/browse/) you are patching for. + + * Preferred method: + + - Fork the repository on GitHub. + + - Push your changes to a topic branch in your fork of the + repository. (the format ticket/1234-short_description_of_change is + usually preferred for this project). + + - Submit a pull request to the repository in the puppetlabs + organization. + +The long version +================ + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on "master". + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +Testing +======= + +Getting Started +--------------- + +Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby +package manager such as [bundler](http://bundler.io/) what Ruby packages, +or Gems, are required to build, develop, and test this software. + +Please make sure you have [bundler installed](http://bundler.io/#getting-started) +on your system, then use it to install all dependencies needed for this project, +by running + +```shell +% bundle install +Fetching gem metadata from https://rubygems.org/........ +Fetching gem metadata from https://rubygems.org/.. +Using rake (10.1.0) +Using builder (3.2.2) +-- 8><-- many more --><8 -- +Using rspec-system-puppet (2.2.0) +Using serverspec (0.6.3) +Using rspec-system-serverspec (1.0.0) +Using bundler (1.3.5) +Your bundle is complete! +Use `bundle show [gemname]` to see where a bundled gem is installed. +``` + +NOTE some systems may require you to run this command with sudo. + +If you already have those gems installed, make sure they are up-to-date: + +```shell +% bundle update +``` + +With all dependencies in place and up-to-date we can now run the tests: + +```shell +% rake spec +``` + +This will execute all the [rspec tests](http://rspec-puppet.com/) tests +under [spec/defines](./spec/defines), [spec/classes](./spec/classes), +and so on. rspec tests may have the same kind of dependencies as the +module they are testing. While the module defines in its [Modulefile](./Modulefile), +rspec tests define them in [.fixtures.yml](./fixtures.yml). + +Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker) +tests. These tests spin up a virtual machine under +[VirtualBox](https://www.virtualbox.org/)) with, controlling it with +[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test +scenarios. In order to run these, you will need both of those tools +installed on your system. + +You can run them by issuing the following command + +```shell +% rake spec_clean +% rspec spec/acceptance +``` + +This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), +install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) +and then run all the tests under [spec/acceptance](./spec/acceptance). + +Writing Tests +------------- + +XXX getting started writing tests. + +If you have commit access to the repository +=========================================== + +Even if you have commit access to the repository, you will still need to +go through the process above, and have someone else review and merge +in your changes. The rule is that all changes must be reviewed by a +developer on the project (that did not write the code) to ensure that +all changes go through a code review process. + +Having someone other than the author of the topic branch recorded as +performing the merge is the record that they performed the code +review. + + +Additional Resources +==================== + +* [Getting additional help](http://puppetlabs.com/community/get-help) + +* [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests) + +* [Patchwork](https://patchwork.puppetlabs.com) + +* [General GitHub documentation](http://help.github.com/) + +* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) + diff --git a/rabbitmq/Gemfile b/rabbitmq/Gemfile index 12fd363ea..cc77f38cf 100644 --- a/rabbitmq/Gemfile +++ b/rabbitmq/Gemfile @@ -1,10 +1,8 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', :require => false - gem 'rspec-puppet', :require => false + gem 'rspec-core', '3.1.7', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false diff --git a/rabbitmq/Rakefile b/rabbitmq/Rakefile index 558b57a1e..181157e6e 100644 --- a/rabbitmq/Rakefile +++ b/rabbitmq/Rakefile @@ -1,11 +1,10 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_class_parameter_defaults') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') -PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] diff --git a/rabbitmq/manifests/config.pp b/rabbitmq/manifests/config.pp index 1f9c5472d..30de10160 100644 --- a/rabbitmq/manifests/config.pp +++ b/rabbitmq/manifests/config.pp @@ -15,6 +15,7 @@ $env_config = $rabbitmq::env_config $env_config_path = $rabbitmq::env_config_path $erlang_cookie = $rabbitmq::erlang_cookie + $interface = $rabbitmq::interface $management_port = $rabbitmq::management_port $node_ip_address = $rabbitmq::node_ip_address $plugin_dir = $rabbitmq::plugin_dir @@ -30,6 +31,7 @@ $ssl_cert = $rabbitmq::ssl_cert $ssl_key = $rabbitmq::ssl_key $ssl_port = $rabbitmq::ssl_port + $ssl_interface = $rabbitmq::ssl_interface $ssl_management_port = $rabbitmq::ssl_management_port $ssl_stomp_port = $rabbitmq::ssl_stomp_port $ssl_verify = $rabbitmq::ssl_verify @@ -39,13 +41,16 @@ $ldap_auth = $rabbitmq::ldap_auth $ldap_server = $rabbitmq::ldap_server $ldap_user_dn_pattern = $rabbitmq::ldap_user_dn_pattern + $ldap_other_bind = $rabbitmq::ldap_other_bind $ldap_use_ssl = $rabbitmq::ldap_use_ssl $ldap_port = $rabbitmq::ldap_port $ldap_log = $rabbitmq::ldap_log + $ldap_config_variables = $rabbitmq::ldap_config_variables $wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change $config_variables = $rabbitmq::config_variables $config_kernel_variables = $rabbitmq::config_kernel_variables $cluster_partition_handling = $rabbitmq::cluster_partition_handling + $file_limit = $rabbitmq::file_limit $default_env_variables = { 'NODE_PORT' => $port, 'NODE_IP_ADDRESS' => $node_ip_address diff --git a/rabbitmq/manifests/init.pp b/rabbitmq/manifests/init.pp index 97ec95574..6dfdc939b 100644 --- a/rabbitmq/manifests/init.pp +++ b/rabbitmq/manifests/init.pp @@ -87,11 +87,17 @@ validate_string($env_config) validate_absolute_path($env_config_path) validate_string($erlang_cookie) - validate_re($management_port, '\d+') + if ! is_integer($management_port) { + validate_re($management_port, '\d+') + } validate_string($node_ip_address) validate_absolute_path($plugin_dir) - validate_re($port, ['\d+','UNSET']) - validate_re($stomp_port, '\d+') + if ! is_integer($port) { + validate_re($port, ['\d+','UNSET']) + } + if ! is_integer($stomp_port) { + validate_re($stomp_port, '\d+') + } validate_bool($wipe_db_on_cookie_change) validate_bool($tcp_keepalive) if ! is_integer($file_limit) { @@ -106,10 +112,15 @@ validate_string($ssl_cacert) validate_string($ssl_cert) validate_string($ssl_key) - validate_re($ssl_port, '\d+') - validate_re($ssl_management_port, '\d+') - validate_string($ssl_stomp_port) - validate_re($ssl_stomp_port, '\d+') + if ! is_integer($ssl_port) { + validate_re($ssl_port, '\d+') + } + if ! is_integer($ssl_management_port) { + validate_re($ssl_management_port, '\d+') + } + if ! is_integer($ssl_stomp_port) { + validate_re($ssl_stomp_port, '\d+') + } validate_bool($stomp_ensure) validate_bool($ldap_auth) validate_string($ldap_server) diff --git a/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml b/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml new file mode 100644 index 000000000..2ad90b86a --- /dev/null +++ b/rabbitmq/spec/acceptance/nodesets/centos-59-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-59-x64: + roles: + - master + platform: el-5-x86_64 + box : centos-59-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: git diff --git a/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml b/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml new file mode 100644 index 000000000..7d9242f1b --- /dev/null +++ b/rabbitmq/spec/acceptance/nodesets/centos-64-x64-pe.yml @@ -0,0 +1,12 @@ +HOSTS: + centos-64-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box : centos-64-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: pe diff --git a/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml b/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml new file mode 100644 index 000000000..4e2cb809e --- /dev/null +++ b/rabbitmq/spec/acceptance/nodesets/centos-65-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-65-x64: + roles: + - master + platform: el-6-x86_64 + box : centos-65-x64-vbox436-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml new file mode 100644 index 000000000..5ca1514e4 --- /dev/null +++ b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-10044-x64: + roles: + - master + platform: ubuntu-10.04-amd64 + box : ubuntu-server-10044-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml new file mode 100644 index 000000000..d065b304f --- /dev/null +++ b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-12042-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box : ubuntu-server-12042-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + type: foss diff --git a/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml index 4cb4ad430..cba1cd04c 100644 --- a/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ b/rabbitmq/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -3,8 +3,8 @@ HOSTS: roles: - master platform: ubuntu-14.04-amd64 - box : trusty-server-cloudimg-amd64-vagrant-disk1 - box_url : https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box + box : puppetlabs/ubuntu-14.04-64-nocm + box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm hypervisor : vagrant CONFIG: log_level : debug From 5817105d53279d907a531e1437238df6edca3be1 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:10:58 +0100 Subject: [PATCH 18/22] Update rsync to 72e8543c630ae7a7290717d2cb229703542495e5 72e8543c630ae7a7290717d2cb229703542495e5 Merge pull request #63 from jweisner/rspec_310 259c90aba9fe7fb34c790c0dd0ce1f63ddf7b36f Pin rspec version to 3.1.0 (rspec/rspec-core#1864) --- Puppetfile | 2 +- rsync/Gemfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Puppetfile b/Puppetfile index 8f4de4bcc..3c4782414 100644 --- a/Puppetfile +++ b/Puppetfile @@ -155,7 +155,7 @@ mod 'remote', :git => 'https://github.com/paramite/puppet-remote.git' mod 'rsync', - :commit => '67a3475e141d672caa5fe552d8cf59cd0bd0137e', + :commit => '72e8543c630ae7a7290717d2cb229703542495e5', :git => 'https://github.com/puppetlabs/puppetlabs-rsync.git' mod 'sahara', diff --git a/rsync/Gemfile b/rsync/Gemfile index 265d3108f..cdc44a0b6 100644 --- a/rsync/Gemfile +++ b/rsync/Gemfile @@ -1,5 +1,6 @@ source "https://rubygems.org" +gem 'rspec', '~> 3.1.0' gem 'puppetlabs_spec_helper' if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false From 0405ac4d79a587a1adfd370d4c798f96c506261c Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:11:12 +0100 Subject: [PATCH 19/22] Update stdlib to 2762bb6c930a3547aaef339fd8f649af349385c2 2762bb6c930a3547aaef339fd8f649af349385c2 Merge pull request #426 from anodelman/master 2381f7cff480019013da87baf962ce6e665779f4 (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... --- Puppetfile | 2 +- stdlib/Gemfile | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Puppetfile b/Puppetfile index 3c4782414..6a9d55978 100644 --- a/Puppetfile +++ b/Puppetfile @@ -171,7 +171,7 @@ mod 'staging', :git => 'https://github.com/nanliu/puppet-staging.git' mod 'stdlib', - :commit => '4dab70b305c4ab1c8c36356efa4bd205678c7c49', + :commit => '2762bb6c930a3547aaef339fd8f649af349385c2', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' mod 'swift', diff --git a/stdlib/Gemfile b/stdlib/Gemfile index e1a59fab8..2d19594db 100644 --- a/stdlib/Gemfile +++ b/stdlib/Gemfile @@ -21,12 +21,17 @@ group :development, :unit_tests do end beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do if beaker_version - gem 'beaker', *location_for(beaker_version) + gem 'beaker', *location_for(beaker_version) end - gem 'beaker-rspec', :require => false - gem 'serverspec', :require => false + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'serverspec', :require => false end facterversion = ENV['GEM_FACTER_VERSION'] || ENV['FACTER_GEM_VERSION'] From f078f440280dbe006c35c8caf9b65299bef7fbf5 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:11:18 +0100 Subject: [PATCH 20/22] Update swift to 96ad9dd2237d9d9165025fd76e3c4b7f348ea2f1 96ad9dd2237d9d9165025fd76e3c4b7f348ea2f1 Merge "Add Puppet 4.x lint checks" cc00b5cf5f2af53c1d6561c30db39bc20729908a Merge "spec: updates for rspec-puppet 2.x and rspec 3.x" 35ad8ab1a349b7f98f22494a517621dc4ca6b3e5 Merge "Upgrade puppet-lint and fix metadata, parameter and style lint issues" 1ca74aafa456a7a72a073f3b297e52e975c4d1ff Merge "Add base `swift` class name to call" 7a0c615db8a37cec64ceda96909a0743c9ac9161 Add node_timeout parameter for proxy-server.conf 88541bdef61665c752e31961706f395a53f53506 Add base `swift` class name to call dc8657e2038b57b354b7ac622f711c34d241ec4c Add Puppet 4.x lint checks f4cfe8e8e45499df70cf525a21f7e1bbf4419904 spec: updates for rspec-puppet 2.x and rspec 3.x 77be0932fc7d40a9bdf47c175c8ae5ffcc660f2f Upgrade puppet-lint and fix metadata, parameter and style lint issues --- Puppetfile | 2 +- swift/Gemfile | 18 ++- swift/manifests/auth_file.pp | 24 ++- swift/manifests/bench.pp | 66 +++++++++ swift/manifests/client.pp | 2 +- swift/manifests/dispersion.pp | 15 +- swift/manifests/init.pp | 17 ++- swift/manifests/keystone/auth.pp | 67 ++++++++- swift/manifests/keystone/dispersion.pp | 11 +- swift/manifests/params.pp | 2 + swift/manifests/proxy.pp | 37 ++++- swift/manifests/proxy/account_quotas.pp | 1 - swift/manifests/proxy/authtoken.pp | 57 +++++-- swift/manifests/proxy/bulk.pp | 1 - swift/manifests/proxy/catch_errors.pp | 1 - swift/manifests/proxy/ceilometer.pp | 10 +- swift/manifests/proxy/container_quotas.pp | 1 - swift/manifests/proxy/crossdomain.pp | 1 - swift/manifests/proxy/formpost.pp | 1 - swift/manifests/proxy/gatekeeper.pp | 3 +- swift/manifests/proxy/keystone.pp | 18 ++- swift/manifests/proxy/ratelimit.pp | 33 +++-- swift/manifests/proxy/s3token.pp | 23 ++- swift/manifests/proxy/slo.pp | 1 - swift/manifests/proxy/staticweb.pp | 1 - swift/manifests/proxy/swauth.pp | 21 ++- swift/manifests/proxy/swift3.pp | 8 +- swift/manifests/proxy/tempauth.pp | 2 + swift/manifests/proxy/tempurl.pp | 1 - swift/manifests/ringbuilder/create.pp | 6 +- swift/manifests/ringserver.pp | 15 +- swift/manifests/ringsync.pp | 2 + swift/manifests/storage.pp | 2 +- swift/manifests/storage/account.pp | 22 +-- swift/manifests/storage/all.pp | 33 ++++- swift/manifests/storage/container.pp | 33 +++-- swift/manifests/storage/disk.pp | 8 +- swift/manifests/storage/ext4.pp | 10 +- swift/manifests/storage/generic.pp | 2 +- swift/manifests/storage/loopback.pp | 8 +- swift/manifests/storage/mount.pp | 2 +- swift/manifests/storage/node.pp | 12 +- swift/manifests/storage/object.pp | 24 +-- swift/manifests/storage/server.pp | 4 +- swift/manifests/storage/xfs.pp | 10 +- swift/manifests/test_file.pp | 2 +- swift/metadata.json | 2 +- swift/spec/classes/swift_bench_spec.rb | 34 ++--- swift/spec/classes/swift_client_spec.rb | 4 +- swift/spec/classes/swift_dispersion_spec.rb | 28 ++-- .../spec/classes/swift_keystone_auth_spec.rb | 22 +-- .../classes/swift_keystone_dispersion_spec.rb | 8 +- .../swift_proxy_account_quotas_spec.rb | 4 +- .../classes/swift_proxy_authtoken_spec.rb | 16 +- swift/spec/classes/swift_proxy_bulk_spec.rb | 4 +- swift/spec/classes/swift_proxy_cache_spec.rb | 10 +- .../classes/swift_proxy_catch_errors_spec.rb | 4 +- .../classes/swift_proxy_ceilometer_spec.rb | 10 +- .../swift_proxy_container_quotas_spec.rb | 4 +- .../classes/swift_proxy_crossdomain_spec.rb | 4 +- .../spec/classes/swift_proxy_formpost_spec.rb | 4 +- .../classes/swift_proxy_gatekeeper_spec.rb | 4 +- .../classes/swift_proxy_healthcheck_spec.rb | 4 +- .../spec/classes/swift_proxy_keystone_spec.rb | 16 +- .../classes/swift_proxy_ratelimit_spec.rb | 4 +- .../spec/classes/swift_proxy_s3token_spec.rb | 6 +- swift/spec/classes/swift_proxy_slo_spec.rb | 4 +- swift/spec/classes/swift_proxy_spec.rb | 32 ++-- .../classes/swift_proxy_staticweb_spec.rb | 4 +- swift/spec/classes/swift_proxy_swauth_spec.rb | 16 +- swift/spec/classes/swift_proxy_swift3_spec.rb | 4 +- .../spec/classes/swift_proxy_tempurl_spec.rb | 4 +- swift/spec/classes/swift_ringbuilder_spec.rb | 24 +-- swift/spec/classes/swift_ringserver_spec.rb | 8 +- swift/spec/classes/swift_spec.rb | 27 ++-- .../classes/swift_storage_account_spec.rb | 8 +- swift/spec/classes/swift_storage_all_spec.rb | 26 ++-- .../classes/swift_storage_container_spec.rb | 16 +- .../spec/classes/swift_storage_object_spec.rb | 6 +- swift/spec/classes/swift_storage_spec.rb | 8 +- swift/spec/classes/swift_test_file_spec.rb | 4 +- swift/spec/classes/swift_xfs_spec.rb | 2 +- .../defines/swift_ringbuilder_create_spec.rb | 4 +- .../swift_ringbuilder_rebalance_spec.rb | 8 +- swift/spec/defines/swift_storage_disk_spec.rb | 2 +- .../swift_storage_filter_healthcheck_spec.rb | 2 +- .../swift_storage_filter_recon_spec.rb | 4 +- .../defines/swift_storage_generic_spec.rb | 12 +- .../defines/swift_storage_loopback_spec.rb | 2 +- .../spec/defines/swift_storage_mount_spec.rb | 6 +- swift/spec/defines/swift_storage_node_spec.rb | 12 +- .../spec/defines/swift_storage_server_spec.rb | 74 +++------ swift/spec/defines/swift_storage_xfs_spec.rb | 4 +- swift/spec/shared_examples.rb | 2 +- .../provider/swift_ring_builder_spec.rb | 140 +++++++++--------- swift/templates/proxy-server.conf.erb | 3 + swift/tests/all.pp | 14 +- swift/tests/site.pp | 117 +++++++-------- 98 files changed, 855 insertions(+), 576 deletions(-) diff --git a/Puppetfile b/Puppetfile index 6a9d55978..bf28e9780 100644 --- a/Puppetfile +++ b/Puppetfile @@ -175,7 +175,7 @@ mod 'stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' mod 'swift', - :commit => '15aa71f0015532fbe39b9f399c5bd000ca9b52c7', + :commit => '96ad9dd2237d9d9165025fd76e3c4b7f348ea2f1', :git => 'https://github.com/stackforge/puppet-swift.git' mod 'sysctl', diff --git a/swift/Gemfile b/swift/Gemfile index f3182fde2..b0b2d45ff 100644 --- a/swift/Gemfile +++ b/swift/Gemfile @@ -2,10 +2,20 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', '~> 0.3.2' - gem 'rspec-puppet', '~> 1.0.1' - gem 'rake', '10.1.1' - gem 'rspec', '< 2.99' + gem 'rspec-puppet', '~> 2.0.0', :require => false + + gem 'metadata-json-lint' + gem 'puppet-lint-param-docs' + gem 'puppet-lint-absolute_classname-check' + gem 'puppet-lint-absolute_template_path' + gem 'puppet-lint-trailing_newline-check' + + # Puppet 4.x related lint checks + gem 'puppet-lint-unquoted_string-check' + gem 'puppet-lint-leading_zero-check' + gem 'puppet-lint-variable_contains_upcase' + gem 'puppet-lint-numericvariable' + gem 'json' gem 'webmock' end diff --git a/swift/manifests/auth_file.pp b/swift/manifests/auth_file.pp index 6971c2d8b..78d297ca3 100644 --- a/swift/manifests/auth_file.pp +++ b/swift/manifests/auth_file.pp @@ -1,3 +1,23 @@ +# == Class: swift::auth_file +# +# Create a RC credentials file for Swift v1 authentication +# +# === Parameters: +# +# [*admin_tenant*] +# (required) The name of the tenant used to authenticate +# +# [*admin_user*] +# (optional) The name of the user to create in keystone for use by the ironic services +# Defaults to 'admin' +# +# [*auth_url*] +# (optional) The authentication URL +# Defaults to 'http://127.0.0.1:5000/v2.0/' +# +# [*admin_password*] +# (required) The password for the swift user +# class swift::auth_file ( $admin_tenant, $admin_password, @@ -6,7 +26,7 @@ ) { file { '/root/swiftrc': - ensure => present, + ensure => file, owner => 'root', group => 'root', mode => '0600', @@ -15,6 +35,6 @@ export ST_USER=${admin_tenant}:${admin_user} export ST_KEY=${admin_password} export ST_AUTH=${auth_url} - " + ", } } diff --git a/swift/manifests/bench.pp b/swift/manifests/bench.pp index 10a6360e4..76c6d434d 100644 --- a/swift/manifests/bench.pp +++ b/swift/manifests/bench.pp @@ -1,4 +1,70 @@ +# == Class: swift::bench +# # Configure swift-bench.conf for swift performance bench +# +# === Parameters: +# +# [*auth_url*] +# Defaults to 'http://localhost:8080/auth/v1.0' +# +# [*swift_user*] +# Defaults to 'test:tester' +# +# [*swift_key*] +# Defaults to 'testing' +# +# [*auth_version*] +# Defaults to '1.0' +# +# [*log_level*] +# Defaults to 'INFO' +# +# [*test_timeout*] +# Defaults to '10' +# +# [*put_concurrency*] +# (optional) Configure PUT concurrency +# Defaults to '10' +# +# [*get_concurrency*] +# (optional) Configure GET concurrency +# Defaults to '10', +# +# [*del_concurrency*] +# (optional) Configure DELETE concurrency +# Defaults to '10', +# +# [*lower_object_size*] +# If object_sources is not set and lower_object_size != upper_object_size, +# each PUT will randomly select an object size between the two values. Units +# are bytes. +# Defaults to '10' +# +# [*upper_object_size*] +# If object_sources is not set and lower_object_size != upper_object_size, +# each PUT will randomly select an object size between the two values. Units +# are bytes. +# Defaults to '10' +# +# [*object_size*] +# If object_sources is not set and lower_object_size == upper_object_size, +# every object PUT will contain this many bytes. +# Defaults to '1' +# +# [*num_objects*] +# Defaults to '1000' +# +# [*num_gets*] +# Defaults to '10000' +# +# [*num_containers*] +# Defaults to '20' +# +# [*delete*] +# Should swift-bench benchmark DELETEing the created objects and then delete +# all created containers? +# Defaults to 'yes' +# class swift::bench ( $auth_url = 'http://localhost:8080/auth/v1.0', $swift_user = 'test:tester', diff --git a/swift/manifests/client.pp b/swift/manifests/client.pp index d692285fa..757a74785 100644 --- a/swift/manifests/client.pp +++ b/swift/manifests/client.pp @@ -12,7 +12,7 @@ $ensure = 'present' ) { - include swift::params + include ::swift::params package { 'swiftclient': ensure => $ensure, diff --git a/swift/manifests/dispersion.pp b/swift/manifests/dispersion.pp index f01e4acc4..81f6d6779 100644 --- a/swift/manifests/dispersion.pp +++ b/swift/manifests/dispersion.pp @@ -14,34 +14,44 @@ # [*auth_url*] # String. The full URL to the authentication endpoint (eg. keystone) # Optional. Defaults to '127.0.0.1'. +# # [*auth_user*] # String. The Swift username to use to run the tools. # Optional. Defaults to 'dispersion'. +# # [*auth_tenant*] # String. The user's tenant/project. # Optional. Defaults to 'services'. +# # [*auth_pass*] # String. The user's password. # Optional. Defaults to 'dispersion_password'. +# # [*auth_version*] # String. The version to pass to the 'swift' command. # Use '2.0' when using Keystone. # Optional. Defaults to '2.0' +# # [*endpoint_type*] # String. The ability to choose which Swift endpoint to use. # Optional. Defaults to 'publicURL'. +# # [*swift_dir*] # String. The path to swift configuration folder # Optional. Defaults to '/etc/swift'. +# # [*coverage*] # Integer. The percentage of partitions to cover. # Optional. Defaults to 1 +# # [*retries*] # Integer. Number of retries. # Optional. Defaults to 5. +# # [*concurrency*] # Integer. Process concurrency. # Optional. Defaults to 25. +# # [*dump_json*] # 'yes' or 'no'. Should 'swift-dispersion-report' dump json results ? # Optional. Defaults to no. @@ -56,7 +66,6 @@ # # Francois Charlier fcharlier@ploup.net # - class swift::dispersion ( $auth_url = 'http://127.0.0.1:5000/v2.0/', $auth_user = 'dispersion', @@ -71,13 +80,13 @@ $dump_json = 'no' ) { - include swift::params + include ::swift::params Package['swift'] -> Swift_dispersion_config<||> Swift_dispersion_config<||> ~> Exec['swift-dispersion-populate'] file { '/etc/swift/dispersion.conf': - ensure => present, + ensure => file, owner => 'swift', group => 'swift', mode => '0660', diff --git a/swift/manifests/init.pp b/swift/manifests/init.pp index db693a6da..2163f3e5d 100644 --- a/swift/manifests/init.pp +++ b/swift/manifests/init.pp @@ -1,6 +1,7 @@ # Install and configure base swift components # # == Parameters +# # [*swift_hash_suffix*] string of text to be used # as a salt when hashing to determine mappings in the ring. # This file should be the same on every node in the cluster. @@ -29,8 +30,8 @@ $client_package_ensure = 'present', ) { - include swift::params - include ssh::server + include ::swift::params + include ::ssh::server Class['ssh::server::install'] -> Class['swift'] @@ -41,15 +42,15 @@ } } - class { 'swift::client': + class { '::swift::client': ensure => $client_package_ensure; } File { owner => 'swift', group => 'swift', require => Package['swift'] } file { '/home/swift': - ensure => directory, - mode => '0700', + ensure => directory, + mode => '0700', } file { '/etc/swift': @@ -67,11 +68,11 @@ } file { '/etc/swift/swift.conf': - ensure => present, - mode => '0660', + ensure => file, + mode => '0660', } swift_config { 'swift-hash/swift_hash_path_suffix': - value => $swift_hash_suffix + value => $swift_hash_suffix, } } diff --git a/swift/manifests/keystone/auth.pp b/swift/manifests/keystone/auth.pp index e15295177..b3b3709f8 100644 --- a/swift/manifests/keystone/auth.pp +++ b/swift/manifests/keystone/auth.pp @@ -5,8 +5,9 @@ # # The user is given the admin role in the services tenant. # -# === Parameters -# [*auth_user*] +# === Parameters: +# +# [*auth_name*] # String. The name of the user. # Optional. Defaults to 'swift'. # @@ -14,8 +15,64 @@ # String. The user's password. # Optional. Defaults to 'swift_password'. # +# [*port*] +# (Optional) Port for endpoint. +# Defaults to '8080'. +# +# [*public_port*] +# (Optional) Port for endpoint. +# Defaults to '8080'. +# +# [*tenant*] +# (Optional) The tenant to use for the swift service user +# Defaults to 'services' +# +# [*email*] +# (Optional) The email address for the swift service user +# Defaults to 'swift@localhost' +# +# [*region*] +# (Optional) The region in which to place the endpoints +# Defaults to 'RegionOne' +# # [*operator_roles*] -# Array of strings. List of roles Swift considers as admin. +# (Optional) Array of strings. List of roles Swift considers as admin. +# Defaults to '['admin', 'SwiftOperator']' +# +# [*public_protocol*] +# (Optional) Protocol to use for the public endpoint. Can be http or https. +# Defaults to 'http' +# +# [*public_address*] +# (Optional) Public address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*admin_protocol*] +# (Optional) Protocol for admin endpoints. +# Defaults to 'http'. +# +# [*admin_address*] +# (Optional) Admin address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*internal_protocol*] +# Protocol for internal endpoints. Defaults to 'http'. +# +# [*internal_address*] +# (Optional) Internal address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*configure_endpoint*] +# (optional) Whether to create the endpoint. +# Defaults to true +# +# [*configure_s3_endpoint*] +# (optional) Whether to create the S3 endpoint. +# Defaults to true +# +# [*endpoint_prefix*] +# (optional) The prefix endpoint, used for endpoint URL. +# Defaults to 'AUTH' # # [*service_name*] # (optional) Name of the service. @@ -86,7 +143,7 @@ internal_url => "${internal_protocol}://${real_internal_address}:${port}/v1/${endpoint_prefix}_%(tenant_id)s", } - keystone::resource::service_identity { "swift_s3": + keystone::resource::service_identity { 'swift_s3': configure_user => false, configure_user_role => false, configure_endpoint => $configure_s3_endpoint, @@ -106,6 +163,6 @@ } # Backward compatibility - Keystone_user["$auth_name"] -> Keystone_user_role["${auth_name}@${tenant}"] + Keystone_user[$auth_name] -> Keystone_user_role["${auth_name}@${tenant}"] } diff --git a/swift/manifests/keystone/dispersion.pp b/swift/manifests/keystone/dispersion.pp index e9993b051..44b830c84 100644 --- a/swift/manifests/keystone/dispersion.pp +++ b/swift/manifests/keystone/dispersion.pp @@ -17,11 +17,18 @@ # String. The user's password. # Optional. Defaults to 'dispersion_password'. # +# [*email*] +# (Optional) The email address for the swift service user +# Defaults to 'swift@localhost' +# +# [*tenant*] +# (Optional) The tenant to use for the swift service user +# Defaults to 'services' +# # === Authors # # Francois Charlier fcharlier@ploup.net # - class swift::keystone::dispersion( $auth_user = 'dispersion', $auth_pass = 'dispersion_password', @@ -39,6 +46,6 @@ keystone_user_role { "${auth_user}@${tenant}": ensure => present, roles => 'admin', - require => Keystone_user[$auth_user] + require => Keystone_user[$auth_user], } } diff --git a/swift/manifests/params.pp b/swift/manifests/params.pp index 4b71a9249..feaa197da 100644 --- a/swift/manifests/params.pp +++ b/swift/manifests/params.pp @@ -1,3 +1,5 @@ +# == Class: swift::params +# class swift::params { case $::osfamily { 'Debian': { diff --git a/swift/manifests/proxy.pp b/swift/manifests/proxy.pp index d89fea929..503a8d54a 100644 --- a/swift/manifests/proxy.pp +++ b/swift/manifests/proxy.pp @@ -37,6 +37,34 @@ # Has to be set to true for tempauth. # Defaults to true. # +# [*log_headers*] +# (optional) If True, log headers in each request +# Defaults to False. +# +# [*log_udp_host*] +# (optional) If not set, the UDP receiver for syslog is disabled. +# Defaults to an empty string +# +# [*log_udp_port*] +# (optional) Port value for UDP receiver, if enabled. +# Defaults to an empty string +# +# [*log_address*] +# (optional) Location where syslog sends the logs to. +# Defaults to '/dev/log'. +# +# [*log_level*] +# (optional) Log level. +# Defaults to 'INFO'. +# +# [*log_facility*] +# (optional) Log level +# Defaults to 'LOG_LOCAL1'. +# +# [*log_handoffs*] +# (optional) If True, the proxy will log whenever it has to failover to a handoff node +# Defaults to true. +# # [*read_affinity*] # (optional) Configures the read affinity of proxy-server. # Defaults to undef. @@ -50,6 +78,10 @@ # Optional but requires write_affinity to be set. # Defaults to undef. # +# [*node_timeout*] +# (optional) Configures node_timeout for swift proxy-server +# Defaults to undef. +# # [*enabled*] # (optional) Should the service be enabled. # Defaults to true @@ -94,13 +126,14 @@ $read_affinity = undef, $write_affinity = undef, $write_affinity_node_count = undef, + $node_timeout = undef, $manage_service = true, $enabled = true, $package_ensure = 'present' ) { - include swift::params - include concat::setup + include ::swift::params + include ::concat::setup validate_bool($account_autocreate) validate_bool($allow_account_management) diff --git a/swift/manifests/proxy/account_quotas.pp b/swift/manifests/proxy/account_quotas.pp index 94a68ee6c..d3a77c79a 100644 --- a/swift/manifests/proxy/account_quotas.pp +++ b/swift/manifests/proxy/account_quotas.pp @@ -17,7 +17,6 @@ # # Configure Swift Account Quotas # - class swift::proxy::account_quotas() { concat::fragment { 'swift_account_quotas': target => '/etc/swift/proxy-server.conf', diff --git a/swift/manifests/proxy/authtoken.pp b/swift/manifests/proxy/authtoken.pp index 711175227..23ec71a1d 100644 --- a/swift/manifests/proxy/authtoken.pp +++ b/swift/manifests/proxy/authtoken.pp @@ -3,33 +3,63 @@ # for swift proxy # # == Parameters -# [admin_token] Keystone admin token that can serve as a shared secret +# +# [*admin_token*] +# Keystone admin token that can serve as a shared secret # for authenticating. If this is choosen if is used instead of a user,tenant,password. # Optional. Defaults to false. -# [admin_user] User used to authenticate service. +# +# [*admin_user*] +# User used to authenticate service. # Optional. Defaults to 'swift'. -# [admin_tenant_name] Tenant used to authenticate service. +# +# [*admin_tenant_name*] +# Tenant used to authenticate service. # Optional. Defaults to 'services'. -# [admin_password] Password used with user to authenticate service. +# +# [*admin_password*] +# Password used with user to authenticate service. # Optional. Defaults to 'password'. -# [delay_auth_decision] Set to 1 to support token-less access (anonymous access, -# tempurl, ...) +# +# [*delay_auth_decision*] +# Set to 1 to support token-less access (anonymous access, tempurl, ...) # Optional, Defaults to 0 -# [auth_host] Host providing the keystone service API endpoint. Optional. +# +# [*auth_host*] +# Host providing the keystone service API endpoint. Optional. # Defaults to 127.0.0.1 -# [auth_port] Port where keystone service is listening. Optional. +# +# [*auth_port*] +# Port where keystone service is listening. Optional. # Defaults to 3557. -# [auth_protocol] Protocol to use to communicate with keystone. Optional. +# +# [*auth_protocol*] +# Protocol to use to communicate with keystone. Optional. # Defaults to https. -# [auth_admin_prefix] path part of the auth url. Optional. +# +# [*auth_admin_prefix*] +# Path part of the auth url. Optional. # This allows admin auth URIs like http://host/keystone/admin/v2.0. # Defaults to false for empty. It defined, should be a string with a leading '/' and no trailing '/'. -# [auth_uri] The public auth url to redirect unauthenticated requests. +# +# [*auth_uri*] +# The public auth url to redirect unauthenticated requests. # Defaults to false to be expanded to '${auth_protocol}://${auth_host}:5000'. # Should be set to your public keystone endpoint (without version). -# [signing_dir] The cache directory for signing certificates. +# +# [*identity_uri*] +# identity_uri points to the Keystone Admin service. This information is +# used by the middleware to actually query Keystone about the validity of the +# authentication tokens. It is not necessary to append any Keystone API version +# number to this URI. +# Defaults to false. +# +# [*signing_dir*] +# The cache directory for signing certificates. # Defaults to '/var/cache/swift' -# [cache] the cache backend to use +# +# [*cache*] +# The cache backend to use # Optional. Defaults to 'swift.cache' # # == Authors @@ -40,7 +70,6 @@ # # Copyright 2012 Puppetlabs Inc, unless otherwise noted. # - class swift::proxy::authtoken( $admin_user = 'swift', $admin_tenant_name = 'services', diff --git a/swift/manifests/proxy/bulk.pp b/swift/manifests/proxy/bulk.pp index 7110e023a..e5e1897d1 100644 --- a/swift/manifests/proxy/bulk.pp +++ b/swift/manifests/proxy/bulk.pp @@ -37,7 +37,6 @@ # while its processing the request. # Default to 60. # - class swift::proxy::bulk( $max_containers_per_extraction = '10000', $max_failed_extractions = '1000', diff --git a/swift/manifests/proxy/catch_errors.pp b/swift/manifests/proxy/catch_errors.pp index 452b91f55..c1f88fbc6 100644 --- a/swift/manifests/proxy/catch_errors.pp +++ b/swift/manifests/proxy/catch_errors.pp @@ -15,7 +15,6 @@ # # Copyright 2012 eNovance licensing@enovance.com # - class swift::proxy::catch_errors() { concat::fragment { 'swift_catch_errors': diff --git a/swift/manifests/proxy/ceilometer.pp b/swift/manifests/proxy/ceilometer.pp index eb9a5a073..6ae73e7b6 100644 --- a/swift/manifests/proxy/ceilometer.pp +++ b/swift/manifests/proxy/ceilometer.pp @@ -5,6 +5,12 @@ # # puppet-ceilometer (http://github.com/enovance/puppet-ceilometer) # +# == Parameters +# +# [*ensure*] +# Enable or not ceilometer fragment +# Defaults to 'present' +# # == Examples # # == Authors @@ -28,7 +34,7 @@ } file { '/var/log/ceilometer/swift-proxy-server.log': - ensure => present, + ensure => file, mode => '0664', owner => 'swift', group => 'swift', @@ -38,7 +44,7 @@ target => '/etc/swift/proxy-server.conf', content => template('swift/proxy/ceilometer.conf.erb'), order => '33', - require => Class['::ceilometer'] + require => Class['::ceilometer'], } } diff --git a/swift/manifests/proxy/container_quotas.pp b/swift/manifests/proxy/container_quotas.pp index 19e951298..f423443ac 100644 --- a/swift/manifests/proxy/container_quotas.pp +++ b/swift/manifests/proxy/container_quotas.pp @@ -17,7 +17,6 @@ # # Configure Swift Container Quotas # - class swift::proxy::container_quotas() { concat::fragment { 'swift_container_quotas': target => '/etc/swift/proxy-server.conf', diff --git a/swift/manifests/proxy/crossdomain.pp b/swift/manifests/proxy/crossdomain.pp index d01d99fce..6530ded48 100644 --- a/swift/manifests/proxy/crossdomain.pp +++ b/swift/manifests/proxy/crossdomain.pp @@ -11,7 +11,6 @@ # cross_domain_policy value according to http://docs.openstack.org/developer/swift/crossdomain.html # default: # - class swift::proxy::crossdomain ( $cross_domain_policy = '', ) { diff --git a/swift/manifests/proxy/formpost.pp b/swift/manifests/proxy/formpost.pp index 19f68e268..597ef301c 100644 --- a/swift/manifests/proxy/formpost.pp +++ b/swift/manifests/proxy/formpost.pp @@ -15,7 +15,6 @@ # # Copyright 2012 eNovance licensing@enovance.com # - class swift::proxy::formpost() { concat::fragment { 'swift-proxy-formpost': diff --git a/swift/manifests/proxy/gatekeeper.pp b/swift/manifests/proxy/gatekeeper.pp index 7d2b07f95..95d8237d8 100644 --- a/swift/manifests/proxy/gatekeeper.pp +++ b/swift/manifests/proxy/gatekeeper.pp @@ -35,12 +35,11 @@ # # Copyright 2014 UnitedStack licensing@unitedstack.com # - class swift::proxy::gatekeeper( $log_name = 'gatekeeper', $log_facility = 'LOG_LOCAL0', $log_level = 'INFO', - $log_headers = 'false', + $log_headers = false, $log_address = '/dev/log' ) { diff --git a/swift/manifests/proxy/keystone.pp b/swift/manifests/proxy/keystone.pp index da57dce7e..9e7c2362e 100644 --- a/swift/manifests/proxy/keystone.pp +++ b/swift/manifests/proxy/keystone.pp @@ -2,21 +2,27 @@ # This class can be sed to manage keystone middleware for swift proxy # # == Parameters -# [operator_roles] a list of keystone roles a user must have to gain -# access to Swift. -# Optional. Defaults to ['admin', 'SwiftOperator'] +# +# [*operator_roles*] +# (Optional) a list of keystone roles a user must have to gain access to Swift. +# Defaults to ['admin', 'SwiftOperator'] # Must be an array of strings # Swift operator roles must be defined in swift::keystone::auth because # keystone API access is usually not available on Swift proxy nodes. -# [is_admin] Set to true to allow users to set ACLs on their account. -# Optional. Defaults to true. +# +# [*is_admin*] +# (Optional) Set to true to allow users to set ACLs on their account. +# Defaults to true. +# +# [*reseller_prefix*] +# (Optional) The prefix used for reseller URL. +# Defaults to 'AUTH_' # # == Authors # # Dan Bode dan@puppetlabs.com # Francois Charlier fcharlier@ploup.net # - class swift::proxy::keystone( $operator_roles = ['admin', 'SwiftOperator'], $is_admin = true, diff --git a/swift/manifests/proxy/ratelimit.pp b/swift/manifests/proxy/ratelimit.pp index f2293a199..7b465b340 100644 --- a/swift/manifests/proxy/ratelimit.pp +++ b/swift/manifests/proxy/ratelimit.pp @@ -1,21 +1,32 @@ +# == Class: swift::proxy::ratelimit # # Configure swift ratelimit. # # See Swift's ratelimit documentation for more detail about the values. # -# == Parameters -# [clock_accuracy] The accuracy of swift proxy servers' clocks. +# === Parameters +# +# [*clock_accuracy*] +# (optional) The accuracy of swift proxy servers' clocks. # 1000 is 1ms max difference. No rate should be higher than this. -# Optional. Defaults to 1000 -# [max_sleep_time_seconds] Time before the app returns a 498 response. -# Optional. Defaults to 60. -# [log_sleep_time_seconds] if >0, enables logging of sleeps longer than +# Defaults to 1000 +# +# [*max_sleep_time_seconds*] +# (optional) Time before the app returns a 498 response. +# Defaults to 60. +# +# [*log_sleep_time_seconds*] +# (optional) if >0, enables logging of sleeps longer than # the value. -# Optional. Defaults to 0. -# [rate_buffer_seconds] Time in second the rate counter can skip. -# Optional. Defaults to 5. -# [account_ratelimit] if >0, limits PUT and DELETE requests to containers -# Optional. Defaults to 0. +# Defaults to 0. +# +# [*rate_buffer_seconds*] +# (optional) Time in second the rate counter can skip. +# Defaults to 5. +# +# [*account_ratelimit*] +# (optional) if >0, limits PUT and DELETE requests to containers +# Defaults to 0. # # == Dependencies # diff --git a/swift/manifests/proxy/s3token.pp b/swift/manifests/proxy/s3token.pp index feebf306e..da2e41750 100644 --- a/swift/manifests/proxy/s3token.pp +++ b/swift/manifests/proxy/s3token.pp @@ -1,13 +1,20 @@ +# == Class: swift::proxy::s3token # # Configure swift s3token. # -# == Parameters -# [auth_host] the keystone host -# Optional. Defaults to 127.0.0.1 -# [auth_port] the Keystone client API port -# Optional. Defaults to 5000 -# [auth_protocol] http or https -# Optional. Defaults to http +# === Parameters +# +# [*auth_host*] +# (optional) The keystone host +# Defaults to 127.0.0.1 +# +# [*auth_port*] +# (optional) The Keystone client API port +# Defaults to 5000 +# +# [*auth_protocol*] +# (optional) http or https +# Defaults to http # # == Dependencies # @@ -27,7 +34,7 @@ $auth_protocol = 'http' ) { - include keystone::python + include ::keystone::python concat::fragment { 'swift_s3token': target => '/etc/swift/proxy-server.conf', diff --git a/swift/manifests/proxy/slo.pp b/swift/manifests/proxy/slo.pp index fef5799f4..20601be85 100644 --- a/swift/manifests/proxy/slo.pp +++ b/swift/manifests/proxy/slo.pp @@ -40,7 +40,6 @@ # # Copyright 2014 UnitedStack licensing@unitedstack.com # - class swift::proxy::slo ( $max_manifest_segments = '1000', $max_manifest_size = '2097152', diff --git a/swift/manifests/proxy/staticweb.pp b/swift/manifests/proxy/staticweb.pp index ad588f78f..3531751da 100644 --- a/swift/manifests/proxy/staticweb.pp +++ b/swift/manifests/proxy/staticweb.pp @@ -15,7 +15,6 @@ # # Copyright 2012 eNovance licensing@enovance.com # - class swift::proxy::staticweb() { concat::fragment { 'swift-proxy-staticweb': diff --git a/swift/manifests/proxy/swauth.pp b/swift/manifests/proxy/swauth.pp index 40de3cada..923e9b7e9 100644 --- a/swift/manifests/proxy/swauth.pp +++ b/swift/manifests/proxy/swauth.pp @@ -1,5 +1,20 @@ +# == Class: swift::proxy::swauth +# +# === Parameters: +# +# [*package_ensure*] +# The status of the python-swauth package. +# Defaults to 'present' +# # [*swauth_endpoint*] -# [*swauth_super_admin_user*] +# (optional) The endpoint used to autenticate to Swauth WSGI. +# Defaults to '127.0.0.1' +# +# [*swauth_super_admin_key*] +# (optional) The Swauth WSGI filter admin key. +# Defaults to 'swauthkey' +# +# class swift::proxy::swauth( $swauth_endpoint = '127.0.0.1', $swauth_super_admin_key = 'swauthkey', @@ -7,8 +22,8 @@ ) { package { 'python-swauth': - ensure => $package_ensure, - before => Package['swift-proxy'], + ensure => $package_ensure, + before => Package['swift-proxy'], } concat::fragment { 'swift_proxy_swauth': diff --git a/swift/manifests/proxy/swift3.pp b/swift/manifests/proxy/swift3.pp index 4396d6f3c..5eecba4f5 100644 --- a/swift/manifests/proxy/swift3.pp +++ b/swift/manifests/proxy/swift3.pp @@ -3,6 +3,12 @@ # # == Dependencies # +# == Parameters +# +# [*ensure*] +# Enable or not ceilometer fragment +# Defaults to 'present' +# # == Examples # # == Authors @@ -18,7 +24,7 @@ $ensure = 'present' ) { - include swift::params + include ::swift::params package { 'swift-plugin-s3': ensure => $ensure, diff --git a/swift/manifests/proxy/tempauth.pp b/swift/manifests/proxy/tempauth.pp index 29add9f1f..d87deb2bf 100644 --- a/swift/manifests/proxy/tempauth.pp +++ b/swift/manifests/proxy/tempauth.pp @@ -1,3 +1,5 @@ +# == class: swift::proxy::tempauth +# class swift::proxy::tempauth() { concat::fragment { 'swift-proxy-swauth': diff --git a/swift/manifests/proxy/tempurl.pp b/swift/manifests/proxy/tempurl.pp index d83c4d3e5..200337b1f 100644 --- a/swift/manifests/proxy/tempurl.pp +++ b/swift/manifests/proxy/tempurl.pp @@ -15,7 +15,6 @@ # # Copyright 2012 eNovance licensing@enovance.com # - class swift::proxy::tempurl() { concat::fragment { 'swift-proxy-tempurl': diff --git a/swift/manifests/ringbuilder/create.pp b/swift/manifests/ringbuilder/create.pp index a318f1e7b..a37f4c9c0 100644 --- a/swift/manifests/ringbuilder/create.pp +++ b/swift/manifests/ringbuilder/create.pp @@ -37,9 +37,9 @@ validate_re($name, '^object|container|account$') exec { "create_${name}": - command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}", - path => ['/usr/bin'], - creates => "/etc/swift/${name}.builder", + command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}", + path => ['/usr/bin'], + creates => "/etc/swift/${name}.builder", } } diff --git a/swift/manifests/ringserver.pp b/swift/manifests/ringserver.pp index a6973676e..9e6db0e2f 100644 --- a/swift/manifests/ringserver.pp +++ b/swift/manifests/ringserver.pp @@ -1,6 +1,15 @@ +# == Class: swift::ringserver +# # Used to create an rsync server to serve up the ring databases via rsync # -# == Parameters +# === Parameters +# +# [*local_net_ip*] +# (required) ip address that the swift servers should bind to. +# +# [*max_connections*] +# (optional) maximum connections to rsync server +# Defaults to 5 # # == Dependencies # @@ -21,10 +30,10 @@ $max_connections = 5 ) { - Class['ringbuilder'] -> Class['swift::ringserver'] + Class['swift::ringbuilder'] -> Class['swift::ringserver'] if !defined(Class['rsync::server']) { - class { 'rsync::server': + class { '::rsync::server': use_xinetd => true, address => $local_net_ip, use_chroot => 'no', diff --git a/swift/manifests/ringsync.pp b/swift/manifests/ringsync.pp index c84c5df55..bb956cc35 100644 --- a/swift/manifests/ringsync.pp +++ b/swift/manifests/ringsync.pp @@ -1,3 +1,5 @@ +# == Define: swift::ringsync +# define swift::ringsync( $ring_server ) { diff --git a/swift/manifests/storage.pp b/swift/manifests/storage.pp index 9bc6ac618..61b893d4b 100644 --- a/swift/manifests/storage.pp +++ b/swift/manifests/storage.pp @@ -24,7 +24,7 @@ ) { if !defined(Class['rsync::server']){ - class{ 'rsync::server': + class{ '::rsync::server': use_xinetd => true, address => $storage_local_net_ip, use_chroot => 'no', diff --git a/swift/manifests/storage/account.pp b/swift/manifests/storage/account.pp index a4398c3e2..3a66d6783 100644 --- a/swift/manifests/storage/account.pp +++ b/swift/manifests/storage/account.pp @@ -24,7 +24,7 @@ package_ensure => $package_ensure, } - include swift::params + include ::swift::params if $manage_service { if $enabled { @@ -35,18 +35,18 @@ } service { 'swift-account-reaper': - ensure => $service_ensure, - name => $::swift::params::account_reaper_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-account'], + ensure => $service_ensure, + name => $::swift::params::account_reaper_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-account'], } service { 'swift-account-auditor': - ensure => $service_ensure, - name => $::swift::params::account_auditor_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-account'], + ensure => $service_ensure, + name => $::swift::params::account_auditor_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-account'], } } diff --git a/swift/manifests/storage/all.pp b/swift/manifests/storage/all.pp index c1a77bb0f..9956c65ca 100644 --- a/swift/manifests/storage/all.pp +++ b/swift/manifests/storage/all.pp @@ -2,20 +2,49 @@ # configures all storage types # on the same node # -# [*storeage_local_net_ip*] ip address that the swift servers should +# [*storage_local_net_ip*] ip address that the swift servers should # bind to. Required +# # [*devices*] The path where the managed volumes can be found. # This assumes that all servers use the same path. # Optional. Defaults to /srv/node/ +# # [*object_port*] Port where object storage server should be hosted. # Optional. Defaults to 6000. +# # [*allow_versions*] Boolean to enable the versioning in swift container # Optional. Default to false. +# # [*container_port*] Port where the container storage server should be hosted. # Optional. Defaults to 6001. +# # [*account_port*] Port where the account storage server should be hosted. # Optional. Defaults to 6002. # +# [*object_pipeline*] +# (optional) Specify the object pipeline +# Defaults to undef +# +# [*container_pipeline*] +# (optional) Specify the container pipeline +# Defaults to undef +# +# [*allow_versions*] +# (optional) Enable/Disable object versioning feature +# Defaults to false +# +# [*mount_check*] +# (optional) Whether or not check if the devices are mounted +# to prevent accidentally writing to the root device +# Defaults to false +# +# [*account_pipeline*] +# (optional) Specify the account pipeline +# Defaults to undef +# +# [*log_facility*] +# (optional) Syslog log facility +# Defaults to 'LOG_LOCAL2' # class swift::storage::all( $storage_local_net_ip, @@ -31,7 +60,7 @@ $log_facility = 'LOG_LOCAL2' ) { - class { 'swift::storage': + class { '::swift::storage': storage_local_net_ip => $storage_local_net_ip, } diff --git a/swift/manifests/storage/container.pp b/swift/manifests/storage/container.pp index 741dcba0f..f11bc03b8 100644 --- a/swift/manifests/storage/container.pp +++ b/swift/manifests/storage/container.pp @@ -1,5 +1,6 @@ # # === Parameters +# # [*enabled*] # (optional) Should the service be enabled. # Defaults to true @@ -25,10 +26,10 @@ swift::storage::generic { 'container': manage_service => $manage_service, enabled => $enabled, - package_ensure => $package_ensure + package_ensure => $package_ensure, } - include swift::params + include ::swift::params if $manage_service { if $enabled { @@ -39,19 +40,19 @@ } service { 'swift-container-updater': - ensure => $service_ensure, - name => $::swift::params::container_updater_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-container'], + ensure => $service_ensure, + name => $::swift::params::container_updater_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-container'], } service { 'swift-container-auditor': - ensure => $service_ensure, - name => $::swift::params::container_auditor_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-container'], + ensure => $service_ensure, + name => $::swift::params::container_auditor_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-container'], } if $::operatingsystem == 'Ubuntu' { @@ -65,10 +66,10 @@ target => '/lib/init/upstart-job', } service { 'swift-container-sync': - ensure => $service_ensure, - enable => $enabled, - provider => $::swift::params::service_provider, - require => File['/etc/init/swift-container-sync.conf', '/etc/init.d/swift-container-sync'] + ensure => $service_ensure, + enable => $enabled, + provider => $::swift::params::service_provider, + require => File['/etc/init/swift-container-sync.conf', '/etc/init.d/swift-container-sync'], } } } diff --git a/swift/manifests/storage/disk.pp b/swift/manifests/storage/disk.pp index ea3109a98..85c7c1574 100644 --- a/swift/manifests/storage/disk.pp +++ b/swift/manifests/storage/disk.pp @@ -31,7 +31,7 @@ # } # # TODO(yuxcer): maybe we can remove param $base_dir - +# define swift::storage::disk( $base_dir = '/dev', $mnt_base_dir = '/srv/node', @@ -47,9 +47,9 @@ } exec { "create_partition_label-${name}": - command => "parted -s ${base_dir}/${name} mklabel gpt", - path => ['/usr/bin/', '/sbin','/bin'], - onlyif => ["test -b ${base_dir}/${name}","parted ${base_dir}/${name} print|tail -1|grep 'Error'"], + command => "parted -s ${base_dir}/${name} mklabel gpt", + path => ['/usr/bin/', '/sbin','/bin'], + onlyif => ["test -b ${base_dir}/${name}","parted ${base_dir}/${name} print|tail -1|grep 'Error'"], } swift::storage::xfs { $name: diff --git a/swift/manifests/storage/ext4.pp b/swift/manifests/storage/ext4.pp index 24879140c..a866445b9 100644 --- a/swift/manifests/storage/ext4.pp +++ b/swift/manifests/storage/ext4.pp @@ -26,11 +26,11 @@ } swift::storage::mount { $name: - device => $device, - mnt_base_dir => $mnt_base_dir, - subscribe => Exec["mkfs-${name}"], - loopback => $loopback, - fstype => 'ext4', + device => $device, + mnt_base_dir => $mnt_base_dir, + subscribe => Exec["mkfs-${name}"], + loopback => $loopback, + fstype => 'ext4', } } diff --git a/swift/manifests/storage/generic.pp b/swift/manifests/storage/generic.pp index 341bc5af9..928d52e97 100644 --- a/swift/manifests/storage/generic.pp +++ b/swift/manifests/storage/generic.pp @@ -35,7 +35,7 @@ $service_provider = $::swift::params::service_provider ) { - include swift::params + include ::swift::params Class['swift::storage'] -> Swift::Storage::Generic[$name] diff --git a/swift/manifests/storage/loopback.pp b/swift/manifests/storage/loopback.pp index 323fb015b..4972764ec 100644 --- a/swift/manifests/storage/loopback.pp +++ b/swift/manifests/storage/loopback.pp @@ -29,10 +29,10 @@ } exec { "create_partition-${name}": - command => "dd if=/dev/zero of=${base_dir}/${name} bs=${byte_size} count=0 seek=${seek}", - path => ['/usr/bin/', '/bin'], - unless => "test -f ${base_dir}/${name}", - require => File[$base_dir], + command => "dd if=/dev/zero of=${base_dir}/${name} bs=${byte_size} count=0 seek=${seek}", + path => ['/usr/bin/', '/bin'], + unless => "test -f ${base_dir}/${name}", + require => File[$base_dir], } $storage_params = { diff --git a/swift/manifests/storage/mount.pp b/swift/manifests/storage/mount.pp index 3a23cff9b..a9f23a015 100644 --- a/swift/manifests/storage/mount.pp +++ b/swift/manifests/storage/mount.pp @@ -35,7 +35,7 @@ device => $device, fstype => $fstype, options => "${options},${fsoptions}", - require => File["${mnt_base_dir}/${name}"] + require => File["${mnt_base_dir}/${name}"], } # double checks to make sure that things are mounted diff --git a/swift/manifests/storage/node.pp b/swift/manifests/storage/node.pp index 9c105e1a4..7f7608db0 100644 --- a/swift/manifests/storage/node.pp +++ b/swift/manifests/storage/node.pp @@ -30,8 +30,8 @@ config_file_path => 'object-server.conf', } ring_object_device { "${storage_local_net_ip}:60${name}0/${name}": - zone => $zone, - weight => $weight, + zone => $zone, + weight => $weight, } swift::storage::server { "60${name}1": @@ -39,8 +39,8 @@ config_file_path => 'container-server.conf', } ring_container_device { "${storage_local_net_ip}:60${name}1/${name}": - zone => $zone, - weight => $weight, + zone => $zone, + weight => $weight, } swift::storage::server { "60${name}2": @@ -48,8 +48,8 @@ config_file_path => 'account-server.conf', } ring_account_device { "${storage_local_net_ip}:60${name}2/${name}": - zone => $zone, - weight => $weight, + zone => $zone, + weight => $weight, } } diff --git a/swift/manifests/storage/object.pp b/swift/manifests/storage/object.pp index 587c60aa3..2055843df 100644 --- a/swift/manifests/storage/object.pp +++ b/swift/manifests/storage/object.pp @@ -21,10 +21,10 @@ swift::storage::generic { 'object': manage_service => $manage_service, enabled => $enabled, - package_ensure => $package_ensure + package_ensure => $package_ensure, } - include swift::params + include ::swift::params if $manage_service { if $enabled { @@ -35,18 +35,18 @@ } service { 'swift-object-updater': - ensure => $service_ensure, - name => $::swift::params::object_updater_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-object'], + ensure => $service_ensure, + name => $::swift::params::object_updater_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-object'], } service { 'swift-object-auditor': - ensure => $service_ensure, - name => $::swift::params::object_auditor_service_name, - enable => $enabled, - provider => $::swift::params::service_provider, - require => Package['swift-object'], + ensure => $service_ensure, + name => $::swift::params::object_auditor_service_name, + enable => $enabled, + provider => $::swift::params::service_provider, + require => Package['swift-object'], } } diff --git a/swift/manifests/storage/server.pp b/swift/manifests/storage/server.pp index 391f79c00..389910d08 100644 --- a/swift/manifests/storage/server.pp +++ b/swift/manifests/storage/server.pp @@ -60,8 +60,8 @@ warning("swift storage server ${type} must specify ${type}-server") } - include "swift::storage::${type}" - include concat::setup + include "::swift::storage::${type}" + include ::concat::setup validate_re($name, '^\d+$') validate_re($type, '^object|container|account$') diff --git a/swift/manifests/storage/xfs.pp b/swift/manifests/storage/xfs.pp index 11224c50e..dc77942d8 100644 --- a/swift/manifests/storage/xfs.pp +++ b/swift/manifests/storage/xfs.pp @@ -22,7 +22,7 @@ $loopback = false ) { - include swift::xfs + include ::swift::xfs if $device == '' { $target_device = "/dev/${name}" @@ -50,10 +50,10 @@ } swift::storage::mount { $name: - device => $target_device, - mnt_base_dir => $mnt_base_dir, - subscribe => Exec["mkfs-${name}"], - loopback => $loopback, + device => $target_device, + mnt_base_dir => $mnt_base_dir, + subscribe => Exec["mkfs-${name}"], + loopback => $loopback, } } diff --git a/swift/manifests/test_file.pp b/swift/manifests/test_file.pp index 8dd5e0861..c515f5be2 100644 --- a/swift/manifests/test_file.pp +++ b/swift/manifests/test_file.pp @@ -38,6 +38,6 @@ ) { file { '/tmp/swift_test_file.rb': mode => '0755', - content => template('swift/swift_keystone_test.erb') + content => template('swift/swift_keystone_test.erb'), } } diff --git a/swift/metadata.json b/swift/metadata.json index 4273eeb0d..6b1886470 100644 --- a/swift/metadata.json +++ b/swift/metadata.json @@ -3,7 +3,7 @@ "version": "5.0.0", "author": "Puppet Labs and StackForge Contributors", "summary": "Puppet module for OpenStack Swift", - "license": "Apache License 2.0", + "license": "Apache-2.0", "source": "git://github.com/stackforge/puppet-swift.git", "project_page": "https://launchpad.net/puppet-swift", "issues_url": "https://bugs.launchpad.net/puppet-swift", diff --git a/swift/spec/classes/swift_bench_spec.rb b/swift/spec/classes/swift_bench_spec.rb index a2e3cb380..66c2115ee 100644 --- a/swift/spec/classes/swift_bench_spec.rb +++ b/swift/spec/classes/swift_bench_spec.rb @@ -38,41 +38,41 @@ let (:p) { default_params.merge!(params) } it 'depends on swift package' do - should contain_package('swift').with_before(/Swift_bench_config\[.+\]/) + is_expected.to contain_package('swift').with_before(/Swift_bench_config\[.+\]/) end it 'configures swift-bench.conf' do - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/auth').with_value(p[:auth_url]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/user').with_value(p[:swift_user]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/key').with_value(p[:swift_key]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/auth_version').with_value(p[:auth_version]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/log-level').with_value(p[:log_level]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/timeout').with_value(p[:test_timeout]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/put_concurrency').with_value(p[:put_concurrency]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/get_concurrency').with_value(p[:get_concurrency]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/get_concurrency').with_value(p[:get_concurrency]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/lower_object_size').with_value(p[:lower_object_size]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/upper_object_size').with_value(p[:upper_object_size]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/object_size').with_value(p[:object_size]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/num_objects').with_value(p[:num_objects]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/num_gets').with_value(p[:num_gets]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/num_containers').with_value(p[:num_containers]) - should contain_swift_bench_config( + is_expected.to contain_swift_bench_config( 'bench/delete').with_value(p[:delete]) end end diff --git a/swift/spec/classes/swift_client_spec.rb b/swift/spec/classes/swift_client_spec.rb index fb20c0ad4..06e1e68fd 100644 --- a/swift/spec/classes/swift_client_spec.rb +++ b/swift/spec/classes/swift_client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'swift::client' do - it { should contain_package('swiftclient').with( + it { is_expected.to contain_package('swiftclient').with( :ensure => 'present', :name => 'python-swiftclient' )} @@ -12,7 +12,7 @@ let :params do {:ensure => 'latest'} end - it { should contain_package('swiftclient').with( + it { is_expected.to contain_package('swiftclient').with( :ensure => 'latest', :name => 'python-swiftclient' )} diff --git a/swift/spec/classes/swift_dispersion_spec.rb b/swift/spec/classes/swift_dispersion_spec.rb index 947d2a386..00235c6b6 100644 --- a/swift/spec/classes/swift_dispersion_spec.rb +++ b/swift/spec/classes/swift_dispersion_spec.rb @@ -28,8 +28,8 @@ {} end - it { should contain_file('/etc/swift/dispersion.conf').with( - :ensure => 'present', + it { is_expected.to contain_file('/etc/swift/dispersion.conf').with( + :ensure => 'file', :owner => 'swift', :group => 'swift', :mode => '0660', @@ -40,34 +40,34 @@ let (:p) { default_params.merge!(params) } it 'depends on swift package' do - should contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/) + is_expected.to contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/) end it 'configures dispersion.conf' do - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/auth_url').with_value(p[:auth_url]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/auth_version').with_value(p[:auth_version]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/auth_user').with_value("#{p[:auth_tenant]}:#{p[:auth_user]}") - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/auth_key').with_value(p[:auth_pass]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/endpoint_type').with_value(p[:endpoint_type]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/swift_dir').with_value(p[:swift_dir]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/dispersion_coverage').with_value(p[:coverage]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/retries').with_value(p[:retries]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/concurrency').with_value(p[:concurrency]) - should contain_swift_dispersion_config( + is_expected.to contain_swift_dispersion_config( 'dispersion/dump_json').with_value(p[:dump_json]) end it 'triggers swift-dispersion-populate' do - should contain_exec('swift-dispersion-populate').with( + is_expected.to contain_exec('swift-dispersion-populate').with( :path => ['/bin', '/usr/bin'], :subscribe => 'File[/etc/swift/dispersion.conf]', :onlyif => "swift -A #{p[:auth_url]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '", diff --git a/swift/spec/classes/swift_keystone_auth_spec.rb b/swift/spec/classes/swift_keystone_auth_spec.rb index 4d628616b..1e1e4960a 100644 --- a/swift/spec/classes/swift_keystone_auth_spec.rb +++ b/swift/spec/classes/swift_keystone_auth_spec.rb @@ -30,7 +30,7 @@ it_configures 'keystone auth configuration' ['admin', 'SwiftOperator'].each do |role_name| - it { should contain_keystone_role(role_name).with_ensure('present') } + it { is_expected.to contain_keystone_role(role_name).with_ensure('present') } end end @@ -58,7 +58,7 @@ it_configures 'keystone auth configuration' ['admin', 'SwiftOperator', 'Gopher'].each do |role_name| - it { should contain_keystone_role(role_name).with_ensure('present') } + it { is_expected.to contain_keystone_role(role_name).with_ensure('present') } end end @@ -67,7 +67,7 @@ params.merge!(:configure_endpoint => false) end - it { should_not contain_keystone_endpoint('RegionOne/swift') } + it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift') } end context 'when disabling S3 endpoint' do @@ -75,8 +75,8 @@ params.merge!(:configure_s3_endpoint => false) end - it { should_not contain_keystone_service('swift_s3') } - it { should_not contain_keystone_endpoint('RegionOne/swift_s3') } + it { is_expected.to_not contain_keystone_service('swift_s3') } + it { is_expected.to_not contain_keystone_endpoint('RegionOne/swift_s3') } end end @@ -85,37 +85,37 @@ default_params.merge( params ) end - it { should contain_keystone_user(p[:auth_name]).with( + it { is_expected.to contain_keystone_user(p[:auth_name]).with( :ensure => 'present', :password => p[:password], :email => p[:email] )} - it { should contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with( + it { is_expected.to contain_keystone_user_role("#{p[:auth_name]}@#{p[:tenant]}").with( :ensure => 'present', :roles => 'admin', )} - it { should contain_keystone_service(p[:auth_name]).with( + it { is_expected.to contain_keystone_service(p[:auth_name]).with( :ensure => 'present', :type => 'object-store', :description => 'Openstack Object-Store Service' )} - it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with( + it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}").with( :ensure => 'present', :public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s", :admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}/", :internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s" )} - it { should contain_keystone_service("#{p[:auth_name]}_s3").with( + it { is_expected.to contain_keystone_service("#{p[:auth_name]}_s3").with( :ensure => 'present', :type => 's3', :description => 'Openstack S3 Service' )} - it { should contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with( + it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:auth_name]}_s3").with( :ensure => 'present', :public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}", :admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}", diff --git a/swift/spec/classes/swift_keystone_dispersion_spec.rb b/swift/spec/classes/swift_keystone_dispersion_spec.rb index 61d111b53..8ab7891a0 100644 --- a/swift/spec/classes/swift_keystone_dispersion_spec.rb +++ b/swift/spec/classes/swift_keystone_dispersion_spec.rb @@ -4,14 +4,14 @@ describe 'with default class parameters' do - it { should contain_keystone_user('dispersion').with( + it { is_expected.to contain_keystone_user('dispersion').with( :ensure => 'present', :password => 'dispersion_password', :email => 'swift@localhost', :tenant => 'services' ) } - it { should contain_keystone_user_role('dispersion@services').with( + it { is_expected.to contain_keystone_user_role('dispersion@services').with( :ensure => 'present', :roles => 'admin', :require => 'Keystone_user[dispersion]' @@ -29,14 +29,14 @@ } end - it { should contain_keystone_user('bar').with( + it { is_expected.to contain_keystone_user('bar').with( :ensure => 'present', :password => 'foo', :email => 'bar@example.com', :tenant => 'dummyTenant' ) } - it { should contain_keystone_user_role('bar@dummyTenant') } + it { is_expected.to contain_keystone_user_role('bar@dummyTenant') } end diff --git a/swift/spec/classes/swift_proxy_account_quotas_spec.rb b/swift/spec/classes/swift_proxy_account_quotas_spec.rb index 99b4d1574..338978172 100644 --- a/swift/spec/classes/swift_proxy_account_quotas_spec.rb +++ b/swift/spec/classes/swift_proxy_account_quotas_spec.rb @@ -35,7 +35,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_account_quotas" end - it { should contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) } + it { is_expected.to contain_file(fragment_file).with_content(/\[filter:account_quotas\]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) } end diff --git a/swift/spec/classes/swift_proxy_authtoken_spec.rb b/swift/spec/classes/swift_proxy_authtoken_spec.rb index 2188f7c3a..2ab821e4f 100644 --- a/swift/spec/classes/swift_proxy_authtoken_spec.rb +++ b/swift/spec/classes/swift_proxy_authtoken_spec.rb @@ -21,7 +21,7 @@ :group => 'swift', } end - it {should contain_file('/var/cache/swift').with( + it {is_expected.to contain_file('/var/cache/swift').with( {:ensure => 'directory'}.merge(file_defaults) )} end @@ -32,7 +32,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:authtoken]', 'log_name = swift', @@ -61,7 +61,7 @@ end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:authtoken]', 'log_name = swift', @@ -97,7 +97,7 @@ end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:authtoken]', 'log_name = swift', @@ -124,7 +124,7 @@ { :auth_uri => 'http://public.host/keystone/main' } end - it { should contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)} + it { is_expected.to contain_file(fragment_file).with_content(/auth_uri = http:\/\/public.host\/keystone\/main/)} end [ @@ -140,7 +140,7 @@ { :auth_admin_prefix => auth_admin_prefix } end - it { expect { should contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \ + it { expect { is_expected.to contain_file(fragment_file).with_content(/auth_admin_prefix = #{auth_admin_prefix}/) }.to \ raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) } end end @@ -153,7 +153,7 @@ end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:authtoken]', 'log_name = swift', @@ -183,7 +183,7 @@ end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:authtoken]', 'log_name = swift', diff --git a/swift/spec/classes/swift_proxy_bulk_spec.rb b/swift/spec/classes/swift_proxy_bulk_spec.rb index 4bcf014b9..0b72ec72b 100644 --- a/swift/spec/classes/swift_proxy_bulk_spec.rb +++ b/swift/spec/classes/swift_proxy_bulk_spec.rb @@ -37,7 +37,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:bulk]', 'use = egg:swift#bulk', @@ -60,7 +60,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:bulk]', 'use = egg:swift#bulk', diff --git a/swift/spec/classes/swift_proxy_cache_spec.rb b/swift/spec/classes/swift_proxy_cache_spec.rb index c3520ddd0..531af8225 100644 --- a/swift/spec/classes/swift_proxy_cache_spec.rb +++ b/swift/spec/classes/swift_proxy_cache_spec.rb @@ -20,12 +20,12 @@ class { "memcached": max_memory => 1 }' "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/23_swift_cache" end - it { should contain_file(fragment_file).with_content(/[filter:cache]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#memcache/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:cache]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#memcache/) } describe 'with defaults' do - it { should contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) } + it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 127\.0\.0\.1:11211/) } end @@ -35,7 +35,7 @@ class { "memcached": max_memory => 1 }' {:memcache_servers => '10.0.0.1:1'} end - it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) } + it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1/) } end @@ -45,7 +45,7 @@ class { "memcached": max_memory => 1 }' {:memcache_servers => ['10.0.0.1:1', '10.0.0.2:2']} end - it { should contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) } + it { is_expected.to contain_file(fragment_file).with_content(/memcache_servers = 10\.0\.0\.1:1,10\.0\.0\.2:2/) } end diff --git a/swift/spec/classes/swift_proxy_catch_errors_spec.rb b/swift/spec/classes/swift_proxy_catch_errors_spec.rb index 69bd74d8d..b36645ece 100644 --- a/swift/spec/classes/swift_proxy_catch_errors_spec.rb +++ b/swift/spec/classes/swift_proxy_catch_errors_spec.rb @@ -15,7 +15,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/24_swift_catch_errors" end - it { should contain_file(fragment_file).with_content(/[filter:catch_errors]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:catch_errors]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#catch_errors/) } end diff --git a/swift/spec/classes/swift_proxy_ceilometer_spec.rb b/swift/spec/classes/swift_proxy_ceilometer_spec.rb index 2f05184f2..6b010ff44 100644 --- a/swift/spec/classes/swift_proxy_ceilometer_spec.rb +++ b/swift/spec/classes/swift_proxy_ceilometer_spec.rb @@ -21,10 +21,10 @@ class { "swift": "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer" end - it { should contain_file(fragment_file).with_content(/[filter:ceilometer]/) } - it { should contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) } - it { should contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') } - it { should contain_user('swift').with_groups('ceilometer') } - it { should contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) } + it { is_expected.to contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') } + it { is_expected.to contain_user('swift').with_groups('ceilometer') } + it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') } end diff --git a/swift/spec/classes/swift_proxy_container_quotas_spec.rb b/swift/spec/classes/swift_proxy_container_quotas_spec.rb index fc7f8bc1e..de8426ffe 100644 --- a/swift/spec/classes/swift_proxy_container_quotas_spec.rb +++ b/swift/spec/classes/swift_proxy_container_quotas_spec.rb @@ -35,7 +35,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_container_quotas" end - it { should contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) } + it { is_expected.to contain_file(fragment_file).with_content(/\[filter:container_quotas\]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) } end diff --git a/swift/spec/classes/swift_proxy_crossdomain_spec.rb b/swift/spec/classes/swift_proxy_crossdomain_spec.rb index 8e56ce3f8..bc7f38403 100644 --- a/swift/spec/classes/swift_proxy_crossdomain_spec.rb +++ b/swift/spec/classes/swift_proxy_crossdomain_spec.rb @@ -17,7 +17,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:crossdomain]', 'use = egg:swift#crossdomain', @@ -35,7 +35,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:crossdomain]', 'use = egg:swift#crossdomain', diff --git a/swift/spec/classes/swift_proxy_formpost_spec.rb b/swift/spec/classes/swift_proxy_formpost_spec.rb index 38c05d67b..2d50a0c16 100644 --- a/swift/spec/classes/swift_proxy_formpost_spec.rb +++ b/swift/spec/classes/swift_proxy_formpost_spec.rb @@ -15,7 +15,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/31_swift-proxy-formpost" end - it { should contain_file(fragment_file).with_content(/[filter:formpost]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#formpost/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:formpost]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#formpost/) } end diff --git a/swift/spec/classes/swift_proxy_gatekeeper_spec.rb b/swift/spec/classes/swift_proxy_gatekeeper_spec.rb index 8e629f646..200457ac8 100644 --- a/swift/spec/classes/swift_proxy_gatekeeper_spec.rb +++ b/swift/spec/classes/swift_proxy_gatekeeper_spec.rb @@ -17,7 +17,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:gatekeeper]', 'use = egg:swift#gatekeeper', @@ -40,7 +40,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:gatekeeper]', 'use = egg:swift#gatekeeper', diff --git a/swift/spec/classes/swift_proxy_healthcheck_spec.rb b/swift/spec/classes/swift_proxy_healthcheck_spec.rb index abc086afb..4db55f636 100644 --- a/swift/spec/classes/swift_proxy_healthcheck_spec.rb +++ b/swift/spec/classes/swift_proxy_healthcheck_spec.rb @@ -15,7 +15,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/25_swift_healthcheck" end - it { should contain_file(fragment_file).with_content(/[filter:healthcheck]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:healthcheck]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#healthcheck/) } end diff --git a/swift/spec/classes/swift_proxy_keystone_spec.rb b/swift/spec/classes/swift_proxy_keystone_spec.rb index 7c21bf7e3..ee1594893 100644 --- a/swift/spec/classes/swift_proxy_keystone_spec.rb +++ b/swift/spec/classes/swift_proxy_keystone_spec.rb @@ -17,15 +17,15 @@ ' end - it { should contain_file(fragment_file).with_content(/[filter:keystone]/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:keystone]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#keystoneauth/) } describe 'with defaults' do - it { should contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) } - it { should contain_file(fragment_file).with_content(/is_admin = true/) } - it { should contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) } + it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = admin, SwiftOperator/) } + it { is_expected.to contain_file(fragment_file).with_content(/is_admin = true/) } + it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = AUTH_/) } end @@ -38,9 +38,9 @@ :reseller_prefix => 'SWIFT_' } - it { should contain_file(fragment_file).with_content(/operator_roles = foo/) } - it { should contain_file(fragment_file).with_content(/is_admin = false/) } - it { should contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) } + it { is_expected.to contain_file(fragment_file).with_content(/operator_roles = foo/) } + it { is_expected.to contain_file(fragment_file).with_content(/is_admin = false/) } + it { is_expected.to contain_file(fragment_file).with_content(/reseller_prefix = SWIFT_/) } end diff --git a/swift/spec/classes/swift_proxy_ratelimit_spec.rb b/swift/spec/classes/swift_proxy_ratelimit_spec.rb index 4c9550dba..ed462d433 100644 --- a/swift/spec/classes/swift_proxy_ratelimit_spec.rb +++ b/swift/spec/classes/swift_proxy_ratelimit_spec.rb @@ -17,7 +17,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:ratelimit]', 'use = egg:swift#ratelimit', @@ -42,7 +42,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:ratelimit]', 'use = egg:swift#ratelimit', diff --git a/swift/spec/classes/swift_proxy_s3token_spec.rb b/swift/spec/classes/swift_proxy_s3token_spec.rb index 54baab8b7..8f6793f7d 100644 --- a/swift/spec/classes/swift_proxy_s3token_spec.rb +++ b/swift/spec/classes/swift_proxy_s3token_spec.rb @@ -15,11 +15,11 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/28_swift_s3token" end - it { should contain_class('keystone::python') } + it { is_expected.to contain_class('keystone::python') } describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:s3token]', 'paste.filter_factory = keystonemiddleware.s3_token:filter_factory', @@ -40,7 +40,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:s3token]', 'paste.filter_factory = keystonemiddleware.s3_token:filter_factory', diff --git a/swift/spec/classes/swift_proxy_slo_spec.rb b/swift/spec/classes/swift_proxy_slo_spec.rb index 43f05c2d5..7f063d8ee 100644 --- a/swift/spec/classes/swift_proxy_slo_spec.rb +++ b/swift/spec/classes/swift_proxy_slo_spec.rb @@ -17,7 +17,7 @@ describe "when using default parameters" do it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:slo]', 'use = egg:swift#slo', @@ -42,7 +42,7 @@ } end it 'should build the fragment with correct parameters' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:slo]', 'use = egg:swift#slo', diff --git a/swift/spec/classes/swift_proxy_spec.rb b/swift/spec/classes/swift_proxy_spec.rb index 8ff19283e..78362cc86 100644 --- a/swift/spec/classes/swift_proxy_spec.rb +++ b/swift/spec/classes/swift_proxy_spec.rb @@ -4,7 +4,7 @@ describe 'without memcached being included' do it 'should raise an error' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end @@ -28,9 +28,7 @@ class { swift: swift_hash_suffix => string }" end describe 'without the proxy local network ip address being specified' do - it "should fail" do - expect { subject }.to raise_error(Puppet::Error, /Must pass proxy_local_net_ip/) - end + it_raises 'a Puppet::Error', /Must pass proxy_local_net_ip/ end describe 'when proxy_local_net_ip is set' do @@ -39,7 +37,7 @@ class { swift: swift_hash_suffix => string }" {:proxy_local_net_ip => '127.0.0.1'} end - it { should contain_service('swift-proxy').with( + it { is_expected.to contain_service('swift-proxy').with( {:ensure => 'running', :provider => 'upstart', :enable => true, @@ -47,7 +45,7 @@ class { swift: swift_hash_suffix => string }" :subscribe => 'Concat[/etc/swift/proxy-server.conf]' } )} - it { should contain_file('/etc/swift/proxy-server.conf').with( + it { is_expected.to contain_file('/etc/swift/proxy-server.conf').with( {:ensure => 'present', :owner => 'swift', :group => 'swift', @@ -56,7 +54,7 @@ class { swift: swift_hash_suffix => string }" )} it 'should build the header file with all of the default contents' do - verify_contents(subject, fragment_path, + verify_contents(catalogue, fragment_path, [ '[DEFAULT]', 'bind_port = 8080', @@ -80,7 +78,7 @@ class { swift: swift_hash_suffix => string }" ] ) end - it { should contain_concat__fragment('swift_proxy').with_before( + it { is_expected.to contain_concat__fragment('swift_proxy').with_before( [ 'Class[Swift::Proxy::Healthcheck]', 'Class[Swift::Proxy::Cache]', @@ -102,10 +100,11 @@ class { swift: swift_hash_suffix => string }" :read_affinity => 'r1z1=100, r1=200', :write_affinity => 'r1', :write_affinity_node_count => '2 * replicas', + :node_timeout => '20', } end it 'should build the header file with provided values' do - verify_contents(subject, fragment_path, + verify_contents(catalogue, fragment_path, [ '[DEFAULT]', 'bind_port = 80', @@ -121,11 +120,12 @@ class { swift: swift_hash_suffix => string }" 'account_autocreate = false', 'read_affinity = r1z1=100, r1=200', 'write_affinity = r1', - 'write_affinity_node_count = 2 * replicas' + 'write_affinity_node_count = 2 * replicas', + 'node_timeout = 20' ] ) end - it { should contain_concat__fragment('swift_proxy').with_before( + it { is_expected.to contain_concat__fragment('swift_proxy').with_before( 'Class[Swift::Proxy::Swauth]' )} end @@ -134,7 +134,7 @@ class { swift: swift_hash_suffix => string }" [:account_autocreate, :allow_account_management].each do |param| it "should fail when #{param} is not passed a boolean" do params[param] = 'false' - expect { subject }.to raise_error(Puppet::Error, /is not a boolean/) + expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/) end end @@ -146,7 +146,7 @@ class { swift: swift_hash_suffix => string }" end it "should fail if write_affinity_node_count is used without write_affinity" do - expect { subject }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/) + expect { catalogue }.to raise_error(Puppet::Error, /write_affinity_node_count requires write_affinity/) end end end @@ -159,13 +159,13 @@ class { swift: swift_hash_suffix => string }" [{ :enabled => true, :manage_service => true }, { :enabled => false, :manage_service => true }].each do |param_hash| - context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do + context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do before do params.merge!(param_hash) end it 'configures swift-proxy service' do - should contain_service('swift-proxy').with( + is_expected.to contain_service('swift-proxy').with( :ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped', :name => platform_params[:service_name], :provider => platform_params[:service_provider], @@ -185,7 +185,7 @@ class { swift: swift_hash_suffix => string }" end it 'configures swift-proxy service' do - should contain_service('swift-proxy').with( + is_expected.to contain_service('swift-proxy').with( :ensure => nil, :name => platform_params[:service_name], :provider => platform_params[:service_provider], diff --git a/swift/spec/classes/swift_proxy_staticweb_spec.rb b/swift/spec/classes/swift_proxy_staticweb_spec.rb index f98000cd7..7cff74ff9 100644 --- a/swift/spec/classes/swift_proxy_staticweb_spec.rb +++ b/swift/spec/classes/swift_proxy_staticweb_spec.rb @@ -15,7 +15,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/32_swift-proxy-staticweb" end - it { should contain_file(fragment_file).with_content(/[filter:staticweb]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:staticweb]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#staticweb/) } end diff --git a/swift/spec/classes/swift_proxy_swauth_spec.rb b/swift/spec/classes/swift_proxy_swauth_spec.rb index 528d3c28d..514d1a10a 100644 --- a/swift/spec/classes/swift_proxy_swauth_spec.rb +++ b/swift/spec/classes/swift_proxy_swauth_spec.rb @@ -15,15 +15,15 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/20_swift_proxy_swauth" end - it { should contain_package('python-swauth').with_ensure('present') } + it { is_expected.to contain_package('python-swauth').with_ensure('present') } - it { should contain_file(fragment_file).with_content(/[filter:swauth]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:swauth]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swauth#swauth/) } describe 'with defaults' do - it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) } - it { should contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) } + it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#127\.0\.0\.1/) } + it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = swauthkey/) } end @@ -35,9 +35,9 @@ :package_ensure => 'latest' } end - it { should contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) } - it { should contain_file(fragment_file).with_content(/super_admin_key = foo/) } - it { should contain_package('python-swauth').with_ensure('latest') } + it { is_expected.to contain_file(fragment_file).with_content(/default_swift_cluster = local#10\.0\.0\.1/) } + it { is_expected.to contain_file(fragment_file).with_content(/super_admin_key = foo/) } + it { is_expected.to contain_package('python-swauth').with_ensure('latest') } end diff --git a/swift/spec/classes/swift_proxy_swift3_spec.rb b/swift/spec/classes/swift_proxy_swift3_spec.rb index f31ac5081..376ead72b 100644 --- a/swift/spec/classes/swift_proxy_swift3_spec.rb +++ b/swift/spec/classes/swift_proxy_swift3_spec.rb @@ -16,7 +16,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/27_swift_swift3" end - it { should contain_file(fragment_file).with_content(/[filter:swift3]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:swift3]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) } end diff --git a/swift/spec/classes/swift_proxy_tempurl_spec.rb b/swift/spec/classes/swift_proxy_tempurl_spec.rb index 3b00c9952..f007d87aa 100644 --- a/swift/spec/classes/swift_proxy_tempurl_spec.rb +++ b/swift/spec/classes/swift_proxy_tempurl_spec.rb @@ -15,7 +15,7 @@ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/29_swift-proxy-tempurl" end - it { should contain_file(fragment_file).with_content(/[filter:tempurl]/) } - it { should contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) } + it { is_expected.to contain_file(fragment_file).with_content(/[filter:tempurl]/) } + it { is_expected.to contain_file(fragment_file).with_content(/use = egg:swift#tempurl/) } end diff --git a/swift/spec/classes/swift_ringbuilder_spec.rb b/swift/spec/classes/swift_ringbuilder_spec.rb index 9f7c65dae..5c5b5b9ec 100644 --- a/swift/spec/classes/swift_ringbuilder_spec.rb +++ b/swift/spec/classes/swift_ringbuilder_spec.rb @@ -10,7 +10,7 @@ end describe 'when swift class is not included' do it 'should fail' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end describe 'when swift class is included' do @@ -21,14 +21,14 @@ class { swift: swift_hash_suffix => string }" end it 'should rebalance the ring for all ring types' do - should contain_swift__ringbuilder__rebalance('object') - should contain_swift__ringbuilder__rebalance('account') - should contain_swift__ringbuilder__rebalance('container') + is_expected.to contain_swift__ringbuilder__rebalance('object') + is_expected.to contain_swift__ringbuilder__rebalance('account') + is_expected.to contain_swift__ringbuilder__rebalance('container') end describe 'with default parameters' do ['object', 'account', 'container'].each do |type| - it { should contain_swift__ringbuilder__create(type).with( + it { is_expected.to contain_swift__ringbuilder__create(type).with( :part_power => '18', :replicas => '3', :min_part_hours => '24' @@ -46,7 +46,7 @@ class { swift: swift_hash_suffix => string }" end ['object', 'account', 'container'].each do |type| - it { should contain_swift__ringbuilder__create(type).with( + it { is_expected.to contain_swift__ringbuilder__create(type).with( :part_power => '19', :replicas => '3', :min_part_hours => '2' @@ -75,22 +75,22 @@ class { swift: swift_hash_suffix => string } end it 'should set up all of the correct dependencies' do - should contain_swift__ringbuilder__create('object').with( + is_expected.to contain_swift__ringbuilder__create('object').with( {:before => 'Ring_object_device[127.0.0.1:6000/1]'} ) - should contain_swift__ringbuilder__create('container').with( + is_expected.to contain_swift__ringbuilder__create('container').with( {:before => 'Ring_container_device[127.0.0.1:6001/1]'} ) - should contain_swift__ringbuilder__create('account').with( + is_expected.to contain_swift__ringbuilder__create('account').with( {:before => 'Ring_account_device[127.0.0.1:6002/1]'} ) - should contain_ring_object_device('127.0.0.1:6000/1').with( + is_expected.to contain_ring_object_device('127.0.0.1:6000/1').with( {:notify => 'Swift::Ringbuilder::Rebalance[object]'} ) - should contain_ring_container_device('127.0.0.1:6001/1').with( + is_expected.to contain_ring_container_device('127.0.0.1:6001/1').with( {:notify => 'Swift::Ringbuilder::Rebalance[container]'} ) - should contain_ring_account_device('127.0.0.1:6002/1').with( + is_expected.to contain_ring_account_device('127.0.0.1:6002/1').with( {:notify => 'Swift::Ringbuilder::Rebalance[account]'} ) end diff --git a/swift/spec/classes/swift_ringserver_spec.rb b/swift/spec/classes/swift_ringserver_spec.rb index d3f537c91..e0148d4a2 100644 --- a/swift/spec/classes/swift_ringserver_spec.rb +++ b/swift/spec/classes/swift_ringserver_spec.rb @@ -25,11 +25,11 @@ class {'swift' : swift_hash_suffix => 'eee' } end it 'does not create the rsync::server class' do - should compile + is_expected.to compile end it 'contain the swift_server rsync block' do - should contain_rsync__server__module('swift_server').with({ + is_expected.to contain_rsync__server__module('swift_server').with({ 'path' => '/etc/swift', 'lock_file' => '/var/lock/swift_server.lock', 'uid' => 'swift', @@ -64,7 +64,7 @@ class {'swift' : swift_hash_suffix => 'eee' } end it 'does create the rsync::server class' do - should contain_class('rsync::server').with({ + is_expected.to contain_class('rsync::server').with({ 'use_xinetd' => 'true', 'address' => '127.0.0.1', 'use_chroot' => 'no' @@ -72,7 +72,7 @@ class {'swift' : swift_hash_suffix => 'eee' } end it 'contain the swift_server rsync block' do - should contain_rsync__server__module('swift_server').with({ + is_expected.to contain_rsync__server__module('swift_server').with({ 'path' => '/etc/swift', 'lock_file' => '/var/lock/swift_server.lock', 'uid' => 'swift', diff --git a/swift/spec/classes/swift_spec.rb b/swift/spec/classes/swift_spec.rb index ad6c6c2a8..109af84a8 100644 --- a/swift/spec/classes/swift_spec.rb +++ b/swift/spec/classes/swift_spec.rb @@ -18,7 +18,7 @@ {} end it 'should raise an exception' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end @@ -31,46 +31,45 @@ :require => 'Package[swift]' } end - it {should contain_user('swift')} - it {should contain_file('/home/swift').with( + it {is_expected.to contain_user('swift')} + it {is_expected.to contain_file('/home/swift').with( {:ensure => 'directory', :mode => '0700' }.merge(file_defaults) )} - it {should contain_file('/etc/swift').with( + it {is_expected.to contain_file('/etc/swift').with( {:ensure => 'directory', :mode => '2770' }.merge(file_defaults) )} - it {should contain_file('/var/run/swift').with( + it {is_expected.to contain_file('/var/run/swift').with( {:ensure => 'directory'}.merge(file_defaults) )} - it {should contain_file('/var/lib/swift').with( + it {is_expected.to contain_file('/var/lib/swift').with( {:ensure => 'directory'}.merge(file_defaults) )} - it {should contain_file('/etc/swift/swift.conf').with( - {:ensure => 'present', - :mode => '0660', + it {is_expected.to contain_file('/etc/swift/swift.conf').with( + { :ensure => 'file', + :mode => '0660' }.merge(file_defaults) )} it 'configures swift.conf' do - should contain_swift_config( + is_expected.to contain_swift_config( 'swift-hash/swift_hash_path_suffix').with_value('string') end - it {should contain_package('swift').with_ensure('present')} + it { is_expected.to contain_package('swift').with_ensure('present') } end describe 'when overriding package_ensure parameter' do it 'should effect ensure state of swift package' do params[:package_ensure] = '1.12.0-1' - subject.should contain_package('swift').with_ensure(params[:package_ensure]) + is_expected.to contain_package('swift').with_ensure(params[:package_ensure]) end end describe 'when overriding client_package_ensure parameter' do it 'should effect ensure state of swift package' do params[:client_package_ensure] = '2.0.2-1' - subject.should contain_package('swiftclient').with_ensure(params[:client_package_ensure]) + is_expected.to contain_package('swiftclient').with_ensure(params[:client_package_ensure]) end end - end diff --git a/swift/spec/classes/swift_storage_account_spec.rb b/swift/spec/classes/swift_storage_account_spec.rb index 115fd6cba..4b7fefae7 100644 --- a/swift/spec/classes/swift_storage_account_spec.rb +++ b/swift/spec/classes/swift_storage_account_spec.rb @@ -23,20 +23,20 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" params.merge!(param_set) end - it { should contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) } + it { is_expected.to contain_swift__storage__generic('account').with_package_ensure(params[:package_ensure]) } end end [{ :enabled => true, :manage_service => true }, { :enabled => false, :manage_service => true }].each do |param_hash| - context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do + context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do before do params.merge!(param_hash) end it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :name => service_name, :ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped', :enable => param_hash[:enabled] @@ -55,7 +55,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :ensure => nil, :name => service_name, :enable => false diff --git a/swift/spec/classes/swift_storage_all_spec.rb b/swift/spec/classes/swift_storage_all_spec.rb index ceb207e57..f4468e822 100644 --- a/swift/spec/classes/swift_storage_all_spec.rb +++ b/swift/spec/classes/swift_storage_all_spec.rb @@ -27,9 +27,7 @@ end describe 'when an internal network ip is not specified' do - it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/) - end + it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/ end [{ :storage_local_net_ip => '127.0.0.1' }, @@ -57,21 +55,21 @@ end ['object', 'container', 'account'].each do |type| - it { should contain_package("swift-#{type}").with_ensure('present') } - it { should contain_service("swift-#{type}").with( + it { is_expected.to contain_package("swift-#{type}").with_ensure('present') } + it { is_expected.to contain_service("swift-#{type}").with( {:provider => 'upstart', :ensure => 'running', :enable => true, :hasstatus => true })} - it { should contain_service("swift-#{type}-replicator").with( + it { is_expected.to contain_service("swift-#{type}-replicator").with( {:provider => 'upstart', :ensure => 'running', :enable => true, :hasstatus => true } )} - it { should contain_file("/etc/swift/#{type}-server/").with( + it { is_expected.to contain_file("/etc/swift/#{type}-server/").with( {:ensure => 'directory', :owner => 'swift', :group => 'swift'} @@ -85,24 +83,24 @@ } end - it { should contain_swift__storage__server(param_hash[:account_port]).with( + it { is_expected.to contain_swift__storage__server(param_hash[:account_port]).with( {:type => 'account', :config_file_path => 'account-server.conf', :pipeline => param_hash[:account_pipeline] || 'account-server' }.merge(storage_server_defaults) )} - it { should contain_swift__storage__server(param_hash[:object_port]).with( + it { is_expected.to contain_swift__storage__server(param_hash[:object_port]).with( {:type => 'object', :config_file_path => 'object-server.conf', :pipeline => param_hash[:object_pipeline] || 'object-server' }.merge(storage_server_defaults) )} - it { should contain_swift__storage__server(param_hash[:container_port]).with( + it { is_expected.to contain_swift__storage__server(param_hash[:container_port]).with( {:type => 'container', :config_file_path => 'container-server.conf', :pipeline => param_hash[:container_pipeline] || 'container-server', :allow_versions => param_hash[:allow_versions] || false }.merge(storage_server_defaults) )} - it { should contain_class('rsync::server').with( + it { is_expected.to contain_class('rsync::server').with( {:use_xinetd => true, :address => param_hash[:storage_local_net_ip], :use_chroot => 'no' @@ -138,14 +136,14 @@ param_set end ['object', 'container', 'account'].each do |type| - it { should contain_package("swift-#{type}").with_ensure('present') } - it { should contain_service("swift-#{type}").with( + it { is_expected.to contain_package("swift-#{type}").with_ensure('present') } + it { is_expected.to contain_service("swift-#{type}").with( {:provider => nil, :ensure => 'running', :enable => true, :hasstatus => true })} - it { should contain_service("swift-#{type}-replicator").with( + it { is_expected.to contain_service("swift-#{type}-replicator").with( {:provider => nil, :ensure => 'running', :enable => true, diff --git a/swift/spec/classes/swift_storage_container_spec.rb b/swift/spec/classes/swift_storage_container_spec.rb index 74b75933a..00534b88a 100644 --- a/swift/spec/classes/swift_storage_container_spec.rb +++ b/swift/spec/classes/swift_storage_container_spec.rb @@ -22,21 +22,21 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" params.merge!(param_set) end - it { should contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) } + it { is_expected.to contain_swift__storage__generic('container').with_package_ensure(params[:package_ensure]) } end end [{ :enabled => true, :manage_service => true }, { :enabled => false, :manage_service => true }].each do |param_hash| - context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do + context "when service is_expected.to be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do before do params.merge!(param_hash) end it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :name => service_name, :ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped', :enable => param_hash[:enabled] @@ -55,7 +55,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :ensure => nil, :name => service_name, :enable => false @@ -86,17 +86,17 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" context 'Ubuntu specific resources' do it 'configures sync' do - should contain_service('swift-container-sync').with( + is_expected.to contain_service('swift-container-sync').with( :ensure => 'running', :enable => true, :provider => 'upstart', :require => ['File[/etc/init/swift-container-sync.conf]', 'File[/etc/init.d/swift-container-sync]'] ) - should contain_file('/etc/init/swift-container-sync.conf').with( + is_expected.to contain_file('/etc/init/swift-container-sync.conf').with( :source => 'puppet:///modules/swift/swift-container-sync.conf.upstart', :require => 'Package[swift-container]' ) - should contain_file('/etc/init.d/swift-container-sync').with( + is_expected.to contain_file('/etc/init.d/swift-container-sync').with( :ensure => 'link', :target => '/lib/init/upstart-job' ) @@ -138,7 +138,7 @@ class { 'swift::storage::all': storage_local_net_ip => '10.0.0.1' }" end it { - should contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/) + is_expected.to contain_file(fragment_file).with_content(/^allowed_sync_hosts = 127.0.0.1,10.1.0.1,10.1.0.2$/) } end end diff --git a/swift/spec/classes/swift_storage_object_spec.rb b/swift/spec/classes/swift_storage_object_spec.rb index d98f94891..65c78227c 100644 --- a/swift/spec/classes/swift_storage_object_spec.rb +++ b/swift/spec/classes/swift_storage_object_spec.rb @@ -24,7 +24,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" params.merge!(param_set) end - it { should contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) } + it { is_expected.to contain_swift__storage__generic('object').with_package_ensure(params[:package_ensure]) } end end @@ -37,7 +37,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :name => service_name, :ensure => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped', :enable => param_hash[:enabled] @@ -56,7 +56,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" it 'configures services' do platform_params[:service_names].each do |service_alias, service_name| - should contain_service(service_alias).with( + is_expected.to contain_service(service_alias).with( :ensure => nil, :name => service_name, :enable => false diff --git a/swift/spec/classes/swift_storage_spec.rb b/swift/spec/classes/swift_storage_spec.rb index 656b8ebc4..43270f6ad 100644 --- a/swift/spec/classes/swift_storage_spec.rb +++ b/swift/spec/classes/swift_storage_spec.rb @@ -24,7 +24,7 @@ } end - it { should contain_class('rsync::server').with( + it { is_expected.to contain_class('rsync::server').with( {:use_xinetd => true, :address => params[:storage_local_net_ip], :use_chroot => 'no' @@ -32,14 +32,12 @@ )} end describe 'when local net ip is not specified' do - it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /Must pass storage_local_net_ip/) - end + it_raises 'a Puppet::Error', /Must pass storage_local_net_ip/ end end describe 'when the dependencies are not specified' do it 'should fail' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end end diff --git a/swift/spec/classes/swift_test_file_spec.rb b/swift/spec/classes/swift_test_file_spec.rb index d86dfb94d..f737ea914 100644 --- a/swift/spec/classes/swift_test_file_spec.rb +++ b/swift/spec/classes/swift_test_file_spec.rb @@ -13,7 +13,7 @@ end it 'should create a reasonable test file' do - verify_contents(subject, '/tmp/swift_test_file.rb', + verify_contents(catalogue, '/tmp/swift_test_file.rb', [ 'proxy_local_net_ip="127.0.0.1"', "user='openstack:admin'", @@ -36,7 +36,7 @@ end it 'should create a configured test file' do - verify_contents(subject, '/tmp/swift_test_file.rb', + verify_contents(catalogue, '/tmp/swift_test_file.rb', [ 'proxy_local_net_ip="127.0.0.2"', "user='tenant:user'", diff --git a/swift/spec/classes/swift_xfs_spec.rb b/swift/spec/classes/swift_xfs_spec.rb index 5873fa61a..1a17d6b0d 100644 --- a/swift/spec/classes/swift_xfs_spec.rb +++ b/swift/spec/classes/swift_xfs_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' describe 'swift::xfs' do ['xfsprogs', 'parted'].each do |present_package| - it { should contain_package(present_package).with_ensure('present') } + it { is_expected.to contain_package(present_package).with_ensure('present') } end end diff --git a/swift/spec/defines/swift_ringbuilder_create_spec.rb b/swift/spec/defines/swift_ringbuilder_create_spec.rb index 91a740c52..64f3f9d5f 100644 --- a/swift/spec/defines/swift_ringbuilder_create_spec.rb +++ b/swift/spec/defines/swift_ringbuilder_create_spec.rb @@ -29,7 +29,7 @@ param_set end - it { should contain_exec("create_#{type}").with( + it { is_expected.to contain_exec("create_#{type}").with( {:command => "swift-ring-builder /etc/swift/#{type}.builder create #{param_hash[:part_power]} #{param_hash[:replicas]} #{param_hash[:min_part_hours]}", :path => '/usr/bin', :creates => "/etc/swift/#{type}.builder" } @@ -44,7 +44,7 @@ 'invalid' end it 'should raise an error' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end diff --git a/swift/spec/defines/swift_ringbuilder_rebalance_spec.rb b/swift/spec/defines/swift_ringbuilder_rebalance_spec.rb index 22f0d5b22..09ef75f24 100644 --- a/swift/spec/defines/swift_ringbuilder_rebalance_spec.rb +++ b/swift/spec/defines/swift_ringbuilder_rebalance_spec.rb @@ -6,7 +6,7 @@ let :title do type end - it { should contain_exec("rebalance_#{type}").with( + it { is_expected.to contain_exec("rebalance_#{type}").with( {:command => "swift-ring-builder /etc/swift/#{type}.builder rebalance", :path => '/usr/bin', :refreshonly => true} @@ -21,7 +21,7 @@ let :title do 'object' end - it { should contain_exec("rebalance_object").with( + it { is_expected.to contain_exec("rebalance_object").with( {:command => "swift-ring-builder /etc/swift/object.builder rebalance 999", :path => '/usr/bin', :refreshonly => true} @@ -35,7 +35,7 @@ { :seed => 'invalid' } end it 'should raise an error' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end describe 'with an invalid title' do @@ -43,7 +43,7 @@ 'invalid' end it 'should raise an error' do - expect { subject }.to raise_error(Puppet::Error) + expect { catalogue }.to raise_error(Puppet::Error) end end diff --git a/swift/spec/defines/swift_storage_disk_spec.rb b/swift/spec/defines/swift_storage_disk_spec.rb index 213f6d495..61aeff057 100644 --- a/swift/spec/defines/swift_storage_disk_spec.rb +++ b/swift/spec/defines/swift_storage_disk_spec.rb @@ -15,7 +15,7 @@ } end - it { should contain_swift__storage__xfs('sdb').with( + it { is_expected.to contain_swift__storage__xfs('sdb').with( :device => '/dev/sdb', :mnt_base_dir => '/srv/node', :byte_size => '1024', diff --git a/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb b/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb index fd59a6013..e8aca7465 100644 --- a/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb +++ b/swift/spec/defines/swift_storage_filter_healthcheck_spec.rb @@ -19,7 +19,7 @@ end it 'should build the fragment with correct content' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:healthcheck]', 'use = egg:swift#healthcheck' diff --git a/swift/spec/defines/swift_storage_filter_recon_spec.rb b/swift/spec/defines/swift_storage_filter_recon_spec.rb index da1518907..9da01c60d 100644 --- a/swift/spec/defines/swift_storage_filter_recon_spec.rb +++ b/swift/spec/defines/swift_storage_filter_recon_spec.rb @@ -20,7 +20,7 @@ describe 'when passing default parameters' do it 'should build the fragment with correct content' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:recon]', 'use = egg:swift#recon', @@ -37,7 +37,7 @@ } end it 'should build the fragment with correct content' do - verify_contents(subject, fragment_file, + verify_contents(catalogue, fragment_file, [ '[filter:recon]', 'use = egg:swift#recon', diff --git a/swift/spec/defines/swift_storage_generic_spec.rb b/swift/spec/defines/swift_storage_generic_spec.rb index 4094350d9..77992c494 100644 --- a/swift/spec/defines/swift_storage_generic_spec.rb +++ b/swift/spec/defines/swift_storage_generic_spec.rb @@ -28,9 +28,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" let :title do 'foo' end - it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /does not match/) - end + it_raises 'a Puppet::Error', /does not match/ end ['account', 'object', 'container'].each do |t| @@ -48,20 +46,20 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" let :params do param_set end - it { should contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) } - it { should contain_service("swift-#{t}").with( + it { is_expected.to contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) } + it { is_expected.to contain_service("swift-#{t}").with( :ensure => 'running', :enable => true, :hasstatus => true, :provider => param_hash[:service_provider] )} - it { should contain_service("swift-#{t}-replicator").with( + it { is_expected.to contain_service("swift-#{t}-replicator").with( :ensure => 'running', :enable => true, :hasstatus => true, :provider => param_hash[:service_provider] )} - it { should contain_file("/etc/swift/#{t}-server/").with( + it { is_expected.to contain_file("/etc/swift/#{t}-server/").with( :ensure => 'directory', :owner => 'swift', :group => 'swift' diff --git a/swift/spec/defines/swift_storage_loopback_spec.rb b/swift/spec/defines/swift_storage_loopback_spec.rb index 8e1f125b9..796cda5cf 100644 --- a/swift/spec/defines/swift_storage_loopback_spec.rb +++ b/swift/spec/defines/swift_storage_loopback_spec.rb @@ -7,7 +7,7 @@ 'dans_disk' end - it { should contain_swift__storage__xfs('dans_disk').with( + it { is_expected.to contain_swift__storage__xfs('dans_disk').with( :device => '/srv/loopback-device/dans_disk', :mnt_base_dir => '/srv/node', :byte_size => '1024', diff --git a/swift/spec/defines/swift_storage_mount_spec.rb b/swift/spec/defines/swift_storage_mount_spec.rb index 71bcd87c0..672975b21 100644 --- a/swift/spec/defines/swift_storage_mount_spec.rb +++ b/swift/spec/defines/swift_storage_mount_spec.rb @@ -13,7 +13,7 @@ } end - it { should contain_mount('/srv/node/dans_mount_point').with( + it { is_expected.to contain_mount('/srv/node/dans_mount_point').with( :ensure => 'present', :device => '/dev/sda', :fstype => 'xfs', @@ -32,7 +32,7 @@ } end - it { should contain_mount('/srv/node/dans_mount_point').with( + it { is_expected.to contain_mount('/srv/node/dans_mount_point').with( :device => '/dev/sda', :options => 'noatime,nodiratime,nobarrier,loop,logbufs=8' )} @@ -52,7 +52,7 @@ } end - it { should contain_exec("restorecon_mount_dans_mount_point").with( + it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with( {:command => "restorecon /srv/node/dans_mount_point", :path => ['/usr/sbin', '/sbin'], :refreshonly => true} diff --git a/swift/spec/defines/swift_storage_node_spec.rb b/swift/spec/defines/swift_storage_node_spec.rb index 19795a2c0..11cea91b3 100644 --- a/swift/spec/defines/swift_storage_node_spec.rb +++ b/swift/spec/defines/swift_storage_node_spec.rb @@ -26,9 +26,9 @@ class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }" end it { - should contain_ring_object_device("127.0.0.1:6010/1") - should contain_ring_container_device("127.0.0.1:6011/1") - should contain_ring_account_device("127.0.0.1:6012/1") + is_expected.to contain_ring_object_device("127.0.0.1:6010/1") + is_expected.to contain_ring_container_device("127.0.0.1:6011/1") + is_expected.to contain_ring_account_device("127.0.0.1:6012/1") } context 'when zone is not a number' do @@ -38,10 +38,6 @@ class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }" :mnt_base_dir => '/srv/node' } end - it 'should raise an error' do - expect { - subject - }.to raise_error(Puppet::Error, /The zone parameter must be an integer/) - end + it_raises 'a Puppet::Error', /The zone parameter must be an integer/ end end diff --git a/swift/spec/defines/swift_storage_server_spec.rb b/swift/spec/defines/swift_storage_server_spec.rb index 20760658e..1e8e05cda 100644 --- a/swift/spec/defines/swift_storage_server_spec.rb +++ b/swift/spec/defines/swift_storage_server_spec.rb @@ -34,9 +34,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" let :title do 'foo' end - it 'should fail' do - expect { subject }.to raise_error(Puppet::Error, /does not match/) - end + it_raises 'a Puppet::Error', /does not match/ end ['account', 'object', 'container'].each do |t| @@ -54,8 +52,8 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" req_params end - it { should contain_package("swift-#{t}").with_ensure('present') } - it { should contain_service("swift-#{t}").with( + it { is_expected.to contain_package("swift-#{t}").with_ensure('present') } + it { is_expected.to contain_service("swift-#{t}").with( :ensure => 'running', :enable => true, :hasstatus => true @@ -74,7 +72,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" }.each do |k,v| describe "when #{k} is set" do let :params do req_params.merge({k => v}) end - it { should contain_file(fragment_file) \ + it { is_expected.to contain_file(fragment_file) \ .with_content( /^#{k.to_s}\s*=\s*#{v.is_a?(Array) ? v.join(' ') : v}\s*$/ ) @@ -83,35 +81,33 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" end describe "when pipeline is passed an array" do let :params do req_params.merge({:pipeline => ['healthcheck','recon','test']}) end - it { should contain_concat__fragment("swift-#{t}-#{title}").with( + it { is_expected.to contain_concat__fragment("swift-#{t}-#{title}").with( :content => /^pipeline\s*=\s*healthcheck recon test\s*$/, :before => ["Swift::Storage::Filter::Healthcheck[#{t}]", "Swift::Storage::Filter::Recon[#{t}]", "Swift::Storage::Filter::Test[#{t}]"] )} end describe "when pipeline is not passed an array" do let :params do req_params.merge({:pipeline => 'not an array'}) end - it "should fail" do - expect { subject }.to raise_error(Puppet::Error, /is not an Array/) - end + it_raises 'a Puppet::Error', /is not an Array/ end describe "when replicator_concurrency is set" do let :params do req_params.merge({:replicator_concurrency => 42}) end - it { should contain_file(fragment_file) \ + it { is_expected.to contain_file(fragment_file) \ .with_content(/\[#{t}-replicator\]\nconcurrency\s*=\s*42\s*$/m) } end if t != 'account' describe "when updater_concurrency is set" do let :params do req_params.merge({:updater_concurrency => 73}) end - it { should contain_file(fragment_file) \ + it { is_expected.to contain_file(fragment_file) \ .with_content(/\[#{t}-updater\]\nconcurrency\s*=\s*73\s*$/m) } end else describe "when reaper_concurrency is set" do let :params do req_params.merge({:reaper_concurrency => 4682}) end - it { should contain_file(fragment_file) \ + it { is_expected.to contain_file(fragment_file) \ .with_content(/\[#{t}-reaper\]\nconcurrency\s*=\s*4682\s*$/m) } end @@ -119,7 +115,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" if t == 'container' describe "when allow_versioning is set" do let :params do req_params.merge({ :allow_versions => false, }) end - it { should contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)} + it { is_expected.to contain_file(fragment_file).with_content(/\[app:container-server\]\nallow_versions\s*=\s*false\s*$/m)} end end end @@ -129,7 +125,7 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" req_params end - it { should contain_rsync__server__module("#{t}").with( + it { is_expected.to contain_rsync__server__module("#{t}").with( :path => '/srv/node', :lock_file => "/var/lock/#{t}.lock", :uid => 'swift', @@ -141,42 +137,18 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" )} # verify template lines - it { should contain_file(fragment_file) \ - .with_content(/^devices\s*=\s*\/srv\/node\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^bind_port\s*=\s*#{title}\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^mount_check\s*=\s*false\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^user\s*=\s*swift\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^set log_name\s*=\s*#{t}-server\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^set log_level\s*=\s*INFO\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^workers\s*=\s*1\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^concurrency\s*=\s*1\s*$/) - } - it { should contain_file(fragment_file) \ - .with_content(/^pipeline\s*=\s*#{t}-server\s*$/) - } + it { is_expected.to contain_file(fragment_file).with_content(/^devices\s*=\s*\/srv\/node\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^bind_ip\s*=\s*10\.0\.0\.1\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^bind_port\s*=\s*#{title}\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^mount_check\s*=\s*false\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^user\s*=\s*swift\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^set log_name\s*=\s*#{t}-server\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^set log_level\s*=\s*INFO\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^workers\s*=\s*1\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^concurrency\s*=\s*1\s*$/) } + it { is_expected.to contain_file(fragment_file).with_content(/^pipeline\s*=\s*#{t}-server\s*$/) } end end end diff --git a/swift/spec/defines/swift_storage_xfs_spec.rb b/swift/spec/defines/swift_storage_xfs_spec.rb index 8d254984d..517789da7 100644 --- a/swift/spec/defines/swift_storage_xfs_spec.rb +++ b/swift/spec/defines/swift_storage_xfs_spec.rb @@ -32,13 +32,13 @@ param_set end - it { should contain_exec("mkfs-foo").with( + it { is_expected.to contain_exec("mkfs-foo").with( :command => "mkfs.xfs -f -i size=#{param_hash[:byte_size]} #{param_hash[:device]}", :path => ['/sbin/', '/usr/sbin/'], :require => 'Package[xfsprogs]' )} - it { should contain_swift__storage__mount(title).with( + it { is_expected.to contain_swift__storage__mount(title).with( :device => param_hash[:device], :mnt_base_dir => param_hash[:mnt_base_dir], :loopback => param_hash[:loopback], diff --git a/swift/spec/shared_examples.rb b/swift/spec/shared_examples.rb index d92156a36..fec0eacc9 100644 --- a/swift/spec/shared_examples.rb +++ b/swift/spec/shared_examples.rb @@ -1,5 +1,5 @@ shared_examples_for "a Puppet::Error" do |description| it "with message matching #{description.inspect}" do - expect { should have_class_count(1) }.to raise_error(Puppet::Error, description) + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) end end diff --git a/swift/spec/unit/puppet/provider/swift_ring_builder_spec.rb b/swift/spec/unit/puppet/provider/swift_ring_builder_spec.rb index 542adbcdd..077201841 100644 --- a/swift/spec/unit/puppet/provider/swift_ring_builder_spec.rb +++ b/swift/spec/unit/puppet/provider/swift_ring_builder_spec.rb @@ -27,26 +27,26 @@ ' ) resources = provider_class.lookup_ring - resources['192.168.101.13:6002/1'].should_not be_nil - resources['192.168.101.14:6002/1'].should_not be_nil - resources['192.168.101.15:6002/1'].should_not be_nil - resources['192.168.101.16:6002/1'].should_not be_nil + expect(resources['192.168.101.13:6002/1']).to_not be_nil + expect(resources['192.168.101.14:6002/1']).to_not be_nil + expect(resources['192.168.101.15:6002/1']).to_not be_nil + expect(resources['192.168.101.16:6002/1']).to_not be_nil - resources['192.168.101.13:6002/1'][:id].should eql '1' - resources['192.168.101.13:6002/1'][:region].should eql '1' - resources['192.168.101.13:6002/1'][:zone].should eql '1' - resources['192.168.101.13:6002/1'][:weight].should eql '1.00' - resources['192.168.101.13:6002/1'][:partitions].should eql '262144' - resources['192.168.101.13:6002/1'][:balance].should eql '0.00' - resources['192.168.101.13:6002/1'][:meta].should eql '' + expect(resources['192.168.101.13:6002/1'][:id]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.13:6002/1'][:meta]).to eql '' - resources['192.168.101.14:6002/1'][:id].should eql '2' - resources['192.168.101.14:6002/1'][:region].should eql '1' - resources['192.168.101.14:6002/1'][:zone].should eql '2' - resources['192.168.101.14:6002/1'][:weight].should eql '1.00' - resources['192.168.101.14:6002/1'][:partitions].should eql '262144' - resources['192.168.101.14:6002/1'][:balance].should eql '200.00' - resources['192.168.101.14:6002/1'][:meta].should eql 'm2' + expect(resources['192.168.101.14:6002/1'][:id]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00' + expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2' end it 'should be able to lookup the local ring and build an object 1.8.0' do @@ -65,26 +65,26 @@ ' ) resources = provider_class.lookup_ring - resources['192.168.101.13:6002/1'].should_not be_nil - resources['192.168.101.14:6002/1'].should_not be_nil - resources['192.168.101.15:6002/1'].should_not be_nil - resources['192.168.101.16:6002/1'].should_not be_nil + expect(resources['192.168.101.13:6002/1']).to_not be_nil + expect(resources['192.168.101.14:6002/1']).to_not be_nil + expect(resources['192.168.101.15:6002/1']).to_not be_nil + expect(resources['192.168.101.16:6002/1']).to_not be_nil - resources['192.168.101.13:6002/1'][:id].should eql '1' - resources['192.168.101.13:6002/1'][:region].should eql '1' - resources['192.168.101.13:6002/1'][:zone].should eql '1' - resources['192.168.101.13:6002/1'][:weight].should eql '1.00' - resources['192.168.101.13:6002/1'][:partitions].should eql '262144' - resources['192.168.101.13:6002/1'][:balance].should eql '0.00' - resources['192.168.101.13:6002/1'][:meta].should eql '' + expect(resources['192.168.101.13:6002/1'][:id]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.13:6002/1'][:meta]).to eql '' - resources['192.168.101.14:6002/1'][:id].should eql '2' - resources['192.168.101.14:6002/1'][:region].should eql '1' - resources['192.168.101.14:6002/1'][:zone].should eql '2' - resources['192.168.101.14:6002/1'][:weight].should eql '1.00' - resources['192.168.101.14:6002/1'][:partitions].should eql '262144' - resources['192.168.101.14:6002/1'][:balance].should eql '200.00' - resources['192.168.101.14:6002/1'][:meta].should eql 'm2' + expect(resources['192.168.101.14:6002/1'][:id]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.14:6002/1'][:balance]).to eql '200.00' + expect(resources['192.168.101.14:6002/1'][:meta]).to eql 'm2' end it 'should be able to lookup the local ring and build an object 1.7' do @@ -102,25 +102,25 @@ ' ) resources = provider_class.lookup_ring - resources['192.168.101.13:6002/1'].should_not be_nil - resources['192.168.101.14:6002/1'].should_not be_nil - resources['192.168.101.15:6002/1'].should_not be_nil + expect(resources['192.168.101.13:6002/1']).to_not be_nil + expect(resources['192.168.101.14:6002/1']).to_not be_nil + expect(resources['192.168.101.15:6002/1']).to_not be_nil - resources['192.168.101.13:6002/1'][:id].should eql '1' - resources['192.168.101.13:6002/1'][:region].should eql '1' - resources['192.168.101.13:6002/1'][:zone].should eql '1' - resources['192.168.101.13:6002/1'][:weight].should eql '1.00' - resources['192.168.101.13:6002/1'][:partitions].should eql '262144' - resources['192.168.101.13:6002/1'][:balance].should eql '0.00' - resources['192.168.101.13:6002/1'][:meta].should eql '' + expect(resources['192.168.101.13:6002/1'][:id]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.13:6002/1'][:meta]).to eql '' - resources['192.168.101.14:6002/1'][:id].should eql '2' - resources['192.168.101.14:6002/1'][:region].should eql '1' - resources['192.168.101.14:6002/1'][:zone].should eql '2' - resources['192.168.101.14:6002/1'][:weight].should eql '1.00' - resources['192.168.101.14:6002/1'][:partitions].should eql '262144' - resources['192.168.101.14:6002/1'][:balance].should eql '0.00' - resources['192.168.101.14:6002/1'][:meta].should eql '' + expect(resources['192.168.101.14:6002/1'][:id]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:region]).to eql '1' + expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.14:6002/1'][:meta]).to eql '' end it 'should be able to lookup the local ring and build an object legacy' do @@ -137,24 +137,24 @@ ' ) resources = provider_class.lookup_ring - resources['192.168.101.15:6002/1'].should_not be_nil - resources['192.168.101.13:6002/1'].should_not be_nil - resources['192.168.101.14:6002/1'].should_not be_nil + expect(resources['192.168.101.15:6002/1']).to_not be_nil + expect(resources['192.168.101.13:6002/1']).to_not be_nil + expect(resources['192.168.101.14:6002/1']).to_not be_nil - resources['192.168.101.13:6002/1'][:id].should eql '1' - resources['192.168.101.13:6002/1'][:region].should eql 'none' - resources['192.168.101.13:6002/1'][:zone].should eql '1' - resources['192.168.101.13:6002/1'][:weight].should eql '1.00' - resources['192.168.101.13:6002/1'][:partitions].should eql '262144' - resources['192.168.101.13:6002/1'][:balance].should eql '0.00' - resources['192.168.101.13:6002/1'][:meta].should eql '' + expect(resources['192.168.101.13:6002/1'][:id]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:region]).to eql 'none' + expect(resources['192.168.101.13:6002/1'][:zone]).to eql '1' + expect(resources['192.168.101.13:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.13:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.13:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.13:6002/1'][:meta]).to eql '' - resources['192.168.101.14:6002/1'][:id].should eql '2' - resources['192.168.101.14:6002/1'][:region].should eql 'none' - resources['192.168.101.14:6002/1'][:zone].should eql '2' - resources['192.168.101.14:6002/1'][:weight].should eql '1.00' - resources['192.168.101.14:6002/1'][:partitions].should eql '262144' - resources['192.168.101.14:6002/1'][:balance].should eql '0.00' - resources['192.168.101.14:6002/1'][:meta].should eql '' + expect(resources['192.168.101.14:6002/1'][:id]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:region]).to eql 'none' + expect(resources['192.168.101.14:6002/1'][:zone]).to eql '2' + expect(resources['192.168.101.14:6002/1'][:weight]).to eql '1.00' + expect(resources['192.168.101.14:6002/1'][:partitions]).to eql '262144' + expect(resources['192.168.101.14:6002/1'][:balance]).to eql '0.00' + expect(resources['192.168.101.14:6002/1'][:meta]).to eql '' end end diff --git a/swift/templates/proxy-server.conf.erb b/swift/templates/proxy-server.conf.erb index d59cb22ef..1a7987387 100644 --- a/swift/templates/proxy-server.conf.erb +++ b/swift/templates/proxy-server.conf.erb @@ -41,3 +41,6 @@ write_affinity = <%= @write_affinity -%> <% if @write_affinity_node_count -%> write_affinity_node_count = <%= @write_affinity_node_count -%> <% end %> +<% if @node_timeout -%> +node_timeout = <%= @node_timeout -%> +<% end %> diff --git a/swift/tests/all.pp b/swift/tests/all.pp index 750835647..dd7b797fc 100644 --- a/swift/tests/all.pp +++ b/swift/tests/all.pp @@ -11,11 +11,11 @@ package { 'curl': ensure => present } -class { 'memcached': +class { '::memcached': listen_ip => $swift_local_net_ip, } -class { 'swift': +class { '::swift': # not sure how I want to deal with this shared secret swift_hash_suffix => $swift_shared_secret, package_ensure => latest, @@ -23,8 +23,8 @@ # === Configure Storage -class { 'swift::storage': - storage_local_net_ip => $swift_local_net_ip +class { '::swift::storage': + storage_local_net_ip => $swift_local_net_ip, } # create xfs partitions on a loopback device and mounts them @@ -44,7 +44,7 @@ require => Swift::Storage::Loopback[2] , } -class { 'swift::ringbuilder': +class { '::swift::ringbuilder': part_power => '18', replicas => '1', min_part_hours => 1, @@ -53,10 +53,10 @@ # TODO should I enable swath in the default config? -class { 'swift::proxy': +class { '::swift::proxy': proxy_local_net_ip => $swift_local_net_ip, pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'], account_autocreate => true, require => Class['swift::ringbuilder'], } -class { ['swift::proxy::healthcheck', 'swift::proxy::cache', 'swift::proxy::tempauth']: } +class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: } diff --git a/swift/tests/site.pp b/swift/tests/site.pp index f98154fe6..fdc498688 100644 --- a/swift/tests/site.pp +++ b/swift/tests/site.pp @@ -52,16 +52,16 @@ # This node can be used to deploy a keystone service. # This service only contains the credentials for authenticating # swift -node swift-keystone { +node 'swift-keystone' { # set up mysql server - class { 'mysql::server': + class { '::mysql::server': config_hash => { # the priv grant fails on precise if I set a root password # TODO I should make sure that this works # 'root_password' => $mysql_root_password, - 'bind_address' => '0.0.0.0' - } + 'bind_address' => '0.0.0.0', + }, } keystone_config { @@ -69,7 +69,7 @@ } # set up all openstack databases, users, grants - class { 'keystone::db::mysql': + class { '::keystone::db::mysql': password => $swift_keystone_db_password, } @@ -83,29 +83,17 @@ } # Setup the Keystone Identity Endpoint - class { 'keystone::endpoint': } + class { '::keystone::endpoint': } # set up keystone admin users - class { 'keystone::roles::admin': + class { '::keystone::roles::admin': email => $swift_keystone_admin_email, password => $swift_keystone_admin_password, } # configure the keystone service user and endpoint - class { 'swift::keystone::auth': - password => $swift_admin_password, - public_address => $swift_proxy_node, - } - -} - - -node swift_base { - - - class { 'swift': - # not sure how I want to deal with this shared secret - swift_hash_suffix => $swift_shared_secret, - package_ensure => latest, + class { '::swift::keystone::auth': + password => $swift_admin_password, + public_address => $swift_proxy_node, } } @@ -118,7 +106,13 @@ # they would need to be replaced with something that create and mounts xfs # partitions # -node /swift-storage/ inherits swift_base { +node /swift-storage/ { + + class { '::swift': + # not sure how I want to deal with this shared secret + swift_hash_suffix => $swift_shared_secret, + package_ensure => latest, + } # create xfs partitions on a loopback device and mount them swift::storage::loopback { ['1', '2']: @@ -128,39 +122,39 @@ } # install all swift storage servers together - class { 'swift::storage::all': + class { '::swift::storage::all': storage_local_net_ip => $swift_local_net_ip, } # specify endpoints per device to be added to the ring specification @@ring_object_device { "${swift_local_net_ip}:6000/1": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } @@ring_object_device { "${swift_local_net_ip}:6000/2": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } @@ring_container_device { "${swift_local_net_ip}:6001/1": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } @@ring_container_device { "${swift_local_net_ip}:6001/2": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } # TODO should device be changed to volume @@ring_account_device { "${swift_local_net_ip}:6002/1": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } @@ring_account_device { "${swift_local_net_ip}:6002/2": - zone => $swift_zone, - weight => 1, + zone => $swift_zone, + weight => 1, } # collect resources for synchronizing the ring databases @@ -169,18 +163,23 @@ } -node /swift-proxy/ inherits swift_base { +node /swift-proxy/ { + class { '::swift': + # not sure how I want to deal with this shared secret + swift_hash_suffix => $swift_shared_secret, + package_ensure => latest, + } # curl is only required so that I can run tests package { 'curl': ensure => present } - class { 'memcached': + class { '::memcached': listen_ip => '127.0.0.1', } # specify swift proxy and all of its middlewares - class { 'swift::proxy': + class { '::swift::proxy': proxy_local_net_ip => $swift_local_net_ip, pipeline => [ 'bulk', @@ -194,8 +193,7 @@ 'keystone', 'account_quotas', 'container_quotas', - 'proxy-server' - ], + 'proxy-server'], account_autocreate => true, # TODO where is the ringbuilder class? require => Class['swift::ringbuilder'], @@ -203,35 +201,35 @@ # configure all of the middlewares class { [ - 'swift::proxy::account_quotas', - 'swift::proxy::catch_errors', - 'swift::proxy::container_quotas', - 'swift::proxy::healthcheck', - 'swift::proxy::cache', - 'swift::proxy::swift3', + '::swift::proxy::account_quotas', + '::swift::proxy::catch_errors', + '::swift::proxy::container_quotas', + '::swift::proxy::healthcheck', + '::swift::proxy::cache', + '::swift::proxy::swift3', ]: } - class { 'swift::proxy::bulk': + class { '::swift::proxy::bulk': max_containers_per_extraction => 10000, max_failed_extractions => 1000, max_deletes_per_request => 10000, yield_frequency => 60, } - class { 'swift::proxy::ratelimit': + class { '::swift::proxy::ratelimit': clock_accuracy => 1000, max_sleep_time_seconds => 60, log_sleep_time_seconds => 0, rate_buffer_seconds => 5, - account_ratelimit => 0 + account_ratelimit => 0, } - class { 'swift::proxy::s3token': + class { '::swift::proxy::s3token': # assume that the controller host is the swift api server - auth_host => $swift_keystone_node, - auth_port => '35357', + auth_host => $swift_keystone_node, + auth_port => '35357', } - class { 'swift::proxy::keystone': + class { '::swift::proxy::keystone': operator_roles => ['admin', 'SwiftOperator'], } - class { 'swift::proxy::authtoken': + class { '::swift::proxy::authtoken': admin_user => 'swift', admin_tenant_name => 'services', admin_password => $swift_admin_password, @@ -246,7 +244,7 @@ Ring_account_device <<| |>> # create the ring - class { 'swift::ringbuilder': + class { '::swift::ringbuilder': # the part power should be determined by assuming 100 partitions per drive part_power => '18', replicas => '3', @@ -255,19 +253,18 @@ } # sets up an rsync db that can be used to sync the ring DB - class { 'swift::ringserver': + class { '::swift::ringserver': local_net_ip => $swift_local_net_ip, } # exports rsync gets that can be used to sync the ring files @@swift::ringsync { ['account', 'object', 'container']: - ring_server => $swift_local_net_ip + ring_server => $swift_local_net_ip, } # deploy a script that can be used for testing - class { 'swift::test_file': + class { '::swift::test_file': auth_server => $swift_keystone_node, password => $swift_keystone_admin_password, } } - From cc0d4ce59d1c0dd8c8f65b9e4326facc0b443fb0 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:11:39 +0100 Subject: [PATCH 21/22] Update trove to b38fef5f763768981b9d74bafedcc63ff51d93e2 b38fef5f763768981b9d74bafedcc63ff51d93e2 Merge "Migrate postgresql backend to use openstacklib::db::postgresql" edde7da295d2a2c3544ea28694bb3e846f89a96d Migrate postgresql backend to use openstacklib::db::postgresql --- Puppetfile | 2 +- trove/.fixtures.yml | 5 +- trove/manifests/db/postgresql.pp | 45 ++++++++------ .../spec/classes/trove_db_postgresql_spec.rb | 58 ++++++++++++++----- 4 files changed, 76 insertions(+), 34 deletions(-) diff --git a/Puppetfile b/Puppetfile index bf28e9780..54bb4d357 100644 --- a/Puppetfile +++ b/Puppetfile @@ -195,7 +195,7 @@ mod 'tripleo', :git => 'https://github.com/stackforge/puppet-tripleo.git' mod 'trove', - :commit => 'feee104f7f150948f77f357c5708e87a080595c1', + :commit => 'b38fef5f763768981b9d74bafedcc63ff51d93e2', :git => 'https://github.com/stackforge/puppet-trove' mod 'vcsrepo', diff --git a/trove/.fixtures.yml b/trove/.fixtures.yml index 835a61744..3ec49cbe4 100644 --- a/trove/.fixtures.yml +++ b/trove/.fixtures.yml @@ -1,12 +1,11 @@ fixtures: repositories: 'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile' + 'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git' 'keystone': 'git://github.com/stackforge/puppet-keystone.git' 'mysql': 'git://github.com/puppetlabs/puppetlabs-mysql.git' 'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git' - 'postgresql': - repo: 'git://github.com/puppetlabs/puppet-postgresql.git' - ref: '2.5.0' + 'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git' 'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git' symlinks: 'trove': "#{source_dir}" diff --git a/trove/manifests/db/postgresql.pp b/trove/manifests/db/postgresql.pp index 85bc889c2..f97631927 100644 --- a/trove/manifests/db/postgresql.pp +++ b/trove/manifests/db/postgresql.pp @@ -1,36 +1,47 @@ # == Class: trove::db::postgresql # -# Manage the trove postgresql database +# Class that configures postgresql for trove +# Requires the Puppetlabs postgresql module. # -# === Parameters: +# === Parameters # # [*password*] -# (required) Password that will be used for the trove db user. +# (Required) Password to connect to the database. # # [*dbname*] -# (optionnal) Name of trove database. -# Defaults to trove +# (Optional) Name of the database. +# Defaults to 'trove'. # # [*user*] -# (optionnal) Name of trove user. -# Defaults to trove +# (Optional) User to connect to the database. +# Defaults to 'trove'. +# +# [*encoding*] +# (Optional) The charset to use for the database. +# Default to undef. +# +# [*privileges*] +# (Optional) Privileges given to the database user. +# Default to 'ALL' # class trove::db::postgresql( $password, - $dbname = 'trove', - $user = 'trove' + $dbname = 'trove', + $user = 'trove', + $encoding = undef, + $privileges = 'ALL', ) { - require postgresql::python - Class['trove::db::postgresql'] -> Service<| title == 'trove' |> - Postgresql::Db[$dbname] ~> Exec<| title == 'trove-manage db_sync' |> - Package['python-psycopg2'] -> Exec<| title == 'trove-manage db_sync' |> - - postgresql::db { $dbname: - user => $user, - password => $password, + ::openstacklib::db::postgresql { 'trove': + password_hash => postgresql_password($user, $password), + dbname => $dbname, + user => $user, + encoding => $encoding, + privileges => $privileges, } + ::Openstacklib::Db::Postgresql['trove'] ~> Exec<| title == 'trove-manage db_sync' |> + } diff --git a/trove/spec/classes/trove_db_postgresql_spec.rb b/trove/spec/classes/trove_db_postgresql_spec.rb index cd710ebc9..2b516205e 100644 --- a/trove/spec/classes/trove_db_postgresql_spec.rb +++ b/trove/spec/classes/trove_db_postgresql_spec.rb @@ -3,24 +3,56 @@ describe 'trove::db::postgresql' do let :req_params do - {:password => 'pw'} + { :password => 'pw' } end - let :facts do - { - :postgres_default_version => '8.4', - :osfamily => 'RedHat', - } + let :pre_condition do + 'include postgresql::server' end - describe 'with only required params' do - let :params do - req_params + context 'on a RedHat osfamily' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7.0', + :concat_basedir => '/var/lib/puppet/concat' + } end - it { is_expected.to contain_postgresql__db('trove').with( - :user => 'trove', - :password => 'pw' - ) } + + context 'with only required parameters' do + let :params do + req_params + end + + it { is_expected.to contain_postgresql__server__db('trove').with( + :user => 'trove', + :password => 'md5e12ef276d200761a0808f17a5b076451' + )} + end + + end + + context 'on a Debian osfamily' do + let :facts do + { + :operatingsystemrelease => '7.8', + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :concat_basedir => '/var/lib/puppet/concat' + } + end + + context 'with only required parameters' do + let :params do + req_params + end + + it { is_expected.to contain_postgresql__server__db('trove').with( + :user => 'trove', + :password => 'md5e12ef276d200761a0808f17a5b076451' + )} + end + end end From c6658a75e250260e6ee2534e52be810d528ce45a Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Fri, 27 Mar 2015 15:11:46 +0100 Subject: [PATCH 22/22] Update vcsrepo to 74e415866ef2d39ed1568dd43b6e8596590dedaf 74e415866ef2d39ed1568dd43b6e8596590dedaf Merge pull request #238 from anodelman/master 01bf2a6ba11f67635569d5ab7a35f37768cbd3af Merge pull request #240 from cmurphy/hash_ordering d27759141ec5592fd5d76861efa77a55d07c90a8 Fix remote hash ordering for unit tests 76d98c9f1e814accef18002ff3c92fc22bf79b27 (BKR-147) add Gemfile setting for BEAKER_VERSION for puppet... --- Puppetfile | 2 +- vcsrepo/Gemfile | 21 ++++++++++++++++++- vcsrepo/lib/puppet/provider/vcsrepo/git.rb | 3 ++- .../unit/puppet/provider/vcsrepo/git_spec.rb | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Puppetfile b/Puppetfile index 54bb4d357..a75c1bb30 100644 --- a/Puppetfile +++ b/Puppetfile @@ -199,7 +199,7 @@ mod 'trove', :git => 'https://github.com/stackforge/puppet-trove' mod 'vcsrepo', - :commit => '9a955b8746f373a1a3e47ebf67d4186b98e0094f', + :commit => '74e415866ef2d39ed1568dd43b6e8596590dedaf', :git => 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git' mod 'vlan', diff --git a/vcsrepo/Gemfile b/vcsrepo/Gemfile index 62c569397..e1ae0fa56 100644 --- a/vcsrepo/Gemfile +++ b/vcsrepo/Gemfile @@ -1,5 +1,15 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git:[^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + group :development, :unit_tests do gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false @@ -11,8 +21,17 @@ group :development, :unit_tests do gem 'json', :require => false end +beaker_version = ENV['BEAKER_VERSION'] +beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] group :system_tests do - gem 'beaker-rspec', :require => false + if beaker_version + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end gem 'serverspec', :require => false end diff --git a/vcsrepo/lib/puppet/provider/vcsrepo/git.rb b/vcsrepo/lib/puppet/provider/vcsrepo/git.rb index 9d3f7f34e..000032e97 100644 --- a/vcsrepo/lib/puppet/provider/vcsrepo/git.rb +++ b/vcsrepo/lib/puppet/provider/vcsrepo/git.rb @@ -142,7 +142,8 @@ def update_remotes # we loop around the hash. Otherwise, we assume single url specified # in source property if @resource.value(:source).is_a?(Hash) - @resource.value(:source).each do |remote_name, remote_url| + @resource.value(:source).keys.sort.each do |remote_name| + remote_url = @resource.value(:source)[remote_name] at_path { do_update |= update_remote_url(remote_name, remote_url) } end else diff --git a/vcsrepo/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/vcsrepo/spec/unit/puppet/provider/vcsrepo/git_spec.rb index d0153a1be..d33c98af6 100644 --- a/vcsrepo/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/vcsrepo/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -263,7 +263,7 @@ def branch_a_list(include_branch = nil?) context "when multiple sources are modified" do it "should update the urls" do resource[:source] = {"origin" => "git://git@foo.com/bar.git", "new_remote" => "git://git@foo.com/baz.git"} - provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/foo.git\n", "remote.origin.url=git://git@foo.com/bar.git\n") + provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/bar.git\n", "remote.origin.url=git://git@foo.com/foo.git\n") provider.expects(:git).with('remote', 'set-url', 'origin', 'git://git@foo.com/bar.git') provider.expects(:git).with('remote', 'add', 'new_remote', 'git://git@foo.com/baz.git') provider.expects(:git).with('remote','update')