That's is a simplified version of my actual use case:
$mythings.each | String $x | { # for each x in list 'mythings'
notify { "gonna do something with $x": }
....
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.
Why does this:
class mymodule {
notify { "booboo": }
notify { "booboo": }
provoke the error:
Error while evaluating a Resource Statement, Duplicate declaration: Notify[booboo] is already declared in file xxxx
That's is a simplified version of my actual use case:
$mythings.each | String $x | { # for each x in list 'mythings'
notify { "gonna do something with $x": }
....
In plain english, for example, I may have a list of rpms and want to loop through them to ensure all are installed.
What would be the correct way to do this, if not the above?
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.
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?
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": }
}
That's is a simplified version of my actual use case:
$mythings.each | String $x | { # for each x in list 'mythings'
notify { "gonna do something with $x": }
....