Classes in "common" bundles are global, yes. Consider the following
example:

body common control
{
bundlesequence => { "g","tryclasses_1", "tryclasses_2" };
}

#################################

bundle common g
{
classes:

  "one" expression => "any";

}

#################################

bundle agent tryclasses_1
{
classes:

  "two" expression => "any";
}

#################################

bundle agent tryclasses_2
{
classes:

  "three" expression => "any";

reports:

  one.three.!two::

    "Success";
}


What is arguably misleading at the moment is that the common
bundle also must be in the bundlesequence in order to be evaluated.
This is not true for variables, which get evaluated anyway. I am in
two minds as to what the behaviour should be. The evaluated is fraught
with potential paradoxes unless this is explicit. There is a
chicken-egg issue in what should be evaluated first - vars or
classes.. I'll think about this.

M

Jim Wight wrote:
> I was expecting classes to be global, like variables. Is it not possible to 
> do 
> what I am attempting in the commented-out statements in the following? I get 
> a 
> syntax error.
> 
> body common control
> {
> bundlesequence => { "month" };
> }
> 
> bundle common g
> {
> classes:
>     "month1" expression => "January";
> 
> vars:
>     month1::
>       "mth1" string => "January (common)";
>     !month1::
>       "mth1" string => "Not January";
> }
> 
> bundle agent month
> {
> classes:
>     "month2" expression => "January";
> 
> reports:
>     month2::
>        "January (agent)" ;
>     January::
>        "$(g.mth1)";
> 
> #   $(g.month1)::
> #      "$(g.mth1)";
> }
> 
> BTW, this reports
> 
> January (agent)
> Not January
> 
> so expression (at least) still doesn't work in "bundle common".
> 
> Jim
> 
> 
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-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
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to