You have a problem here: groupX:: "extra_line" string => "57 10 * * * root nice -n -1 $(path)/$(id)-$(extra).sh";
The problem is that $(extra) is an slist, so you are iterating over it, and that redefines the "extra_line" variable. It's as if you said: groupX:: "extra_line" string => "57 10 * * * root nice -n -1 $(path)/$(id)-y1.sh"; "extra_line" string => "57 10 * * * root nice -n -1 $(path)/$(id)-y2.sh"; "extra_line" string => "57 10 * * * root nice -n -1 $(path)/$(id)-y3.sh"; "extra_line" string => "57 10 * * * root nice -n -1 $(path)/$(id)-y4.sh"; Which, of course, redefines the variable "extra_line". Same problem in groupY "extra_line" string => "$(min[$(extra)]) 10 * * * root nice -n 10 $(path)/$(id)-$(extra).sh"; -Dan > Hello folks, > > I'm stuck with the variables expansion. Maybe somebody can explain me > what's going on? Here is the test bundle: > > ####################################################### > > bundle common g > { > vars: > "crontab" string => "/etc/crontab"; > } > > body common control > { > bundlesequence => { test("on") }; > } > > bundle agent test(state) > { > vars: > "id" string => "test"; > "path" string => "/root/bin"; > > groupX:: > "addon" slist => { "x" }; > > groupY:: > "addon" slist => { "y1", "y2", "y3", "y4" }; > > classes: > "off" expression => regcmp("off", "$(state)"); > > files: > "$(g.crontab)" > comment => "Ensure $(g.crontab) is set up accordingly to state" > , > edit_line => test_crontab("$(id)", "$(path)", "$(state)"); > } > > ######################################################## > > bundle edit_line test_crontab(id, path, state) > { > vars: > "extra" slist => { @(test.addon) }; > > groupX:: > "extra_line" string => "57 10 * * * roo > t > nice -n -1 $(path)/$(id)-$(extra).sh"; > > groupY:: > "min[y1]" int => "56"; > "min[y2]" int => "57"; > "min[y3]" int => "58"; > "min[y4]" int => "59"; > "extra_line" string => "$(min[$(extra)]) 10 * * > * root nice -n 10 $(path)/$(id)-$(extra).sh"; > > classes: > "add_line" not => regline(".*$(path)/$(id).*", "$(edit.filenam > e)"); > "off" expression => regcmp("off", "$(state)"); > > delete_lines: > off:: > ".*$(path)/($id).*" > comment => "Remove appearances of ($id) from the $(edit > .filename)"; > > insert_lines: > !off.add_line:: > "$(extra_line) > 59 10 * * * root $(path)/$(id)" > comment => "Configure $(id) crontab call"; > > reports: > !off.add_line:: > "$(id) added to $(edit.filename)"; > } > > ######################################################## > > When I run cf-promises -v -D groupX -f ./test.cf, I'm getting the > following warnings: > > cf3 Initiate variable convergence... > cf3 !! Redefinition of variable "extra_line" (embedded list in RHS) > in context "test_crontab" > cf3 Initiate control variable convergence... > cf3 Initiate variable convergence... > cf3 !! Redefinition of variable "extra_line" (embedded list in RHS) > in context "test_crontab" > cf3 # Knowledge map reporting feature is only available in version > Nova and above > cf3 -> Defined classes = { [skip] } > cf3 -> Negated Classes = { } > cf3 !! Unresolved variables in rval of "extra_line" in scope test_crontab > cf3 Initiate variable convergence... > cf3 !! Redefinition of variable "extra_line" (embedded list in RHS) > in context "test_crontab" > cf3 !! Unresolved variables in rval of "extra_line" in scope test_crontab > cf3 Initiate control variable convergence... > cf3 -> Inputs are valid > > I consider those messages as warnings because inputs are reported to > be valid, but I would like to eliminate those warnings for cleaning > outputs at least. Can anybody advise me how to achieve that? Thank you > in advance. > > -- > SY, Seva Gluschenko. > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine