[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
actionsequence classes: sometimes ignored for editfiles?
From: |
Andreas Boschke |
Subject: |
actionsequence classes: sometimes ignored for editfiles? |
Date: |
17 Jul 2002 16:29:23 -0700 |
Hi:
I would like to add to two lines to /etc/passwd, but one must always be
the last in the list. To do this I elected to use a class on the
editfiles action sequence. However the last "edit" is always overlooked
by cfagent. To demonstrate, below I have an example cfagent.conf file
and output snippets.
EXAMPLE:
<cfagent.conf>
control:
any::
actionsequence = (
editfiles
editfiles.Final
)
editfiles:
any::
{ /etc/passwd
BeginGroupIfNoLineMatching "\+@netgroup"
GotoLastLine
InsertLine "+@netgroup"
EndGroup
}
any.Final::
{ /etc/passwd
GotoLastLine
BeginGroupIfNoLineMatching "\+FINAL LINE"
DeleteLinesMatching "\+FINAL LINE"
Append "+FINAL LINE"
EndGroup
}
{ /etc/group
GotoLastLine
BeginGroupIfNoMatch "\+"
DeleteLinesMatching "\+"
Append "+"
EndGroup
}
=
<BEFORE cfagent run /etc/passwd is missing the two lines>
<RUN: % cfagent -fv ./cfagent.conf>
<snip cfagent output>
*********************************************************************
Main Tree Sched: editfiles pass 1 @ Wed Jul 17 16:25:31 2002
*********************************************************************
Begin editing /etc/passwd
Edit: Search for \+@netgroup failed. Current line still 1
(Begin Group - no line matching \+@netgroup)
Inserting +@netgroup
(End Group)
End editing /etc/passwd
.....................................................................
cfengine:pepe: Edited file /etc/passwd
Job start time set to Wed Jul 17 16:25:31 2002
*********************************************************************
Main Tree Sched: editfiles.Final pass 1 @ Wed Jul 17 16:25:31 2002
*********************************************************************
New temporary class additions
--------( Pass 1 )-------
Final
Begin editing /etc/group
(Begin Group - skipping \+)
End editing /etc/group
.....................................................................
NOTE: The edit on the /etc/group file in the "Final" edit worked.
</snip>
<AFTER cfagent run /etc/passwd is missing the "Final" line>
<snip /etc/passwd>
+@netgroup
</snip>
I appreciate any insights.
Thanks,
-Andreas Boschke
-Computer Science, UCSB
REFERENCE:
http://www.cfengine.org/docs/cfengine-Tutorial.html#actionsequence%20classes