Add spec tests to test the new functionality:
*Case for 3 arrays.
*Case for 4 arrays.
Modify README to note new functionality.
This is for issue MODULE-2456, follow the precedent of MODULE-444.
This change allows union to be much more useful, unioning many arrays
in one line rather than in n lines. Additionally, as this is only added
functionality, and does not affect the 2 array case that all modules
currently using array are using, it should not affect any existing
modules utilizing union.
This is now useful, for example, for merging many arrays of resources
(eg: packages.) to generate just one list with no duplicates, to avoid
duplicate resource declarations.
This function loads the metadata.json into a puppet variable. This enables a number of neat things such as:
* Which version of the module am I using? 2.x? 3.x?
* Which author of the module am I using? puppetlabs? example42?
Without this, file_line resource without the `match` parameter but with the `after` param will throw an error if there are multiple matches for the after expression. This patch creates the handling for the `multiple` parameter in handle_create_with_after. This allows you to add a line after the `after` expression if it appears at multiple points in a file.
Updated reference to `file_line` in the README to reflect that the multiple parameter can be set when using `after` and/or `match` as the matching regex.
As mentioned in #270, private is a reserved keyword in the future parser
which is to be released with Puppet 4. As it stands, this function is
not useable with the future parser so it needs to renamed.
This is a breaking change.
The `type()` function will cease to work on the new parser because 'type'
is a reserved keyword. The `type3x()` function may be used to continue
similar functionality, but will be deprecated in favor of the built-in
typing system.
The `type_of()` function has been included to introspect types in the
new parser.
Was unclear and not accurate; rewrote the parameter, moved file_line from function list to resource section, added missing parameters for this resource.
Without this patch one can not specify package resource specific
parameters. All the ensure_packages() function does it makes sure
the named packages are installed. This patch allows one to pass
default as a second argument and allow greater flexibility on
packages installations.
Use case like the following are now possible :
* ensure_packages(['r10k', 'serverspec'], {'provider' => 'gem'})
* ensure_packages(['ntp'], {'require' => 'Exec[foobar]'})
Since we've moved from Redmine to Jira the links need to be updated so
that people know where to look for issues.
At the moment stdlib is being tracked with puppet in the PUP project.
This doesn't seem like a good, long term solution, but it is where we
are right now.
Without this patch there is a disconnect between the documentation in
the README and our decision to not merge pull requests into the 4.x
series that break compatibility with Puppet 2.7.x
For example:
@jeffmccune I think the real issue here is that "policy" is out of sync with
the documentation. The README claims that 4.x does not support puppet 2.7.x,
yet the "policy" is not to merge patches that break 2.7.x. Due to that I'm sure
there are a lot of 2.7.x installations out there that have a 4.x version of
stdlib installed. That's going to cause a rather rude surprise if some future
version of 4.x stops working where a prior minor release was functioning.
I'd like to suggest that the documentation be changed to reflect 4.x supporting
2.7.x and that a new major version bump is made when 2.7.x support can in fact
be dropped. An alternative solution would be update the README with a note to
developers about the kinda/sorta/maybe/fishy/quasi support of 2.7.x.
Please also see this discussion:
https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414
Markdown interprets [] folowed by () as a link, which was a 404 and not
the intention of the original author. This patch ensures that the
document reads as intended, without the link.
This patch allows an array of resource titles to be passed into
the ensure_resource function. Each item in the array will be
checked for existence and will be created if it doesn't already
exist.
Without this patch some core puppet functions leaked into the
documentation for the functions contained in stdlib. This patch removes
them and cleans up some of the formatting.
Without this patch the function documentation is out of sync with the
functions contained in the standard library. This commit updates the
functions. I generated the list using this sequence:
cd ~/src/puppet
git checkout 3.1.1
bundle exec puppet doc -r function > /tmp/puppet_functions.txt
cd ~/src/stdlib
bundle exec puppet doc -r function > /tmp/stdlib_functions.txt
diff -U2 puppet_functions.txt stdlib_functions.txt | grep '^+' | perl -ple 's/^\+//' > functions.txt
I then replaced the README function documentation with the contents of
functions.txt which contains only the functions contained in stdlib.
Without this patch applied there is no easy way to append one array to
another. This is a problem because it is often desirable to join two
arrays without flattening the contents into a single, one dimensional
array.
This patch addresses the problem by adding a `concat()` function which
takes two arguments. The arguments will be concatenated together and a
new array returned to the caller.
Reviewed-by: Jeff McCune <jeff@puppetlabs.com>
As far as i know there's no other puppet-dsl-like way to get parameter of
defined resource, so that's why i implemented getparam function, which takes
resource reference and parameter name and returns parameter value.
Here's another example why this function is really useful:
define config($path, $config_param1, $config_param2) { }
define example_resource($config) {
$path = getparam($config, "path")
notice("Path is $path")
}
define example_resource2($example_resource, $config = getparam($example_resource, "config")) {
$config_param1 = getparam($config, "config_param1")
notice("Config parameter is $config_param1")
}
define example_resource3($example_resource, $config = getparam($example_resource, "config")) {
$config_param2 = getparam($config, "config_param2")
notice("Config parameter is $config_param2")
}
class test_getparam {
config { "config_instance":
path => "/some/config/path",
config_param1 => "someconfigtext1",
config_param2 => "someconfigtext2",
}
example_resource { "example_resource_instance":
config => Config["config_instance"]
}
example_resource2 { "example_resource_instance":
example_resource => Example_resource["example_resource_instance"]
}
example_resource3 { "example_resource_instance":
example_resource => Example_resource2["example_resource_instance"]
}
}
class { "test_getparam": }
Without this patch stdlib has Travis CI configuration files, but they
don't seem to completely specify the dependency versions and the build
matrix. This patch addresses the problem by putting the dependency
information in the conventional Gemfile location.
This patch should coincide with enabling Travis CI support for pull
requests. A build status image is also included in the project README.
Without this patch the README contains the documentation for core
functions shipped in Puppet in addition to the functions shipped in
stdlib.
This is a problem because it's confusing for end users trying to get
started with puppet.
This patch makes it so only the stdlib functions are included.
As reported, it is indeed difficult to navigate directly to the correct
part of Redmine for a particular sub-project. This commit puts the
issue tracker URL front and center.
As reported, it is indeed difficult to navigate directly to the correct
part of Redmine for a particular sub-project. This commit puts the
issue tracker URL front and center.
This commit updates the README for 3.0.0 by taking a function list
produced with `puppet doc -r function` _without_ stdlib in the
`$LOAD_PATH` and then filtering out the native functions by executing
`puppet doc -r function` _with_ stdlib/lib in the `$LOAD_PATH` and then
running `comm -13 core_functions.txt all_functions.txt`
This patch adds semantic versioning information to the README of this
module. This information is missing and unclear without this patch.
This should help clarify the support matrix for the Standard Library as
it relates to Puppet Enterprise released versions.