help-cfengine
[Top][All Lists]
Advanced

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

Re: file modification


From: Debbie Brown
Subject: Re: file modification
Date: Thu, 06 Mar 2003 15:24:25 -0600

Yeah, I've already played with this one.  The 'ForEachLineIn' seems like a
good fit but the 'ReplaceLinesMatchingField' doesn't.  There's really not
one particular field that I can search for in order to replace a line; I
also need to be able to add an entire line if it does not already exist.

I tried using other expressions with 'ForEachLineIn', but it doesn't look
like any work inside the loop except for 'ReplaceLinesMatchingField'.


Ryan Anderson wrote:

> I got this code from someone else that lets you change the encrypted
> password in /etc/shadow if the masterfile is different from the
> system's. The kicker is that it will only change what is different, so
> your masterfile could have only one line or 100, it will only change the
> lines that are different. This could be modified to do what you want.
>
> ============
> editfiles:
>     solaris::
>         {   /etc/shadow
>             SplitOn ":"
>             ForEachLineIn "$(masterfile)"
>                 ReplaceLinesMatchingField "1"
>             EndLoop
>         }
> =============
>
> RCA
> --
> Ryan C. Anderson
> Unix Administrator
> United Defense L.P.
> desk   763.572.6684
> pager  952.235.9936
> mobile 612.419.9362
>
> >>> Debbie Brown <debbieb@ti.com> 03/06/03 01:49PM >>>
> Thanks, but I don't want to have to add each individual line in the
> cfengine
> config file.
>
> Several of our desktops have customized config files (/etc/system for
> example).  I would like to have a group of files (i.e. file1) that
> only
> contain the lines that are unique for these config files (i.e. file2);
> each
> file will be unique to the system it updates.  Any admin can update
> this
> group of files & they don't have to have cfengine knowledge.
> Basically,
> these files are like a template that contains the special additions
> that need
> to be added to certain files on the system.
>
> We have a large network & are looking for an easy way to update &
> maintain
> unique customizations to desktops, so any admin can make modifications
> without having to go through specific people to update the cfengine
> config
> file.
>
> Please note that this is only for unique system changes; not for our
> standard
> config.
>
> Thomas Glanzmann wrote:
>
> > * Debbie Brown <debbieb@ti.com> [030306 18:56]:
> > > 'InsertFile' doesn't work well for this b/c it adds the line(s) of
> file1
> > > to file2 whether they exist or not.
> >
> > What about AppendIfNoSuchLine?
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://mail.gnu.org/mailman/listinfo/help-cfengine
>
> _______________________________________________
> 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]