Forum: CFEngine Help Subject: Re: downsizing a huge policy file, sensibly Author: davidlee Link to topic: https://cfengine.com/forum/read.php?3,24050,24114#msg-24114
Marco: Basically, as Todd says. (Thanks, Todd!). Below is a variant of the last box in my earlier reply, but simplifying the caller from a list to a string: ---------- bundle agent caller_N { vars: # construct data ending with: "user_a" string => "ua_k1_value; "user_a" string => "ua_k2_value; methods: # Note that we pass the fully-qualified name of our assoc. array. possibly_general:: "any" usebundle => action_user_promise("caller_N.user_a"); } bundle action_user_promise(v) { # use "$(v)" etc. } ---------- Note, importantly, the "caller_N" component to the variable in the "usebundle" line. As I understand it, what this does is to pass its argument as a simple string "caller_N.user_a", which just happens to be the fully-qualified name of the caller's variable. We then write the called bundle (action_user_promise), knowing that this incoming "v" argument (at first sight a string) is actually an associative array. The well-established example of this in the standard library "cfengine_stdlib.cf" is "set_variable_values". _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine