On 09/24/2012 05:27 AM, Aleksey Tsalolikhin wrote:
> Dear Mark,
>
>    Thanks for your kind reply.
>
> On Sun, Sep 23, 2012 at 12:46 AM,  Mark Burgess wrote:
>>> The body of a promise details and constrains its nature.  This promise
>>> is constrained by the ifvarclass attribute.
>> That's true but there are no constraints that determine the class.
> I still don't get it.  Doesn't the context constrain the promise?  the
> ifvarclass
> will evaluate to true on some systems and false on others.

IT constrains it, it just doesn't contain anything -- you need an 
expression, or, and part to give the class a meaning.
If varclass only determines whether a promise will be made at all. Right 
now the promise is an empty promise.

> Let me come at it from another angle.  Could you please explain why
> this is valid:
>
> {{{
> bundle agent example
> {
>    classes:
>        "solinux"
>                comment => "Set a custom class based on built-in classes",
>             expression => "linux|solaris";
> }
> }}}
>
> but the following isn't?
>
> {{{
> bundle agent example
> {
>    classes:
>      linux|solaris::
>        "solinux";
> }
> }}}

The first is valid because is creates an alias "solinux" for the 
expression "linux|solaris". The second is invalid because it
makes an empty promise (with no expression) only if you are on a linux 
or solaris machine. The difference is that
the first case creates *everywhere* an alias class. In the second case 
you create an empty alias only on hosts that are linux or solaris.

To make them equivalent in function,  you would have to say

classes:

    linux|solaris::  "solinux" expression => "any";

or

   "solinux" expression => "any",  ifvarclass => "linux|solaris";


Hope this helps

> In both cases I want to create a custom class based on nothing else
> but an evaluation of the current environment as compared to a class
> expression.  Why is promise body required, please?
>
>> I think what you are trying to write is this ...
> Yes, thank you very much!!
>
> Please do answer the above.
>
> Yours fondly,
> Aleksey
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine


-- 

CTO and Founder
CFEngine

http://www.cfengine.com
http://www.markburgess.org
Twitter: @markburgess_osl, @CFEngine_news

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

Reply via email to