help-cfengine
[Top][All Lists]
Advanced

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

Re: Need 'UncommentAndSetValue' or some such


From: David Scott Coburn
Subject: Re: Need 'UncommentAndSetValue' or some such
Date: Wed, 26 Oct 2005 10:09:52 -0400
User-agent: KNode/0.8.2

Brendan Strejcek wrote:

> This is a commonly requested feature, check the archives for the
> discussions.
> 
> This is what I find myself doing these days:
> 
>     editfiles:
>         { /some/file
>             DeleteLinesStarting "SomeVar" # Or Matching, whatever
>             AppendIfNoSuchLine "SomeVar = SomeValue"
>         }
> 
> This is perfectly convergent because cfagent edits the file in a buffer
> and then compares to contents on disk. If there is no difference, the
> actual file is not touched.

This is an improvement, but it would be nice if the edit did not move
the line you are editing to the end of the file.  Usually there is some
context of comments related to the variable you are setting.  The function
which edits and sets the variable should not change this.  This makes it
easier to look through the file if needed to find the line you are looking
for, to see what the settings are, and to reference the information in the
comments.

Scott

-- 
* David Scott Coburn
* Brookhaven National Laboratory
* scott@bnl.gov 631.344.7110
* "Assume a spherical cow of uniform density..."


reply via email to

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