Forum: Cfengine Help
Subject: Re: Force variables to be defined after classes?
Author: Bas van der Vlies
Link to topic: https://cfengine.com/forum/read.php?3,18656,18700#msg-18700
I am facing the same problem, maybe there is another solution for my problem
with variables, eg:
bundle common g
{
vars:
any::
"masterfiles" string => "/data/cfengine3/config";
"datafiles" string => "/data/cfengine3/data";
"policyserver" string => "XXX.XXX.XXX.XXX";
"sara_bundles" slist => { "update", "stop_cfengine" },
policy => "overridable";
LISA_CLUSTER::
"CLUSTER" string => "LISA";
"cluster_classes" string => "lisa.cf";
!LISA_CLUSTER::
"CLUSTER" string => "NOT LISA";
"cluster_classes" string => "not_lisa.cf";
classes:
"GOT_INIT" expression => usemodule("init_sara","");
}
init_sara is a simple shell script:
{{{
#!/bin/sh
echo +BAS
echo +LISA_CLUSTER
}}}
When i run this on a host. I get this warning:
{{{
15:55 gb-r10n2.irc.sara.nl:/etc/cfengine3
root# cf-agent -K -Dquarterly
!! Redefinition of a constant variable "CLUSTER"
Promise (version 1.0.1) belongs to bundle 'g' in file
'/var/lib/cfengine3/inputs/promises.cf' near line 58
!! Redefinition of a constant variable "cluster_classes"
Promise (version 1.0.1) belongs to bundle 'g' in file
'/var/lib/cfengine3/inputs/promises.cf' near line 59
Q: ".../bin/echo Clust": Cluster: LISA
I: Last 1 QUOTed lines were generated by promiser "/bin/echo Cluster: LISA"
Q: ".../bin/echo Bas i": Bas is lekker bezig
I: Last 1 QUOTed lines were generated by promiser "/bin/echo Bas is lekker
bezig"
}}}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine