[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Réf. : Re: Using variables in classes definition
From: |
paguerlais |
Subject: |
Réf. : Re: Using variables in classes definition |
Date: |
Tue, 11 Feb 2003 10:32:18 +0100 |
It doesn't work because this syntax defines i_am_a_server as soon as the
command ends with a null status. Which is quite always the case with echo.
help-cfengine-bounces+paguerlais=airfrance.fr@gnu.org@zot.com> le
11/02/2003 04:09:59
Envoyé par : Chris Edillon <jce@zot.com>
Pour : paguerlais@airfrance.fr
cc : help-cfengine@gnu.org, patrice.guerlais@libertysurf.fr
Objet : Re: Using variables in classes definition
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
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine
----------------
L'acces immediat aux meilleurs tarifs Air France et au billet electronique sur
http://www.airfrance.com
For immediate access to the best Air France fares and to electronic tickets,
visit our website http://www.airfrance.com
----------------
Les donnees et renseignements contenus dans ce message sont personnels,
confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont
les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire,
nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette
communication. Nous vous prions de notifier cette erreur a l'expediteur et
d'effacer immediatement cette communication de votre systeme.
The information contained in this message is privileged, confidential, and
protected from disclosure. This message is intended for the individual or
entity adressed herein. If you are not the intended recipient, please do not
read, copy, use or disclose this communication to others; also please notify
the sender by replying to this message, and then delete it from your system.
- Réf. : Re: Using variables in classes definition,
paguerlais <=