This has to do with lists, not arrays. There are technical reasons why lists cannot be referenced from remote contexts, and I am ambivalent about the solution. Passing the list as a parameter is a good way of solving the problem *and* making visible the fact that the variable is remote.
Justin Lloyd wrote: > Looks like my problem was basic Cfengine array scoping. I need to assign the > global array to a local slist in each scope where I want to access it. > > bundle common dg { > vars: > "c" => readstringarray("config", ...); > } > > bundle agent dgtest { > vars: > "config" slist => { @(dg.config) }; > > Reports: > "Parameter is $(config[RUNTIME])"; > } > > It's kinda frustrating if I want to use that global array throughout my > policy, which was the idea for having it in the first place. > > Unless I missing something else... > > Justin > > -----Original Message----- > From: nwat...@symcor.com [mailto:nwat...@symcor.com] > Sent: Wednesday, February 03, 2010 12:34 PM > To: Justin Lloyd > Cc: help-cfengine@cfengine.org; help-cfengine-boun...@cfengine.org > Subject: RE: Defining classes using array values > > Still wfm > > [r...@unxxhd01 inputs]# cf-agent -If ./foo.cf > Validation: Scalar item in built-in FnCall isvariable-arg => { > config[RUNTIME] } in rvalue is out of bounds (value should match pattern > [a-zA-Z0-9_$.]+) > R: config[RUNTIME] is a variable with value CONFIG!! > Validation: Scalar item in built-in FnCall isvariable-arg => { > config[RUNTIME] } in rvalue is out of bounds (value should match pattern > [a-zA-Z0-9_$.]+) > Validation: Scalar item in built-in FnCall isvariable-arg => { > config[RUNTIME] } in rvalue is out of bounds (value should match pattern > [a-zA-Z0-9_$.]+) > > [r...@unxxhd01 inputs]# cat foo.cf > ###################### > body common control { > bundlesequence => { "neil" }; > } > > bundle agent neil { > > vars: > > "config[RUNTIME]" string => "CONFIG!!"; > > classes: > > "runtime_${config[RUNTIME]}" expression => > isvariable("config[RUNTIME]"); > > reports: > > redhat:: > "config[RUNTIME] is a variable with value ${config[RUNTIME]}", > ifvarclass => "runtime_${config[RUNTIME]}"; > } > > Sincerely, > -- > Neil Watson > 416-673-3465 > > This electronic communication and any attachments may contain confidential > and proprietary > information of DigitalGlobe, Inc. If you are not the intended recipient, or > an agent or employee > responsible for delivering this communication to the intended recipient, or > if you have received > this communication in error, please do not print, copy, retransmit, > disseminate or > otherwise use the information. Please indicate to the sender that you have > received this > communication in error, and delete the copy you received. DigitalGlobe > reserves the > right to monitor any electronic communication sent or received by its > employees, agents > or representatives. > > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine -- Mark Burgess ------------------------------------------------- Professor of Network and System Administration Oslo University College, Norway Personal Web: http://www.iu.hio.no/~mark Office Telf : +47 22453272 ------------------------------------------------- _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine