On 03/16/2012 07:53 AM, Marco Marongiu wrote:
> Hi
> 
> Hi had this vars: promise not working as expected:
> 
>       "shortname"
>         comment    => "set a short name if $(names) is defined",
>         classes    => always("has_shortname"),
>         string     => "$(names)",
>         ifvarclass => "$(names)" ;
> 
> shortname got its value after $(names), but the class "has_shortname"
> was never defined. always() was my last chance, I also tried with
> if_ok() and with a plain "has_shortname".
> 
> Is that expected?


In the reference manual I dont see classes in vars. I can only seem to
find vars in common promises (not vars in agent promises).
http://www.cfengine.com/manuals/cf3-reference#vars-in-common-promises

I think what you need to do is have a classes promise if shortname is
defined.

Something like this

classes:
  "has_shortname"
     expression => isvariable("shortname"),
     comment => "Set a class if short hostname has been defined";

-- 
Nick Anderson <n...@cmdln.org>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to