[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-convergent file edit?
From: |
Brendan Strejcek |
Subject: |
Re: non-convergent file edit? |
Date: |
Wed, 17 Mar 2004 23:06:13 -0600 |
User-agent: |
Mutt/1.3.28i |
Here is my contribution. It edits a file, then, if any edits happened,
it updates a datestamp in a comment. Not sure if you are trying to solve
a similar problem, but another (working) example can't hurt.
control:
actionsequence = (
editfiles.first
editfiles.second
)
editfiles:
first::
{ /var/tmp/junk
Backup "false"
Prepend "junk" # make sure an edit happens, just for testing
DefineClasses "edits_happened"
}
second::
# if edits happened above, update the datestamp
{ /var/tmp/junk
Backup "false"
BeginGroupIfDefined "edits_happened"
BeginGroupIfNoLineMatching "^# cfengine edit .*$"
Append "# cfengine edit $(day) $(month) $(year)"
EndGroup
ResetSearch "1"
LocateLineMatching "^# cfengine edit .*$"
BeginGroupIfNoMatch "^# cfengine edit $(day) $(month) $(year)$"
ReplaceLineWith "# cfengine edit $(day) $(month) $(year)"
EndGroup
EndGroup
}
Re: non-convergent file edit?,
Brendan Strejcek <=