On 2015-27-02 8:59, Alex Bogatu wrote:
Hello!
I spent the last couple of days trying to find a good way to search
facts specific to some node based on ragex. For example, in my puppet
manifest i need a way to check if there are facts whose names (not
values) match a specific regex.  Is there anyone who had this problem
before? I know that it might be done using inline ruby code, but i
wonder if there is no other solution.


See here: https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#the-factsfactname-hash

Then using the standard lib function keys() on $facts to get an array of the keys. You can then use the in operator to search.
Alternatively use the standard lib function has_key($facts).

If you are using parser=future you can also iterate over the hash's keys and values directly.

- henrik

--
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/f4c9d059-c989-4ea4-86f6-418e786f2f9b%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/f4c9d059-c989-4ea4-86f6-418e786f2f9b%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/mcptnu%247gp%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to