Ask Your Question

Hiera doesn't pick a key [ SOLVED ]

asked 2016-12-21 10:43:29 -0500

craymore gravatar image

updated 2017-02-08 06:55:41 -0500

Hi my dear puppeteers,

I am currently migrating code which used to work in a Puppet 3.8 / Hiera 1.3 setup.

After scratching my head a little regarding some Hiera lookup errors, I realized that those were due to some of the keys' names.

e.g :

Looking up for 'classes', defined like this ...

classes: ["::role::somerole"]

... is successfull

    DEBUG: Found classes in common

However, looking up for 'zbackbone-datamanager-svrtest.version' defined like this ...

zbackbone-datamanager-svrtest.version: "1.3.7"

... is NOT successfull


Renaming the key to zbackbone-datamanager-svrtestversion ( witout the dot . ), makes hiera find the key :

    DEBUG: Found zbackbone-datamanager-svrtestversion in common

I suppose this is a change from Hiera 1.3 to Hiera 3.2.

Is there a part of the Hiera documentation which specifies the key names limitations ?

Thanks beforehand

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-12-23 07:55:59 -0500

DarylW gravatar image

updated 2017-02-09 22:16:44 -0500

The dot syntax, iirc, is used to navigate through hashes.

Qualified keys are composed of a top-level lookup key along with any number of additional subkeys, separated by dots.

For example, to look up an element in a hash:

$ hiera user {"name"=>"kim", "home"=>"/home/kim"}

$ hiera kim

----------- EDIT -----------------

I think it may be related to this bug -

edit flag offensive delete link more


But what about this feature then ? "It is now possible to lookup keys in Hiera data containing the . character (period), by quoting the entire name segment with either single or double quotes"

craymore gravatar imagecraymore ( 2016-12-23 08:23:49 -0500 )edit

Your example was doing a lookup using the hiera cli client.. you tried quoting as stated in the release notes inside of puppet invoking hiera?

DarylW gravatar imageDarylW ( 2017-01-03 08:00:53 -0500 )edit

I tried quoting the entire hiera key ( as per the release notes ), but still ended up having a nil :/ I wish I had an example of what this feature is about then.

craymore gravatar imagecraymore ( 2017-01-03 09:12:57 -0500 )edit

@craymore following the example you gave in the question, you could use something like: $value = hiera("\"zbackbone-datamanager-svrtest.version\"") $value = hiera('"zbackbone-datamanager-svrtest.version"') Let me know if this works... I tested a similar case on Puppet 4.8.2 & Hiera 1.3.4.

luisfdez gravatar imageluisfdez ( 2017-03-17 11:31:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-12-21 10:43:29 -0500

Seen: 95 times

Last updated: Feb 09