On 10/06/16 20:14, aru...@berkeley.edu wrote:
Yikes. When I originally posted I cleaned up identifiable and I took
away too much. I actually was passing everything through like I should.
Since I deleted my test data from the original post, Here's the hiera
data I am having trouble with:

ucb::mail::senders:
  "@%{::clientcert}":
    relay: 'berkeley.edu'

And the resulting hiera call that returns the unexpected entry:

# hiera -h ucb::mail::senders ::clientcert=myhost.ist.berkeley.edu
::environment=arusso_postfix ::fqdn=myhost.ist.berkeley.edu -c
/etc/hiera-test.yaml
{"@%{::clientcert}"=>{"relay"=>"berkeley.edu"},
 "@myhost.ist.berkeley.edu"=>{"relay"=>"berkeley.edu"}}


It looks like hiera is doing it wrong - it ends up adding the interpolated key to the hash without removing the original.

Is the hiera_hash function doing the same from within puppet?

- henrik

The template generated on the host also reflects the fact that the extra
entry is being sent over. I also tried it with other facts, like fqdn
and hostname, and confirmed they all exhibit the same behavior.

Thanks,

Aaron

On Friday, June 10, 2016 at 12:08:59 AM UTC-7, Johan De Wit wrote:

    Hi,


    running hiera from the command line, you have to provide the
    variables you use yourself like


    hiera somekey clientcert=node.example.net <http://node.example.net>


    Here is some reading

    https://puppet.com/blog/debugging-hiera
    <https://puppet.com/blog/debugging-hiera>

    

    hth


    Johan




        -----Original message-----
        *From:* aru...@berkeley.edu <javascript:> <aru...@berkeley.edu
        <javascript:>>
        *Sent:* Thursday 9th June 2016 23:17
        *To:* Puppet Users <puppet...@googlegroups.com <javascript:>>
        *Subject:* [Puppet Users] Unexpected behavior when using
        variable interpolation on a subkey in hiera

        Greetings,

        I'm having trouble using hiera variable interpolation on a
        sub-key. It appears that along with interpolating the variable,
        hiera is also returning the un-interpolated data as well, which
        is causing issues because the un-interpolated data is nonsense.
        I'm currently running Hiera 1.3.4 and Puppet 3.8.5 on RHEL6.

        Here's an example of what I have in hiera:

        # common.yaml
        somekey:
            "%{::clientcert}":
                subsubkey: "data"

        And here's what I get when I query hiera directly:

        $ hiera -h somekey
        {"myhost.example.com
        <http://myhost.example.com>"=>{"subsubkey"=>"data"},
         "%{::clientcert}"=>{"subsubkey"=>"data"}}

        Oddly enough, if I run it without the -h flag, I only get the
        un-interpolated data.

        $ hiera somekey
        {"%{::clientcert}"=>{"subsubkey"=>"data"}}

        Based on my reading of the docs[1], in both cases I would expect
        to get back: {{"myhost.example.com
        <http://myhost.example.com>"=>{"subsubkey"=>"data"}}

        I also tested variable interpolation with the value of
        subsubkey, and hiera properly interpolated it correctly, even on
        the returned entry where %{::clientcert} was left un-interpolated.

        Initially I thought this was somehow related to deep_merge, but
        I tested it out by disabling deep_merge (removing the
        merge_behavior key) and I get the same results.

        Am I misunderstanding how interpolation on sub-keys in hiera
        should work, or is this unintended behavior?

        Thanks,

        Aaron

        [1] https://docs.puppet.com/hiera/1/variables.html
        <https://docs.puppet.com/hiera/1/variables.html>

        --
        You received this message because you are subscribed to the
        Google Groups "Puppet Users" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to puppet-users...@googlegroups.com <javascript:>.
        To view this discussion on the web visit
        
https://groups.google.com/d/msgid/puppet-users/3f69f394-e680-4c4e-9a2f-25e6bf2a961e%40googlegroups.com
        
<https://groups.google.com/d/msgid/puppet-users/3f69f394-e680-4c4e-9a2f-25e6bf2a961e%40googlegroups.com?utm_medium=email&utm_source=footer>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/f76ea91b-41e8-4282-9e4c-db75c8ef5ac0%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/f76ea91b-41e8-4282-9e4c-db75c8ef5ac0%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5526bbbc-8c89-ea89-8ab3-e9c95d1810ff%40puppet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to