On 18-01-11 13:49, Jesse Becker wrote: > On Tue, Jan 18, 2011 at 04:48, Bas van der Vlies<b...@sara.nl> wrote: >>> ## Report if we lost contact with our policy server for an hour >>> # >>> bundle agent cfengine3_check_server_connectivity >>> { >>> vars: >>> "myhosts" slist => { hostsseen("1","notseen","address") }; >>> >>> classes: >>> "cfengine_no_connectivity" expression => reglist("@(myhosts)", >>> escape("$(g.policyserver)")); >>> >>> reports: >>> cfengine_no_connectivity:: >>> "Not seen cfengine3 policy server: $(g.policyserver) for at least a >>> hour"; >>> } >>> >>> >> >> Just a warning for this bundle when i run in verbose mode i get strange >> messages like: >> cf3 !! Duplicate selection of value for variable "myhosts" in scope test >> cf3 !! Rule from /var/tmp/lastseen.cf at/before line 17 >> >> multiple time. I have reported this: >> https://cfengine.com/bugtracker/view.php?id=448 >> >> This is with a version cf3 from trunk > > I wonder.... > > Does it go away if you write: > > > vars: > "myhosts" slist => { hostsseen("1","notseen","address") }, policy => > 'free'; > > > Alternately, if you use a convoluted construct like this? This should > cause the hostseen() function and 'myhosts' variable to be evaluated > only once. > Thanks for tip. So we values change the key is to use the policy statement. This is also useful for storage constructions.
Thanks > bundle agent cfengine3_check_server_connectivity { > vars: > !has_myhosts:: > "myhosts" slist => { hostsseen("1","notseen","address") }; > > classes: > 'has_myhosts' => isvariable('myhosts'); > "cfengine_no_connectivity" expression => > reglist("@(myhosts)",escape("$(g.policyserver)")); > > reports: > cfengine_no_connectivity:: > "Not seen cfengine3 policy server: $(g.policyserver) for at least a hour"; > } > > > > > -- ******************************************************************** * Bas van der Vlies e-mail: b...@sara.nl * * SARA - Academic Computing Services Amsterdam, The Netherlands * ******************************************************************** _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine