Forum: CFEngine Help
Subject: Re: Defining default vars
Author: Seva Gluschenko
Link to topic: https://cfengine.com/forum/read.php?3,23704,23705#msg-23705

David,

having Cfengine running 3 times across promises to feet all cases, you're 
probably able to fit your goal as follows:

vars:
  any::
    v_1 string => "everywhere";

  class_a::
    v_1 string => "only if class_a applies";

  class_b::
    v_1 string => "only if class_b applies";

### Now want to define defaults for "index_2" and "index_3".
### Something like:
   i2_undef::
    v_1 string => "default index_2";

   i3_undef::
    v_1 string => "default index_3";

classes:
   "i2_undef" not => isvariable("v_1");
   "i3_undef" not => isvariable("v_1");


There are limitations for depth expansion, though, so that you'd better 
evaluate with some test to make yourself known if it works.

Still, there's a chance that your goals can be achieved easier way. The complex 
approach can usually be simplified.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to