Hi,

first of all, thanks for your answer.
Using your code I still see the whole $facts hash....

notify { "OS: $facts['os']['family']": }


As Henrik mentioned it must be:

notify { "OS: ${facts['os']['family']}": }

Best,
Arnau

2018-04-23 8:33 GMT+02:00 Johan De Wit <[email protected]>:

> first notify, the index should be quoted ....
>
> notify { "OS: $facts['os']['family']": }
>
> Grts
>
>
>
>
> -----Original message-----
> *From:* Arnau <[email protected]>
> *Sent:* Friday 20th April 2018 14:22
> *To:* [email protected]
> *Subject:* [Puppet Users] Accessgin facts hash from manifests
>
> Hi all,
>
> I'm having the first experiences with puppet 5 & facter 3
>
> In old puppet versions I tend to add debug messages like:
>
> notify { "OS : {::osfamily}: }
>
> and it usually worked.
>
> According to https://puppet.com/docs/puppet/5.3/lang_facts_and_builtin
> _vars.html#accessing-facts-from-puppet-code I can still access the facts
> using the old way, but it recommend to use the facts has, so the new code
> should look like:
>
>
>   notify { "OS: $facts[os][family]": }
>
> But when I do that I get the full list of facts and [os][family] at the
> bottom:
>
>
> Notice: OS: {agent_specified_environment => test, aio_agent_version =>
> 5.5.1, architecture => x86_64, augeas => {version => 1.10.1}
> [.... TONS OF FACTS ...]  clientversion => 5.5.1, clientnoop =>
> false}['os]['family']"
>
> If I use the same syntax in a conditiona statement:
>
>   if $facts['os']['family'] == 'RedHat' {
>     notify { "I'm a RedHat": }
>   }
>
> then it works:
>
> Notice: /Stage[main]/Common::Yumrepos/Notify[I'm a RedHat]/message:
> defined 'message' as 'I\'m a RedHat'
>
> So, what's wrong with the above notify?
>
>
> TIA,
> Arnau
>
>
> --
> 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/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsa
> ANaTchA%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%40zarafa7.
> open-future.be
> <https://groups.google.com/d/msgid/puppet-users/zarafa.5add7e24.7f1a.78dfd5c52ec466fa%40zarafa7.open-future.be?utm_medium=email&utm_source=footer>
> .
> For more options, visit 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAM69jx9JZXckwVUn6ATYi5Arr6cKE8jDgMHyeh-ebBPawjq00g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to