help-cfengine
[Top][All Lists]
Advanced

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

Re: Defining a class based on file contents


From: Chip Seraphine
Subject: Re: Defining a class based on file contents
Date: Mon, 12 May 2003 12:26:41 -0500
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.2.1) Gecko/20030121

That's exactly what I am talking about, but without the (expensive and relatively dangerous) shellout :-)

Mark pointed me at the DefineInGroup command, which is really the correct solution for it. I'm having problems with DefineInGroup, actually, but I'll be taking that up on the bugs list :-)

Alan Sparks wrote:

Maybe I'm misreading your intentions, but are you referring to doing
something like this?

classes:
 myclass = ( "grep -s someuser /etc/passwd" )

Where myclass is defined if the grep command returns a zero exit status?
-Alan

On Mon, 2003-05-12 at 10:23, Chip Seraphine wrote:
Great!

What is the syntax for this?  I tried the obvious (see below) but it failed.

editfiles:

   { /tmp/foo
       BeginGroupIfNotDefined "noclass"
           DefineClasses "foo1:foo2"
       EndGroup
   }

This produces "cf:cfengine::/home/titan/chip/cfagent-test.conf:136: Class definitions inside conditionals or loops are not allowed "

mark@iu.hio.no wrote:

You can define classes in a conditinal block as of 2.0.6.
2.0.7 is just around the corner, in spite of my saying the
2.1.0 would be thenext version...

M

On 12 May, Chip Seraphine wrote:


I have a situation where I would like to define a class based on the contents of the file, but do not wish to actually modify the file itself. Does anybody know a good way to do this (other than using a module or shellcommand)?

I have tried "|BeginGroupIfNoLineContaining" and such, but this doesn't do the trick because I can't define classes inside the conditional block. There is no "touch" type command either, so I am not sure of a safe way to fool cfengine into thinking the file has been edited without doing something dangerous (changing the file) or silly (editing the file and then removing the edit). I was trying to do something clever with "abort" and "catchabort", but that doesn't seem well suited to this either.

Has anybody else solved a problem like this?
|



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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  Mark.Burgess@iu.hio.no
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






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






reply via email to

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