help-cfengine
[Top][All Lists]
Advanced

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

Re: Confusion with Variables and Groups


From: Erik Williamson
Subject: Re: Confusion with Variables and Groups
Date: Mon, 12 Jul 2004 12:14:52 -0600
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Thank you so much - moving 'classes' before 'control' did the trick. I had it engrained into my head that 'control' had to be first.

Thanks again -
Erik.

Brendan Strejcek wrote:
Note that you will probably want to use the AllowRedifinitionOf
special variable to avoid annoying warnings.

Brendan Strejcek wrote:


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




_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

--
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





reply via email to

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