On 7/30/14 1:23 PM, Johan De Wit wrote:
> Hi,
>
> always use quotes when using facts etc in hiera :
>
> :hierarchy:
> - "%{operatingsystem}"
> - default
>
> hth
>
> Johan
>
> On 30/07/14 18:21, Karolis Pabijanskas wrote:
>> Hi All,
>>
>> I am sure this is going to be something completely stupid, but I just
>> can't find the issue :)
>>
>> I have a very simple module that that needs a different filepath
>> depending on the operating system, so I'm trying to call:
>>
>> $global_bashrc_file = hiera("global_bashrc_file")
>>
>> from my module.
>>
>> The hierarchy at the moment is very simple:
>>
>> :hierarchy:
>> - %{operatingsystem}
>> - default
>>
>> Calling notify from the module works just fine and brings back CentOS
>> as my operating system. CentOS.yaml does exist in the datadir and
>> does contain the variable. Running hiera in through the shell does
>> indeed show it working and returns the correct variable:
>>
>> # hiera global_bashrc_file operatingsystem=CentOS
>> /etc/bashrc
>>
>> But when trying to get this value via puppet, I just get an error:
>> Error: Could not retrieve catalog from remote server: Error 400 on
>> SERVER: Could not find data item global_bashrc_file in any Hiera data
>> file and no default supplied at blah
>>
>> It does work perfectly fine if I place the variable in default.yaml,
>> but if I move it to the os-specific yaml it just shouts at me that I
>> have not declared it... Just seems like $operatingsystem does not get
>> passed on from puppet, even though:
>> # facter operatingsystem
>> CentOS
>>
>> and notify '{ "${operatingsystem": }' in puppet works.
>>
>> As mentioned, I am sure I am missing something very trivial, but maybe
>> one of you enlightened ones can point me in the right direction!
>>
>> puppet version is 3.6.2
>> hiera version i 1.3.4
>>
>> Thanks in advance!
>>
>> Karolis
>>
Hi,
Good eye on the quotes, Johan. Whenever you change hiera.yaml, be sure
to restart the puppet master.
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/53D93388.9060604%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.