Skip to content

Commit

Permalink
Merge pull request #354 from bmjen/merge-master
Browse files Browse the repository at this point in the history
Merge master into 1.2.x
  • Loading branch information
Morgan Haskel committed Jul 20, 2015
2 parents 35958b3 + d336ea0 commit 89fceb4
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 52 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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'"
Expand All @@ -11,5 +12,7 @@ matrix:
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
notifications:
email: false
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
##2015-06-02 - Supported Release 2.0.1 [YANKED]
###Summary

This is a bugfix release.

####Bugfixes
- Fixes dependency graphing with concurrent modification of the same file.
- Fixes handling fragment target.
- Fixes the defaulted force behavior to handle empty concats correctly.

##2015-06-02 - Supported Release 1.2.3
###Summary

Expand All @@ -7,6 +17,17 @@ This release includes a README fix to document correct behavior of fragment targ

- README Fix to correctly document how a fragment $target param should work.

##2015-05-12 - Supported Release 2.0.0 [YANKED]
###Summary

This is a major release. Includes re-implementation of concat to use native Type and Providers, resulting in significantly improved performance and testability. Also includes a bugfix to alpha ordering of fragments.

####Features
- Re-implementation of concat to use native Type and Providers.

####Bugfixes
- Fixes a bug in alpha ordering of fragments.

##2015-05-12 - Supported Release 1.2.2
###Summary

Expand Down
15 changes: 6 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,18 @@ def location_for(place, fake_version = nil)
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
if beaker_version
if beaker_version = ENV['BEAKER_VERSION']
gem 'beaker', *location_for(beaker_version)
end
if beaker_rspec_version
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
gem 'beaker-rspec', *location_for(beaker_rspec_version)
else
gem 'beaker-rspec', :require => false
Expand All @@ -36,14 +31,16 @@ group :system_tests do
gem 'beaker-puppet_install_helper', :require => false
end



if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', *location_for(facterversion)
gem 'facter', facterversion, :require => false
else
gem 'facter', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', *location_for(puppetversion)
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ The `concat::setup` class should no longer be directly included in the manifest.

##Limitations

This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified.
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 Solaris 12.

##Development

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
14 changes: 11 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,18 @@
true: {
$warn_message = $default_warn_message
}
# lint:ignore:quoted_booleans
'true', 'yes', 'on': {
# lint:endignore
warning($bool_warn_message)
$warn_message = $default_warn_message
}
false: {
$warn_message = ''
}
# lint:ignore:quoted_booleans
'false', 'no', 'off': {
# lint:endignore
warning($bool_warn_message)
$warn_message = ''
}
Expand Down Expand Up @@ -201,14 +205,16 @@
$command = strip(regsubst("${script_command} -o \"${fragdir}/${concat_name}\" -d \"${fragdir}\" ${warnflag} ${forceflag} ${orderflag} ${newlineflag}", '\s+', ' ', 'G'))

