Inside a custom function, how can you know if noop is enabled ?

21 views
Skip to first unread message

Frédéric Lespez

unread,
Sep 5, 2015, 5:10:51 PM9/5/15
to Puppet Users
Hi,

Inside a manifest, you can know if noop is enabled thanks to the $clientnoop variable[1].
But inside a custom function, how can you know it ?

For now, I added a parameter to my function in order to send the value $clientnoop. But it is not very elegant.

Any suggestions ?

Thanks in advance for your help.
Fred

[1] https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#puppet-agent-facts

Martin Alfke

unread,
Sep 6, 2015, 3:54:57 AM9/6/15
to puppet...@googlegroups.com
Hi Fred,
On 05 Sep 2015, at 19:36, Frédéric Lespez <frederi...@gmail.com> wrote:

> Hi,
>
> Inside a manifest, you can know if noop is enabled thanks to the $clientnoop variable[1].
> But inside a custom function, how can you know it ?

$clientnnop is a fact [1]
You can access facts from functions e.g. by using lookupvar(‘clientnoop’) [2]

[1]https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#puppet-agent-facts
[2]https://docs.puppetlabs.com/guides/custom_functions.html#using-facts-and-variables

hth,
Martin

Reply all
Reply to author
Forward
0 new messages