First lets start with a suggestion. there a lot function that return a 
class, mabye a new function:
   - LISA_CLUSTER expression => getenv_class("LISA");

Which set the class LISA_CLUSTER if the variable is defined. We now use 
getenv and strcmp to do this

I am reading a lot of documentation but i am a bit lost. You must read 
carefully what is for the community edition and what is for the other 
versions. I find this a bit confusing. Baer in mind i must get acquainted 
with the new syntax.

I am trying to switch from cfengine2 to cfengine3. We make use of the 
PrepModule to set some useful GLOBAL classes with the aid of a script. Just 
print/echo +<class> to stdout. Can this be accomplished with cfengine3.

I am using cfengine community edition 3.0.4 and i get this error/warning. 
But the class can not be true, because the environent variable is set.
{{{
  !! Redefinition of a constant variable "CLUSTER"
Promise (version 1.0.1) belongs to bundle 'g' in file 
'/var/lib/cfengine3/inputs/promises.cf' near line 51
  !! Redefinition of a constant variable "cluster_file"
Promise (version 1.0.1) belongs to bundle 'g' in file 
'/var/lib/cfengine3/inputs/promises.cf' near line 52
}}}

the promises.cf file:
{{{
bundle common g
{
vars:
        "lisa" string => getenv("LISA_CLUSTER","1");

        LISA_CLUSTER::
                 "CLUSTER" string => "LISA";
                 "cluster_file" string => "lisa.cf";
         !LISA_CLUSTER::
                 "CLUSTER" string => "NOT LISA";
                 "cluster_file" string => "common.cf";


classes:
        "LISA_CLUSTER" expression => strcmp("$(lisa)","1");
}

This is due the fact that vars is evaluated sooner the class is set. What i 
want is to import files based on a class that is not known. Or is there a 
better syntax for cf3 that i did not find.

-- 
********************************************************************
*  Bas van der Vlies                    e-mail: b...@sara.nl       *
*  SARA - Academic Computing Services   Amsterdam, The Netherlands *
********************************************************************
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to