[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using variables in classes definition
From: |
Chris Edillon |
Subject: |
Re: Using variables in classes definition |
Date: |
Mon, 10 Feb 2003 22:56:49 -0400 (GMT+4) |
On Mon, 10 Feb 2003 paguerlais@airfrance.fr wrote:
> I need to define a variable and a class depending on that variable.
> Something like :
>
> <example>
> control:
> servers = ( host1 host2 )
>
> classes:
> i_am_a_server = ( ${servers} )
> </example>
> It doesn't work because :
> - ${servers} must be enclosed in quotes for syntax needs
> - if ${servers} is enclose in quotes, it is considered as a command+
> parameters which must be executed and whose result is used to defined
> i_am_a_server.
>
> I need both the variable and the class because somewhere later in my script
> I give the variable value as a parameter to an external script
> (shellcommands), and some sections of the script are activated only if the
> running host belongs to the list "servers".
> Of course I can repeat the hosts list on the "i_am_a_server" class
> definition, but each time I modify "servers" I must then think to modify
> also "i_am_a_server" :-(
>
> I couldn't find something in the docs. Does somebody has any idea ?
>
the following is weird, but it works:
control:
servers = ( host1 host2 )
classes:
i_am_a_server = ( "/bin/echo $(servers)" )
chris