help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles methodology question


From: Brendan Strejcek
Subject: Re: editfiles methodology question
Date: Sun, 6 Nov 2005 13:22:19 -0600
User-agent: Mutt/1.5.6+20040818i

Mark Burgess wrote:

> If the file contains $(macro) like instances already, you could simply
> ask cfagent to expand them using "ExpandVariables".

That's very cool.

> Alernatively you could use a ReplaceAll "xxx" With "yyy"

Following your recent message about how you use this to set variables, `
I tried to use it and ran into some problems. For example, I tried:

    ReplaceAll "^enableRollbacks=.*$" With "enableRollbacks=1"

This produced the following output:

    Begin editing /etc/sysconfig/rhn/up2date
    Checking for global replace/^enableRollbacks=.*$/enableRollbacks=1
    cfengine: WARNING: Non-convergent edit operation ReplaceAll 
[enableRollbacks=1] With [^enableRollbacks=.*$]
    cfengine: Line begins [enableRollbacks=0]
    cfengine: Replacement matches search string and will thus replace every 
time - edit was not done
    cfengine: Error editing file /etc/sysconfig/rhn/up2date

However, that edit is convergent. It will match every time, but the
result will always be the same. I assume the warning above is supposed
to guard against edits like:

    ReplaceALL "ab" With "abab"

which should be prevented. I think cfagent should test whether the
replacement will be *different* every time.

Best,
Brendan

--
Senior System Administrator
The University of Chicago
Department of Computer Science
http://www.cs.uchicago.edu/people/brendan




reply via email to

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