# make sure ruby is in the path for PE
if defined('$is_pe') and $::is_pe {
if defined('$is_pe') and str2bool("${::is_pe}") { # lint:ignore:only_variable_string
if $::kernel == 'windows' {
$command_path = "${::env_windows_installdir}/bin:${::path}"
} else {
$command_path = "/opt/puppet/bin:${::path}"
$command_path = "/opt/puppetlabs/puppet/bin:/opt/puppet/bin:${::path}"
}
} else {
} elsif $::kernel == 'windows' {
$command_path = $::path
} else {
$command_path = "/opt/puppetlabs/puppet/bin:${::path}"
}

# if puppet is running as root, this exec should also run as root to allow
Expand Down Expand Up @@ -246,7 +252,9 @@
# lint:ignore:quoted_booleans
$absent_exec_command = $::kernel ? {
'windows' => 'cmd.exe /c exit 0',
# lint:ignore:quoted_booleans
default => 'true',
# lint:endignore
}
# lint:endignore

Expand Down
1 change: 1 addition & 0 deletions manifests/setup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
$script_command = $::osfamily? {
'windows' => "ruby.exe '${script_path}'",
'openbsd' => "/usr/local/bin/ruby21 '${script_path}'",
'freebsd' => "/usr/local/bin/ruby '${script_path}'",
default => $script_path
}

Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"operatingsystem": "Solaris",
"operatingsystemrelease": [
"10",
"11"
"11",
"12"
]
},
{
Expand Down
22 changes: 17 additions & 5 deletions spec/acceptance/concat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,40 @@
username = 'root'
groupname = 'system'
scriptname = 'concatfragments.rb'
vardir = default['puppetvardir']
vardir = default.puppet['vardir']
if vardir.nil? or vardir == ''
vardir = '/opt/puppetlabs/puppet/cache'
end
when 'Darwin'
username = 'root'
groupname = 'wheel'
scriptname = 'concatfragments.rb'
vardir = default['puppetvardir']
vardir = default.puppet['vardir']
if vardir.nil? or vardir == ''
vardir = '/opt/puppetlabs/puppet/cache'
end
when 'windows'
username = 'Administrator'
groupname = 'Administrators'
scriptname = 'concatfragments.rb'
result = on default, "echo #{default['puppetvardir']}"
result = on default, "echo #{default.puppet['vardir']}"
vardir = result.raw_output.chomp
when 'Solaris'
username = 'root'
groupname = 'root'
scriptname = 'concatfragments.rb'
vardir = default['puppetvardir']
vardir = default.puppet['vardir']
if vardir.nil? or vardir == ''
vardir = '/opt/puppetlabs/puppet/cache'
end
else
username = 'root'
groupname = 'root'
scriptname = 'concatfragments.rb'
vardir = default['puppetvardir']
vardir = default.puppet['vardir']
if vardir.nil? or vardir == ''
vardir = '/opt/puppetlabs/puppet/cache'
end
end

describe 'basic concat test' do
Expand Down
30 changes: 19 additions & 11 deletions spec/unit/defines/concat_fragment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@
should contain_file("#{fragdir}/fragments/#{p[:order]}_#{safe_name}").with({
:ensure => safe_ensure,
:owner => id,
:group => gid,
:mode => '0640',
:source => p[:source],
:content => p[:content],
:alias => "concat_fragment_#{title}",
:backup => 'puppet',
})
# The defined() function doesn't seem to work properly with puppet 3.4 and rspec.
# defined() works on its own, rspec works on its own, but together they
# determine that $gid is not defined and cause errors here. Work around
# it by ignoring this check for older puppet version.
if Puppet::Util::Package.versioncmp(Puppet.version, '3.5.0') >= 0
should contain_file("#{fragdir}/fragments/#{p[:order]}_#{safe_name}").with({
:group => gid,
})
end
end
end

Expand All @@ -79,7 +87,7 @@
let(:params) {{ :target => false }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a string/)
end
end
end # target =>
Expand Down Expand Up @@ -121,7 +129,7 @@
let(:params) {{ :content => false, :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a string/)
end
end
end # content =>
Expand All @@ -142,7 +150,7 @@
let(:params) {{ :source => false, :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string or an Array/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a string or an Array/)
end
end
end # source =>
Expand All @@ -163,7 +171,7 @@
let(:params) {{ :order => false, :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /is not a string or integer/)
expect { catalogue }.to raise_error(Puppet::Error, /is not a string or integer/)
end
end

Expand All @@ -173,7 +181,7 @@
let(:params) {{ :order => '123:456', :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /cannot contain/)
expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
end
end
context '123/456' do
Expand All @@ -182,7 +190,7 @@
let(:params) {{ :order => '123/456', :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /cannot contain/)
expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
end
end
context '123\n456' do
Expand All @@ -191,7 +199,7 @@
let(:params) {{ :order => "123\n456", :target => '/etc/motd' }}

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /cannot contain/)
expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
end
end
end # order =>
Expand Down Expand Up @@ -219,7 +227,7 @@
end

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
end
end

Expand All @@ -243,7 +251,7 @@
end

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
end
end

Expand All @@ -267,7 +275,7 @@
end

it 'should fail' do
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
end
end

Expand Down
Loading

0 comments on commit 89fceb4

Please sign in to comment.