Hello all, I want to check with you if my understanding of the following is correct or not:
Assuming the following cfengine script: body common control { bundlesequence => { "do_example1" }; } bundle agent do_example1 { methods: "do_one" usebundle => do_master("AB", "BA BB BC"); "do_two" usebundle => do_master("AC", "CA CB CC"); "do_3" usebundle => do_master("AD", "DA DB DC"); } bundle agent do_master(ml, sl) { vars: "bundle_name" string => "do_master"; "list" slist => splitstring("$(sl)"," ","20"); methods: "onebyone" usebundle => do_item("$(ml)", "$(list)"); reports: cfengine_3:: " $(bundle_name) P ml => $(ml)"; " $(bundle_name) P sl => $(sl)"; " $(bundle_name) V list => $(list)"; } bundle agent do_item(ml, item) { vars: "bundle_name" string => "do_item"; reports: cfengine_3:: " $(bundle_name) P ml => $(ml)"; " $(bundle_name) P item => $(item)"; } And the following output from the cf-agent run of the above script: Created by the call to "do_one" usebundle => do_master("AB", "BA BB BC"); R: do_item P ml => AB R: do_item P item => BA R: do_item P item => BB R: do_item P item => BC R: do_master P ml => AB R: do_master P sl => BA BB BC R: do_master V list => BA R: do_master V list => BB R: do_master V list => BC Created by the call to "do_two" usebundle => do_master("AC", "CA CB CC"); Note that the report promises for the slist parameter are not displayed and the do_item bundle is only called once R: do_item P ml => AC R: do_master P ml => AC R: do_master P sl => CA CB CC Created by the call to "do_3" usebundle => do_master("AD", "DA DB DC"); same not as above R: do_item P ml => AD R: do_master P ml => AD R: do_master P sl => DA DB DC My observations are: 1) The first call to the do_master bundle executes every single promises 2) All the calls to the do_master bundle that follow the initial call behave differently. 3) By differently I mean: The "list" slist => splitstring("$(sl)"," ","20"); promise is executed only once on the first call. After the first call the promise is never executed again. Causing the report promises about the list to be executed upon the first call and not on the following calls to the do_master bundle even though each call is made with different parameter values. My question is: Is this the expected behavior or should the list slist promise be re-evaluated upon each new call. My opinion: If it is the expected behavior then this is not convergent i.e. changing the call order will produce a different state. Therefore I would expect this to be a major/critical bug... otherwise if it is the expected behavior... well I do not understand the logic behind it except to accept that once a vars is set it can't be change no matter what!!!! I would like to get to the bottom of this one since I have been plagued with all sorts of problems related to this... Thanks, Marco p.s. this script has been run on --> This comprises cf-agent core community version 3.0.5p1 - Copyright (C) Cfengine AS 2008-
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine