Remove dependency on stdlib4
This commit is contained in:
parent
ebadb90818
commit
3d167883dd
6 changed files with 170 additions and 11 deletions
|
@ -1,9 +0,0 @@
|
|||
name 'puppetlabs-concat'
|
||||
version '1.1.0'
|
||||
source 'git://github.com/puppetlabs/puppetlabs-concat.git'
|
||||
author 'Puppetlabs'
|
||||
license 'Apache 2.0'
|
||||
summary 'Concat module'
|
||||
description 'Concat module'
|
||||
project_page 'http://github.com/puppetlabs/puppetlabs-concat'
|
||||
dependency 'puppetlabs/stdlib', '>= 4.2.0'
|
35
lib/puppet/parser/functions/concat_getparam.rb
Normal file
35
lib/puppet/parser/functions/concat_getparam.rb
Normal file
|
@ -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
lib/puppet/parser/functions/concat_is_bool.rb
Normal file
22
lib/puppet/parser/functions/concat_is_bool.rb
Normal file
|
@ -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 :
|
|
@ -56,7 +56,7 @@ define concat::fragment(
|
|||
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.')
|
||||
|
|
|
@ -75,7 +75,7 @@ define concat(
|
|||
fail('$warn is not a string or boolean')
|
||||
}
|
||||
validate_bool($force)
|
||||
if ! is_bool($backup) and ! is_string($backup) {
|
||||
if ! concat_is_bool($backup) and ! is_string($backup) {
|
||||
fail('$backup must be string or bool!')
|
||||
}
|
||||
validate_bool($replace)
|
||||
|
|
111
metadata.json
Normal file
111
metadata.json
Normal file
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
"name": "puppetlabs-concat",
|
||||
"version": "1.1.0",
|
||||
"author": "Puppet Labs",
|
||||
"summary": "Concat module",
|
||||
"license": "Apache-2.0",
|
||||
"source": "https://github.com/puppetlabs/puppetlabs-concat",
|
||||
"project_page": "https://github.com/puppetlabs/puppetlabs-concat",
|
||||
"issues_url": "https://github.com/puppetlabs/puppetlabs-concat/issues",
|
||||
"operatingsystem_support": [
|
||||
{
|
||||
"operatingsystem": "RedHat",
|
||||
"operatingsystemrelease": [
|
||||
"5",
|
||||
"6",
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "CentOS",
|
||||
"operatingsystemrelease": [
|
||||
"5",
|
||||
"6",
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "OracleLinux",
|
||||
"operatingsystemrelease": [
|
||||
"5",
|
||||
"6",
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Scientific",
|
||||
"operatingsystemrelease": [
|
||||
"5",
|
||||
"6",
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "SLES",
|
||||
"operatingsystemrelease": [
|
||||
"11 SP1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Debian",
|
||||
"operatingsystemrelease": [
|
||||
"6",
|
||||
"7"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Ubuntu",
|
||||
"operatingsystemrelease": [
|
||||
"10.04",
|
||||
"12.04",
|
||||
"14.04"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Solaris",
|
||||
"operatingsystemrelease": [
|
||||
"10",
|
||||
"11"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Windows",
|
||||
"operatingsystemrelease": [
|
||||
"Server 2003 R2",
|
||||
"Server 2008 R2",
|
||||
"Server 2012",
|
||||
"Server 2012 R2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "AIX",
|
||||
"operatingsystemrelease": [
|
||||
"5.3",
|
||||
"6.1",
|
||||
"7.1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "OSX",
|
||||
"operatingsystemrelease": [
|
||||
"10.9"
|
||||
]
|
||||
}
|
||||
],
|
||||
"requirements": [
|
||||
{
|
||||
"name": "pe",
|
||||
"version_requirement": "3.x"
|
||||
},
|
||||
{
|
||||
"name": "puppet",
|
||||
"version_requirement": "3.x"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "puppetlabs/stdlib",
|
||||
"version_requirement": ">= 3.2.0 < 5.0.0"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue