I read http://cfwiki.org/cfwiki/index.php/Managing_Blocks_of_Code_with_Editfiles and tried it, with weird results
This is the config:
control:
actionsequence = ( editfiles )
RCSFile = (ExecResult("/bin/sh -c \"echo \'$RCSfile: cf.redhat,v $\' | /usr/bin/cut -f2 -d\' \'\""))
RCSRev = (ExecResult("/bin/sh -c \"echo \'$Revision: 1.40 $\' | /usr/bin/cut -f2 -d\' \'\""))
EditHeader = ( 'CFEngine $(host) $(RCSFile)' )
editfiles:
any::
{ /etc/hosts
AutoCreate
Backup "single"
LocateLineMatching "##### BEGIN $(EditHeader).*"
BeginGroupIfNoMatch "##### BEGIN $(EditHeader) $(RCSRev)"
DeleteToLineMatching "##### END $(EditHeader).*"
DeleteNLines '1'
EndGroup
CatchAbort
BeginGroupIfNoLineMatching "##### BEGIN $(EditHeader) $(RCSRev)"
Append "##### BEGIN $(EditHeader) $(RCSRev)"
Append "# mandatory loopback address"
Append "127.0.0.1 localhost.localdomain localhost"
Append ""
Append "#####"
Append "## revision: $(RCSRev)"
Append "## file: $(RCSFile)"
Append "##### END $(EditHeader) $(RCSRev)"
EndGroup
}
And this the result:
##### BEGIN CFEngine hagar cf.redhat,v
# mandatory loopback address
127.0.0.1 localhost.localdomain localhost
#####
## revision:
## file: cf.redhat,v
##### END CFEngine hagar cf.redhat,v
I've been beating my head against this and can't figure out where is goes wrong. Any tips or hints are welcome.
--
Met vriendelijke groeten/with kind regards
John van Zantvoort
---
Paranoia is simply an optimistic outlook on life.
GCM d- s+:+ a- C+ UL+++ P+++ L++ E--- W++ N+ o K-
w-- O- M- V- PS+ PE- Y+ PGP+ t+ 5 X- R- tv b+ DI++
D+ G e h- r++ y+
_______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine