Toddni, Zzamboni, I'd totally forgotten that classes defined as a class attribute are global! Does look like the workaround is to make them unique-per-call in the way you suggest. (And I need to check the whole namespace in my production promises for collisions!)
Also, the example presented is just a test case, to show what I was seeing. Thanks for your help, Simon -----Original Message----- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of no-re...@cfengine.com Sent: 25 January 2012 07:10 To: help-cfengine@cfengine.org Subject: CFEngine Help: Re: methods, usebundle and loops Forum: CFEngine Help Subject: Re: methods, usebundle and loops Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,24644,24646#msg-24646 It's like toddni said - you are defining the same class on every call, and classes defined by a classes attribute are global. This is documented in https://cfengine.com/manuals/cf3-reference.html#classes-in-_002a: Synopsis: A list of classes to be defined globally So what you would have to do in a case like this is to define a different class for every value that you want to check. The following works: bundle agent echoname(name) { commands: "/bin/echo $(name)" ifvarclass => "!echo_run_$(name)", classes => if_repaired("echo_run_$(name)"); } In this particular case, as toddni said, it's not necessary to do the class-checking, because cfengine will automatically check if it has already run each command recently. Without the check, each name gets printed once, even if they are repeated in the list: bundle agent example { vars: "names" slist => { "paul", "george", "paul", "ringo", "ringo", "george", "john" }; methods: "any" usebundle => echoname("$(names)"); } bundle agent echoname(name) { commands: "/bin/echo $(name)"; } Of course, this may not be the case for a real example, so you may still need to do the ifvarclass/classes combination in your real promises. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine