help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles missing the profound function?


From: Yaroslav Halchenko
Subject: Re: editfiles missing the profound function?
Date: Wed, 23 Feb 2005 09:44:07 -0500
User-agent: Mutt/1.5.6+20040907i

Thank you Mark for the prompt answer,

This helps - now it is just twofold duplication -- not as much as before
:-)

So is there a real reason why something with described functionality
of AssignValue wasn't introduced into cfengine? Probably be I'm missing
something obvious...

Thank you once again 


On Wed, Feb 23, 2005 at 08:35:44AM +0100, Mark Burgess wrote:
> I just did this on a system.

>   { /etc/postfix/main.cf

>   # Edit the lines if they are there (required patch 2.1.14 )

>   ReplaceAll "^mydomain =.*" With "mydomain = iu.hio.no"
>   ReplaceAll "^relayhost =.*" With "relayhost = [nexus.iu.hio.no]"

>   # Check the lines are there at all

>   AppendIfNoSuchLine "relayhost = [nexus.iu.hio.no]"
>   AppendIfNoSuchLine "mydomain = iu.hio.no"
>   }

> I had to add a little finesse/patch to the detection of non-convergent
> operation to make this work. If you get the latest snapshot version, it
> should worlk for you..

> Mark

> On Wed, 2005-02-23 at 02:14 -0500, Yaroslav Halchenko wrote:
> > Dear cfengine-admirers

> > Am I missing the point or cfengine[2] is missing I would say
> > most-often-used function which can be named like

> > AssignValue 'X FS' Z

> > which I would use whenever I want change/add_a_line_with a right
> > hand side of any assignment like

> > X FS Y
> > to 
> > X FS Z

> > where X is a name
> > FS is field separator (usually is ' *= *' or just ' *')
> > and Y and Z are values

> > The absense of such function and the fact that ReplaceAll doesn't quite
> > fit  due to possible recursion, led people to device monsters like

> > http://www.shipyard.com.au/shipyard/articles/sysadmin/cfengine-configfiles.py

> > where for a simple obioius rule like

> > AssignValue '^LogLevel *' 'INFO'

> > is presented as

> >       BeginGroupIfNoLineMatching '^LogLevel.*'
> >         Append 'LogLevel'
> >       EndGroup
> >       ResetSearch 1
> >       LocateLineMatching '^LogLevel.*'
> >       BeginGroupIfNoMatch '^LogLevel INFO$'
> >         ReplaceLineWith 'LogLevel INFO'
> >       EndGroup

> > which shows you how much duplication is necessary to handle such
> > situation in a right way.

> > Is there a way to fix the situation or describe me where I'm wrong?

> > Thank you all in advance




-- 
                                                  Yaroslav Halchenko
                  Research Assistant, Psychology Department, Rutgers
          Office  (973) 353-5440 x263  Fax (973) 353-1171
   Ph.D. Student  CS Dept. NJIT





reply via email to

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