[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: edit and copy
Mark . Burgess
Re: edit and copy
Sat, 29 May 2004 08:42:05 +0200 (MEST)
A "method" could be a god way of solving this problem, i.e.
a cfengine "subroutine".
On 28 May, Kai Grossjohann wrote:
> Steve Wray <address@hidden> writes:
>> Ideally, the repository would contain such files (eg /etc/hosts) and
>> these would go into the working copy on the workstation and cfengine
>> would copy these into the live /etc directory (or wherever) modifying
>> them on the way; I don't want the files in the local svn working copy
>> to be modified and I don't want the unaltered files going into the
>> live /etc and then being modified, rather the files should be modified
>> in transit.
> There is no cfengine functionality I know of to modify files in
> transit. AFAIK, there is only copying without modification, and then
> there is editing without copying.
> One possibility would be to introduce another layer of files: First
> you update the svn working copy. Then you copy the file from there to
> /etc/hosts.in (say). Then you edit that file. Then you copy
> /etc/hosts.in to /etc/hosts.
> But this means that cfengine does all the work every time. So you
> would have to skip the later steps unless the svn working copy has
> Hm. Hmmm.... Ah! Here is another idea: use templates together with
> the editfiles directive. Let's say the svn working copy of the file
> is /etc/cfengine/svn/hosts. Now you create an editfiles directive
> which edits the file /etc/hosts. The edit commands are as follows:
> - Empty the entire file.
> - Insert the contents of /etc/cfengine/svn/hosts.
> - Replace the placeholders with the real values.
> If cfengine can detect that the above steps left the file unchanged,
> then it won't save the file. But if it has changed, it will save the
> new file. And you never have the placeholders on disk.
> Help-cfengine mailing list
Work: +47 22453272 Email: address@hidden
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark