Version information
This version is compatible with:
- Puppet Enterprise 3.x
- Puppet 3.x
- , ,
This module has been deprecated by its author since Feb 10th 2021.
The reason given was: No longer maintained/necessary
Start using this module
Documentation
Hiera-undef Puppet Module
This module is provided by Camptocamp
Why this module?
The hiera
functions for Puppet are currently limited by the fact that Puppet
functions cannot receive the undef
value as it gets munged before the function
receives it (see ticket #20923).
This module provides replacement functions that do not accept a default
parameter,
but use undef
instead.
This module was written to ease the migration from Puppet 2.7 to 3.0, by writing
wrapping classes using the hiera_undef()
function. For example:
class wrapping::myapp {
class { 'myapp':
param1 => hiera_undef('myapp::param1'),
param2 => hiera_undef('myapp::param2'),
}
}
This approach allows to emulate data binding in Puppet 2.7 since:
- the name of the variable passed to
hiera_undef
is of the form$class::$param
, compatible with the way data bindings work; - if the variable is not found in Hiera, the function returns
undef
, and the class default is used, just like data bindings would do it.
The advantages of this approach are that:
- only one level of wrapping classes is necessary (no turtles all the way down with global parameters);
- it is compatible with both Puppet 2.X and 3.X;
- the wrapping classes can safely be removed in Puppet 3.X as data binding
will replace the calls to
hiera_undef()
.
Example
A simple example might explain better than words. In the following examples,
the foobar
variable is not found in any Hiera backends in the current scope:
notify { 'test':
message => hiera('foobar', undef),
}
returns:
Notice:
Notice: /Stage[main]//Notify[test]/message: defined 'message' as ''
whereas:
notify { 'test':
message => hiera_undef('foobar'),
}
returns:
Notice: test
Notice: /Stage[main]//Notify[test]/message: defined 'message' as 'test'
Contributing
Please report bugs and feature request using GitHub issue tracker.
For pull requests, it is very much appreciated to check your Puppet manifest with puppet-lint to follow the recommended Puppet style guidelines from the Puppet Labs style guide.
License
Copyright (c) 2013 puppet@camptocamp.com All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2015-08-21 - Release 1.1.17
Use docker for acceptance tests
2015-06-26 - Release 1.1.16
Fix strict_variables activation with rspec-puppet 2.2
2015-05-28 - Release 1.1.15
Add beaker_spec_helper to Gemfile
2015-05-26 - Release 1.1.14
Use random application order in nodeset
2015-05-26 - Release 1.1.13
add utopic & vivid nodesets
2015-05-25 - Release 1.1.12
Don't allow failure on Puppet 4
2015-05-13 - Release 1.1.11
Add puppet-lint-file_source_rights-check gem
2015-05-12 - Release 1.1.10
Don't pin beaker
2015-04-27 - Release 1.1.9
Add nodeset ubuntu-12.04-x86_64-openstack
2015-04-03 - Release 1.1.8
- Confine rspec pinning to ruby 1.8
2015-03-23 - Release 1.1.7
- Various spec improvements
2014-12-02 - Release 1.1.4
- Fix requirement on hiera_puppet in hiera_array_undef
2014-11-17 - Release 1.1.3
- Lint metadata.json
2014-10-20 - Release 1.1.2
- Setup automatic Forge releases