I'm trying to set up Cfengine to import (inputs attribute of the common control promise) a country-specific inputs file, and to call a country-specific bundle of promises, if the current instance of Cfengine belongs to the class of that country.
The country class is definited based on the hostname. Is this possible in Cfengine today? My policy has valid syntax but does not work. I suspect this is because the control promise is kept before any of the user-defined bundles are examined. Is there any way to make this work in Cfengine today? [milan00 cfengine_examples]# more 00158_More_Examples__set_a_custom_class_based_on_hostname_pattern_and_use_a_bundle_of_promises_based_on_that_class.cf # import italy.cf and run the italy bundlesequence # only if the hostname matches the pattern mil.* bundle common define_global_classes { classes: "italy" expression => classmatch("mil.*"); } body common control { bundlesequence => { "define_global_classes", "main" }; italy:: inputs => { "italy.cf"}; germany:: inputs => { "germany.cf"}; } bundle agent main { vars: "country" slist => { "italy", "germany" }; methods: "any" usebundle => "$(country)", ifvarclass => "$(country)"; } [milan00 cfengine_examples]# cf-promises -f ./00158_More_Examples__set_a_custom_class_based_on_hostname_pattern_and_use_a_bundle_of_promises_based_on_that_class.cf [milan00 cfengine_examples]# cf-agent -f ./00158_More_Examples__set_a_custom_class_based_on_hostname_pattern_and_use_a_bundle_of_promises_based_on_that_class.cf -KI !! A method attempted to use a bundle "italy" that was apparently not defined! I: Report relates to a promise with handle "" I: Made in version 'not specified' of './00158_More_Examples__set_a_custom_class_based_on_hostname_pattern_and_use_a_bundle_of_promises_based_on_that_class.cf' near line 37 [milan00 cfengine_examples]# I tried moving the classes promise classes: "italy" expression => classmatch("mil.*"); into body common control, but got: syntax error, near token 'classes'. Aleksey _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine