One further thought on this:

Looking down the road a bit, we may want to consider handling the "if" 
attribute of a classes promise the same way as the "expression" attribute, 
or vice versa.

I would imagine that newcomers to CFEngine will have no particular reason 
to ever use the "expression" attribute at all, when the default expression 
is "any" and they can express the more complex conditionals they will need 
with an "if" attribute (or an "and" attribute, or "or" attribute, etc.) 
without ever learning "expression."

Currently, the verbose output based on "expression" is different from that 
based on "if" (example shown is running 3.7.1):

[root@hub tmp]# cat classes.cf 
bundle agent main {
  classes:
    any::
      "set_by_expression"
        expression => "any";


      "set_by_if_and_expression"
        if => "any",
        expression => "any";


      "unset_by_if"
        expression => "any",
        if => "!any";


      "unset_by_expression"
        expression => "!any";
}
[root@hub tmp]# cf-agent -f ./classes.cf -vKC | sed -n '/pass 1/,/pass 2/p'
 verbose: C: BEGIN classes / conditions (pass 1)
 verbose: C: .........................................................
 verbose: C:     +  Private class: set_by_expression 
 verbose: C:     +  Private class: set_by_if_and_expression 
 verbose: Skipping promise 'unset_by_if', for if/ifvarclass is not in scope
 verbose: C: .........................................................
 verbose: C: BEGIN classes / conditions (pass 2)
[root@hub tmp]# 


As illustrated above, a class whose "expression" is false is not even 
mentioned in the verbose output, whereas a class whose "expression" is true 
but whose "if" is false *is* shown.

Perhaps the handling should be the same?  (This would be a special case for 
the "if" attribute for classes promises only, to make it behave the same as 
an "expression" attribute.)

--Mike Weilgart

-- 
You received this message because you are subscribed to the Google Groups 
"dev-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dev-cfengine/59e58b19-e10d-4a21-a031-1c956e36b590%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to