Hi.  I thought class identifier naming convention was the same as for
any CFEngine identifier - alphanumeric and underscore only - but I
noticed in 3.2.1 that CFEngine accepts classes that have spaces in
them - if they are slipped in through the ifvarclass attribute.

(The reference manual states:

CFEngine 3 has a new class predicate ifvarclass which is ANDed with
the normal class expression, and which is evaluated together with the
promise. It may contain variables as long as the resulting expansion
is a legal class expression. )

Here is an example of CFEngine 3.2.1 allowing ifvarclass expansion
into an illegal class expression:

 [cfengine00  ~]# cat test.cf

bundle agent example {

    vars:
         "weekdays"
             slist => { "Monday",
                       "Tue  sday",
                       "Wednesday",
                       "Thursday",
                       "Fr  iday",
                      };


    reports:
      cfengine::
        "Hello world!  I love $(weekdays)s!"
             ifvarclass => "$(weekdays)";

}
[cfengine00  ~]#


Verbose run shows "Tue sday" is used as the context for the promise:

cf3> Skipping whole next promise (Hello world!  I love Tue  sdays!),
as var-context Tue  sday is not relevant


Yet when I add the promise


{{{
classes: "To morrow"
   expression => "any";
}}}

I see CFEngine automatically canonifies the identifier:

cf3> Class identifier "To morrow" contains illegal characters - canonifying
cf3> Initiate variable convergence...
cf3>
cf3>      +  Private classes augmented:
cf3>      +       To_morrow
cf3>
cf3>      -  Private classes diminished:

I'd love to know the design thought behind classes type promises
autocanonifying identifiers, but not ifvarclass promises...  is that
done advisedly and if so, why, please?

Best,
-at
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to