[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Editfiles hack
From: |
Mark . Burgess |
Subject: |
Re: Editfiles hack |
Date: |
Sun, 28 Mar 2004 21:18:47 +0200 (MEST) |
Important: it is not file replacement, but file definition!
M
On 28 Mar, Russell Adams wrote:
> I thought whole file replacement was the easy way out. ;]
>
> I just didn't want to maintain the config files outside of
> cfengine... I had been trying to copy in from a shared directory tree,
> and its caused issues.
>
> Russell
>
> On Sun, Mar 28, 2004 at 09:10:18AM +0200, Mark.Burgess@iu.hio.no wrote:
>>
>> What is dirty about this? This is a perfectly acceptable and
>> convergent way of editing a file, since no physical edits are
>> made if the file is unchanged from what is on disk.
>>
>> M
>>
>> On 27 Mar, Russell Adams wrote:
>> > I've started using the following for most of my config files. I kind
>> > of felt it was a dirty hack, so I thought I'd ask if anyone else was
>> > doing the same or had suggestions.
>> >
>> > I'll use an editfiles command like the one below, basically it looks
>> > for a revision number as the first line of the file. If it doesn't
>> > match, then the entire file contents is replaced.
>> >
>> > { /etc/network/interfaces
>> >
>> > AutoCreate
>> >
>> > BeginGroupIfNoLineMatching "# interfaces v1.02"
>> > EmptyEntireFilePlease
>> > Append "# interfaces v1.02"
>> > Append ""
>> > Append "auto lo"
>> > Append "iface lo inet loopback"
>> > Append ""
>> > Append "auto eth0"
>> > Append "iface eth0 inet static"
>> > Append " address 192.168.1.170"
>> > Append " netmask 255.255.255.0"
>> > Append " network 192.168.1.0"
>> > Append " broadcast 192.168.1.255"
>> > Append " gateway 192.168.1.254"
>> > Append ""
>> > EndGroup
>> > }
>> >
>> > Part of this was caused by my recent frustration trying to replace
>> > individual lines in the above config file in a reliable manner. (ie:
>> > replace address, but not all addresses...)
>> >
>> > Comments?
>> >
>> > -----------------------------
>> > Russell Adams
>> > RLAdams@AdamsInfoServ.com
>> > http://www.adamsinfoserv.com/
>> >
>> >
>> > _______________________________________________
>> > 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
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> -----------------------------
> Russell Adams
> RLAdams@AdamsInfoServ.com
> http://www.adamsinfoserv.com/
>
>
> _______________________________________________
> 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~