Hi, I've been playing with class persistence recently. The idea is to run potentially heavy class-generating commands not too frequently, but being able to use those classes every time Cfengine runs.
What I have now is this: ---------------------------------------------------------------- bundle common get_the_classes { vars: hourly:: "test_command" string => "some heavy command"; classes: hourly:: "yes_test" expression => strcmp("yes",execresult("$(test_command)","noshell")); "not_test" expression => strcmp("no",execresult("$(test_command)","noshell")); reports: yes_test:: "$(sys.fqhost) test = yes!", classes => persist("yes_test","120"); not_test:: "$(sys.fqhost) test = no!", classes => persist("not_test","120"); !yes_test.!not_test:: "OOPS! $(sys.fqhost) - Something is wrong with test classes!"; } body classes persist(class,time) { promise_repaired => { "$(class)" }; persist_time => "$(time)"; timer_policy => "reset"; } ---------------------------------------------------------------- (The class "hourly" is a splayclass). Is it possible to make the classes persistent in the class promise somehow, or do I have to set the persistence whenever the class is actually used (like with reports in the example above)? I've tried this: classes: hourly:: "yes_test" expression => strcmp("yes",execresult("$(test_command)","noshell")), classes => persist("yes_test","120"); But that didn't do the trick, although it passed as valid syntax. Cheers, -- Trond H. Amundsen <t.h.amund...@usit.uio.no> Center for Information Technology Services, University of Oslo _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine