Forum: Cfengine Help (Mailing list) Subject: Order of evaluation issues in body common control Author: jgreer Link to topic: https://cfengine.com/forum/read.php?3,16592,16592#msg-16592
I would like to assign different bundlesequences and inputs to different soft classes: body common control { class_test:: bundlesequence => { @(global.sequence), "test" }; inputs => { @(global.includes), "test.cf" }; class_prod:: bundlesequence => { "" }; any:: domain => "localdomain"; } bundle common global { vars: "sequence" slist => { "update", "classes", "main" }; "includes" slist => { "update.cf", "classes.cf", "library.cf" }; classes: "class_test" or => { "my_hostname", "testhost1" }; "class_prod" or => { "not_my_hostname", "testhost2" }; } When I run this as-is, I get undeclared bundles/bodies -- so I know my "sequence" variable is getting expanded in the bundlesequence, but "inputs" isn't sucking in the files I'm asking for: # cf-promises Undeclared promise body "restart_if_count_not()" was referenced in a promise Undeclared promise bundle "append_if_no_such_line()" was referenced in a promise No such FnCall "define_on_repair()" in promise @ /var/cfengine/inputs/promises.cf near line 55 No such FnCall "restart_if_count_not()" in promise @ /var/cfengine/inputs/promises.cf near line 68 Bundle "update" listed in the bundlesequence is not a defined bundle Bundle "classes" listed in the bundlesequence is not a defined bundle Bundle "test" listed in the bundlesequence is not a defined bundle Fatal cfengine error: Errors in promise bundles If I change "class_test::" to the hostname where I'm running the agent, no errors are generated. Is this a bug, or am I missing something about ordering of evaluation of variables, classes, and bundlesequences? And on a related note, is it possible to define (global) classes in a separate file and define bundlesequences conditionally on those? Doesn't seem like that'll be doable - looks like I'll have to define both inputs and bundlesequences in "body common control" in promises.cf. I like the idea of breaking class definitions out into a single file and would like to avoid a monolithic promises.cf. Thanks! -Jessica _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine