help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hostname's hyphen character brings inconsistency in cfengine


From: ebrown
Subject: Re: hostname's hyphen character brings inconsistency in cfengine
Date: Sat, 4 Sep 2004 09:31:26 -0600 (MDT)
User-agent: SquirrelMail/1.4.3-1.lanl

I think there is some confusion here about the difference between
groups/classes and variables.  Here you have defined 2 variables, group1
and group2.  They are not the same as classes or groups, which aren't
defined in 'control:' sections, but rather in, well, 'classes:' or
'groups:' (synonyms).

Hostnames with hyphens can be used as rvalues in class/group definitions.
Try this-
groups:
   group1 = ( l-eng-2447 )
shellcommands:
   group1::
       "/bin/echo good to go"

or, you could simply do this, in this case-
shellcommands:
   l_eng_2447::
        "/bin/echo that would be me too"

but this would not work-
shellcommands:
   l-eng-2447::
       "/bin/echo wont get here, illegal classname"

-Ed




>
> Hi.  I'd like to follow up on Guolin Cheng's observation.
> I have experienced similar difficulties, and I am unable
> to pin it down.  My only conclusion is to completely avoid
> hyphens in host names.  I'm using v2.1.8
>
>
> Here is my configuration file:
>
> control:
>     actionsequence = ( shellcommands )
>     domain = ( artisan.com )
>     addInstallable = ( Group1 Group2 )   # Don't think I need this
>     group1 = ( l-eng-2447 )
>     group2 = ( l_eng_2447 )
>     ifElapsed      = ( 0 )
>
> shellcommands:
>
> l_eng_2447::
>     "/bin/echo l_eng_2447, host names with underbar."
>
> Group1::
>     "/bin/echo Group1, group: host names with hyphen."
>
> Group2::
>     "/bin/echo Group2, group: host names underbar."
>
> !Group1::
>     "/bin/echo !Group1, negated group: host names with hyphen."
>
> !Group2::
>     "/bin/echo !Group2, negated group: host names with underbar."
>
>
> Here are my results:
>
> [root@l-eng-2447 tmp]# cfagent --file /nfs/cad-root/tmp/cfagent.conf -q
> cfengine:l-eng-2447:/bin/echo l_eng: l_eng_2447, host names with underbar.
> cfengine:l-eng-2447:/bin/echo !Grou: !Group1, negated group: host names
> with hyphen.
> cfengine:l-eng-2447:/bin/echo !Grou: !Group2, negated group: host names
> with underbar.
>
>
>> Hyphens cannot be used in class names, just as they cannot be used in
>> variable names in any language I know of. Underscores can be used so you
>> must have a different problem. I am guessing that your class definition
>> is parsed after your rule to echo a string.
>>
>> This all works fine, it is used all the time for internal stuff.
>> M
>>
>> On  1 Sep, Guolin Cheng wrote:
>> > Hi,
>> >
>> >   We got a problem to implement cfengine to hosts with hyphen
>> > character(s) in their names like "ops-test2". According to our tests,
>> we
>> > can use either "ops-test2" or "ops_test2" in group|class definitions,
>> or
>> > take advantage of group definitions in NIS netgroup map in cf.groups
>> > file.  But if we directly use hostnames to work as class names in
>> > cf.main, we find that "ops-test2" class will fails, while "ops_test2"
>> > class works fine.
>
>
> --
> Lyndon C. Lim;  lyndon@artisan.com;  408.734.5600;  408.734.5050 (fax)
> Artisan Components; 141 Caspian Court; Sunnyvale, CA 94089-1013; USA
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]