Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ mod 'common',
:git => 'https://github.com/purpleidea/puppet-common.git'

mod 'concat',
:commit => '07bba0bcad2e3a2baf19dbff8b1a5146d9141153',
:git => 'https://github.com/puppetlabs/puppetlabs-concat.git'
:commit => '644fb1b6dc8b64accc4d1208d6127b79a08a38b7'
:git => 'https://github.com/puppetlabs/puppetlabs-concat.git',

mod 'firewall',
:commit => 'd5a10f5a52d84b9fcfb8fc65ef505685a07d5799',
Expand Down
4 changes: 1 addition & 3 deletions concat/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ 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"
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
Expand Down
127 changes: 102 additions & 25 deletions concat/CHANGELOG → concat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
2014-05-14 1.1.0
##2014-09-10 - Supported Release 1.1.1

Summary
###Summary

This is a bugfix release, and the first supported release of the 1.1.x series.

####Bugfixes
- Make the `$order` parameter default to a string and be validated as an integer
or a string
- Use the ruby script on Solaris to not break Sol10 support
- Add quotes to the ruby script location for Windows
- Fix typos in README.md
- Make regex in concat::setup case-insensitive to make it work on Windows
- Make sure concat fragments are always replaced
- Fix validation to allow `$backup` to be a boolean
- Remove dependency on stdlib 4.x
- Fix for lack of idempotency with `ensure => 'absent'`
- Fix tests and spec_helper
- Synchronized files for more consistency across modules via modulesync

##2014-05-14 - Release 1.1.0

###Summary

This release is primarily a bugfix release since 1.1.0-rc1.

Features:
####Features
- Improved testing, with tests moved to beaker

Bugfixes:
####Bugfixes
- No longer attempts to set fragment owner and mode on Windows
- Fix numeric sorting
- Fix incorrect quoting
- Fix newlines

2014-01-03 1.1.0-rc1
##2014-01-03 - Release 1.1.0-rc1

Summary:
###Summary

This release of concat was 90% written by Joshua Hoblitt, and the module team
would like to thank him for the huge amount of work he put into this release.
Expand All @@ -33,49 +53,106 @@ warnings and we'll be aggressively moving for a 2.0 to remove those too.
For further information on deprecations, please read:
https://github.com/puppetlabs/puppetlabs-concat/blob/master/README.md#api-deprecations

Removed:
####Removed
- Puppet 0.24 support.
- Filebucket backup of all file resources except the target concatenated file.
- Default owner/user/group values.
- Purging of long unused /usr/local/bin/concatfragments.sh

Features:
###Features
- Windows support via a ruby version of the concat bash script.
- Huge amount of acceptance testing work added.
- Documentation (README) completely rewritten.
- New parameters in concat:
- `ensure`: Controls if the file should be present/absent at all.
- Remove requirement to include concat::setup in manifests.
- Made `gnu` parameter deprecated.
- Added parameter validation.
- Remove requirement to include concat::setup in manifests.
- Made `gnu` parameter deprecated.
- Added parameter validation.

###Bugfixes
- Ensure concat::setup runs before concat::fragment in all cases.
- Pluginsync references updated for modern Puppet.
- Fix incorrect group parameter.
- Use $owner instead of $id to avoid confusion with $::id
- Compatibility fixes for Puppet 2.7/ruby 1.8.7
- Use LC_ALL=C instead of LANG=C
- Always exec the concatfragments script as root when running as root.
- Syntax and other cleanup changes.

##2014-06-25 - Supported Release 1.0.4
###Summary

This release has test fixes.

####Features
- Added test support for OSX.

####Bugfixes

####Known bugs

* Not supported on Windows.

##2014-06-04 - Release 1.0.3
###Summary

This release adds compatibility for PE3.3 and fixes tests.

####Features
- Added test support for Ubuntu Trusty.

####Bugfixes

####Known bugs

*Not supported on Windows.

##2014-03-04 - Supported Release 1.0.2
###Summary

This is a supported release. No functional changes were made from 1.0.1.

####Features
- Huge amount of tests backported from 1.1.
- Documentation rewrite.

####Bugfixes

####Known Bugs

* Not supported on Windows.


##2014-02-12 - 1.0.1

###Summary

Minor bugfixes for sorting of fragments and ordering of resources.

####Bugfixes
- LANG => C replaced with LC_ALL => C to reduce spurious recreation of
fragments.
- Corrected pluginsync documentation.
- Ensure concat::setup always runs before fragments.

Bugfixes:
- Ensure concat::setup runs before concat::fragment in all cases.
- Pluginsync references updated for modern Puppet.
- Fix incorrect group parameter.
- Use $owner instead of $id to avoid confusion with $::id
- Compatibility fixes for Puppet 2.7/ruby 1.8.7
- Use LC_ALL=C instead of LANG=C
- Always exec the concatfragments script as root when running as root.
- Syntax and other cleanup changes.

2013-08-09 1.0.0
##2013-08-09 - 1.0.0

Summary:
###Summary

Many new features and bugfixes in this release, and if you're a heavy concat
user you should test carefully before upgrading. The features should all be
backwards compatible but only light testing has been done from our side before
this release.

Features:
####Features
- New parameters in concat:
- `replace`: specify if concat should replace existing files.
- `ensure_newline`: controls if fragments should contain a newline at the end.
- Improved README documentation.
- Add rspec:system tests (rake spec:system to test concat)

