This works fine for me:
$ cat test.cf
#!/usr/sbin/cfagent -qKf
classes:
testClass = ( linux )
control:
actionsequence = ( shellcommands )
testClass:: testVar = ( junk )
shellcommands:
"/bin/echo testVar is ${testVar}"
$ ./test.cf
cfengine::/bin/echo testV: testVar is junk
$
I think that's a simple case of what you want.
Erik Williamson wrote:
Hi All,
I've got two classes defined: Com1ConsoleServers & Com2ConsoleServers,
with ConsoleServers being an amalgamation of the two.
In my editfiles section, I currently have a section for each, even
though there's very few differences between the two. I'd like to tidy
this up; Is there a way to define variables based on which of the above
classes a machine is in? This way, instead of this:
editfiles:
Com1ConsoleServers::
<do stuff>
Com2ConsoleServers::
<do remarkably similar stuff>
I could do this:
editfiles:
Com1ConsoleServers::
<do stuff with $(ComPort) >
<do more stuff with $(ComPort) >
So, as a test case, I tried this (only the important stuff shown):
control:
TestClassTest::
BigTestVariable = ( "Wooooo" )
groups:
TestClassTest = ( testhost )
shellcommands:
TestClassTest::
"/bin/echo $(BigTestVariable)"
I didn't expect this to work, and it didn't (got a ) - alas, is there a
way to accomplish this?
Thanks!
Erik.
--
e r i k w i l l i a m s o n erik@cpsc.ucalgary.ca
system admin . department of computer science . university of calgary
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine