I think what you're looking for is the "undefined" variable policy.

http://www.cfengine.org/manuals/cf3-reference.html#policy-in-vars
--
/* Wes Hardin */
UNIX System Administrator, IT Engineering Support
Maxim Integrated Products: Innovation Delivered

On 05/26/2010 12:37 PM, Daniel Dehennin wrote:
> Hello,
>
> I'm trying to use what I founded in the reference manual[1] like this:
> body common control
> {
>      bundlesequence =>  { "test" };
>      version =>  "0.0.1";
> }
>
> bundle agent test
> {
> vars:
>      any::
>          "list" slist =>  {"0", @(l1), @(l2)};
>
>      Class1::
>          "l1" slist =>  {"1", "2"};
>
>      Class2::
>          "l2" slist =>  {"3", "4"};
>
> commands:
>      "/bin/echo $(list)";
> }
>
> "cf-agent -KI" gives:
> Q: ".../bin/echo 0": 0
> Q: ".../bin/echo @(l1)": @(l1)
> Q: ".../bin/echo @(l2)": @(l2)
>
> when "cf-agent -KI -DClass1" gives:
> Q: ".../bin/echo 0": 0
> Q: ".../bin/echo 1": 1
> Q: ".../bin/echo 2": 2
> Q: ".../bin/echo @(l2)": @(l2)
>
> Is there a way to discard undefined variables?
>
> Regards.
>
> Footnotes:
> [1]  
> http://www.cfengine.org/manuals/cf3-reference.html#List-variable-substitution-and-expansion
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to