Bugfixes
####Bugfixes
- Gracefully handle \n in a fragment resource name.
- Adding more helpful message for 'pluginsync = true'
- Allow passing `source` and `content` directly to file resource, rather than
Expand All @@ -85,7 +162,7 @@ defining resource defaults.
- Allow WARNMSG to contain/start with '#'.
- Replace while-read pattern with for-do in order to support Solaris.

CHANGELOG:
####CHANGELOG:
- 2010/02/19 - initial release
- 2010/03/12 - add support for 0.24.8 and newer
- make the location of sort configurable
Expand Down
2 changes: 1 addition & 1 deletion concat/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ group :development, :test do
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'puppet-lint', '0.3.2', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'pry', :require => false
Expand Down
9 changes: 0 additions & 9 deletions concat/Modulefile

This file was deleted.

12 changes: 3 additions & 9 deletions concat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,13 @@ Set the mode of the combined file.

#####`warn`
Determine if a warning message should be added at the top of the file to let
users know it was autogenerated by Puppet.
users know it was autogenerated by Puppet. It should be a boolean or a string
containing the contents of the warning message.

######Example
- warn => true
- warn => false

#####`warn_message`
Set the contents of the warning message.

######Example
- warn_message => 'This file is autogenerated!'
- warn => '# This file is autogenerated!'

#####`force`
Determine if empty files are allowed when no fragments were added.
Expand Down Expand Up @@ -255,8 +251,6 @@ Control the file of fragment created.
######Example
- ensure => 'present'
- ensure => 'absent'
- ensure => 'file'
- ensure => 'directory'

#####`mode`
Set the mode of the fragment.
Expand Down
16 changes: 14 additions & 2 deletions concat/files/concatfragments.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
:test => false,
:force => false,
:warn => "",
:sortarg => ""
:sortarg => "",
:newline => false
}

OptionParser.new do |opts|
Expand Down Expand Up @@ -77,6 +78,10 @@
opts.on("-n", "--sort", "Sort the output numerically rather than the default alpha sort") do
settings[:sortarg] = "-n"
end

opts.on("-l", "--line", "Append a newline") do
settings[:newline] = true
end
end.parse!

# do we have -o?
Expand Down Expand Up @@ -119,8 +124,15 @@
# find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
open('fragments.concat', 'a') do |f|
Dir.entries("fragments").sort.each{ |entry|

if File.file?(File.join("fragments", entry))
f << File.read(File.join("fragments", entry))
f << File.read(File.join("fragments", entry))

# append a newline if we were asked to (invoked with -l)
if settings[:newline]
f << "\n"
end

end
}
end
Expand Down
35 changes: 35 additions & 0 deletions concat/lib/puppet/parser/functions/concat_getparam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Test whether a given class or definition is defined
require 'puppet/parser/functions'

Puppet::Parser::Functions.newfunction(:concat_getparam,
:type => :rvalue,
:doc => <<-'ENDOFDOC'
Takes a resource reference and name of the parameter and
returns value of resource's parameter.

*Examples:*

define example_resource($param) {
}

example_resource { "example_resource_instance":
param => "param_value"
}

concat_getparam(Example_resource["example_resource_instance"], "param")

Would return: param_value
ENDOFDOC
) do |vals|
reference, param = vals
raise(ArgumentError, 'Must specify a reference') unless reference
raise(ArgumentError, 'Must specify name of a parameter') unless param and param.instance_of? String

return '' if param.empty?

if resource = findresource(reference.to_s)
return resource[param] if resource[param]
end

return ''
end
22 changes: 22 additions & 0 deletions concat/lib/puppet/parser/functions/concat_is_bool.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# concat_is_bool.rb
#

module Puppet::Parser::Functions
newfunction(:concat_is_bool, :type => :rvalue, :doc => <<-EOS
Returns true if the variable passed to this function is a boolean.
EOS
) do |arguments|

raise(Puppet::ParseError, "concat_is_bool(): Wrong number of arguments " +
"given (#{arguments.size} for 1)") if arguments.size != 1

type = arguments[0]

result = type.is_a?(TrueClass) || type.is_a?(FalseClass)

return result
end
end

# vim: set ts=2 sw=2 et :
3 changes: 2 additions & 1 deletion concat/manifests/fragment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
warning('The $backup parameter to concat::fragment is deprecated and has no effect')
}
if $ensure == undef {
$my_ensure = getparam(Concat[$target], 'ensure')
$my_ensure = concat_getparam(Concat[$target], 'ensure')
} else {
if ! ($ensure in [ 'present', 'absent' ]) {
warning('Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.')
Expand Down Expand Up @@ -117,6 +117,7 @@
source => $source,
content => $content,
backup => false,
replace => true,
alias => "concat_fragment_${name}",
notify => Exec["concat_${target}"]
}
Expand Down
8 changes: 6 additions & 2 deletions concat/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
fail('$warn is not a string or boolean')
}
validate_bool($force)
validate_string($backup)
if ! concat_is_bool($backup) and ! is_string($backup) {
fail('$backup must be string or bool!')
}
validate_bool($replace)
validate_re($order, '^alpha$|^numeric$')
validate_bool($ensure_newline)
Expand Down Expand Up @@ -221,10 +223,12 @@
default => '/bin:/usr/bin',
}

# Need to have an unless here for idempotency.
exec { "concat_${name}":
alias => "concat_${fragdir}",
command => $absent_exec_command,
path => $absent_exec_path
unless => $absent_exec_command,
path => $absent_exec_path,
}
}
}
Expand Down
Loading