On Thursday, November 23, 2017 at 5:20:54 PM UTC+1, Peter Faller wrote:
>
>
> The error occurs because you have two resources of the same type (notify)
> with the same name ('booboo'). Remember that 'notify' is not like a '
> log.info' - it is a resource in it's own right, and each 'notify' has to
> have a unique name.
>
Is there anything like a simple log.info? The only ones I found in the doc
output only to the puppet master log, but what I need is to output info
somewhere on the agent side.
>
> Your code looks OK- as long as you don't have duplicates in $mythings.
> What is the output you get from your actual use case?
>
Here's an actual use case. My cmdb gives me the following data:
{ "dns": {"domain": "example.com", "resolvers": ["4.4.4.4", "8.8.8.8" ]} }
Code:
$dns[resolvers].each | String $resolver | {
file_line { 'adding ns $resolver': path => '/etc/resolv.conf', line =>
'nameserver $resolver', }
notify { "just added $resolver to /etc/resolv.conf": }
}
The loop will provoke the duplicate declaration error, but how else is a
loop supposed to work?
I have tons of more complex use cases that will depend on loops like this
(managing rpms, directories, cluster resources, jvms, adding entries in
config files, etc), including situations where I might have duplicates for
valid reasons.
If this is completely the wrong approach, what's a better alternative?
--
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/cca02fa2-90fa-470e-8b90-c6aa2c9bac10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.