Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't specify hiera::hierarchy in hiera #92

Closed
westbywest opened this issue Dec 9, 2015 · 3 comments
Closed

Can't specify hiera::hierarchy in hiera #92

westbywest opened this issue Dec 9, 2015 · 3 comments

Comments

@westbywest
Copy link

Having the default value for the "hierarchy" parameter specified as [], i.e. an empty array, prevents one from providing the value of this parameter via hiera. You need to leave a default parameter value as undef for Puppet to do automatic parameter lookup.

https://docs.puppetlabs.com/hiera/3.0/puppet.html#automatic-parameter-lookup

@westbywest westbywest changed the title Can't specify hiera::hiearchy in hiera Can't specify hiera::hierarchy in hiera Dec 9, 2015
@jyaworski
Copy link
Member

Can you give an example of this failing?

@westbywest
Copy link
Author

Yes. Defining this array in hiera:

hiera::hierarchy:
  - "%{environment}/%{calling_class}"
  - "%{environment}"
  - common

... and then invoking the hiera class with expectation of it picking up the "hierarchy" parameter automatically from hiera fails:

class { 'hiera': }

The class uses '[]' for the parameter value. Specifying a default empty array in code overrides Puppet's automated parameter lookup from hiera, as that lookup only does native merging and not deep merging.

The work-around I have to do is wrap hiera::init in a another class (i.e. a profile class) and do the hiera lookup of "hiera::hierarchy" explicitly.

$hierarchy_real = hiera("hiera::hierarchy", undef)
class { 'hiera':
  hierarchy => hierarchy_real,
}

hunner added a commit that referenced this issue Feb 25, 2016
GH-92: Default to undef for hierarchy on puppet 4+
@hunner
Copy link
Member

hunner commented Feb 25, 2016

Merged in #119

@hunner hunner closed this as completed Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants