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] 
<mailto:[email protected]> .
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAM69jx_sAms0%3Da%2B5MhHBtnydtPKsUDeAAcera8tXSsaANaTchA%40mail.gmail.com.
 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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to