help-cfengine
[Top][All Lists]
Advanced

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

Re: Possible bug: parsing/scheduling of editfiles sections in multiple c


From: Ed Brown
Subject: Re: Possible bug: parsing/scheduling of editfiles sections in multiple cfengine scripts
Date: Mon, 12 Sep 2005 12:09:19 -0600

On Fri, 2005-09-09 at 09:55, Luke Kanies wrote:

> I haven't checked it in a while, but last time I did there was a
> relatively clear algorithm for scheduling.  It had two stages:
> 
> 1) All actions are scheduled in the order of first specification
> throughout the whole file.  It doesn't matter how many times you specify
> 'copy' or anything; the first time you specify any action it is slotted
> into the action sequence.  Once you have specified that an action is in
> the actionsequence, any other unqualified specifications of that action
> are entirely redundant.
> 
> 2) All of the qualified actions are scheduled.  I don't quite remember
> if all of the qualified actions always run after all other actions, but
> I do know that their ordering is entirely unrelated to the ordering of
> unqualified actions.

Luke,

I appreciate your effort to clarify the algorithms involved in
actionsequence scheduling, but even the algorithms don't explain the
actual behavior very fully.  Though there may be separate
parsing/actionsequence placement passes for qualified versus unqualified
actions, in practice, there is not a true separation of the two.  I
think that the only possibilities for the relative sequencing of an
unqualified action and any qualified instances of that action are to
place the unqualified instance anywhere in the sequence before the first
qualified instance, or, to have it execute with (after, but before any
following (different) actions).  To illustrate:

------------------------------------------
(unqualified action comes first in actionsequence def.)
# cat t.cf
control:
  actionsequence = ( shellcommands shellcommands.pre shellcommands.post
)
 
shellcommands:
  pre:: "/bin/echo pre"
  post:: "/bin/echo post"
  any::  "/bin/echo any"
 
# cfagent -qKf ./t.cf
cfengine::/bin/echo any: any
cfengine::/bin/echo pre: pre
cfengine::/bin/echo post: post
-------------------------------------------------

(unqualified action comes last in actionsequence def.)
# cat t.cf
control:
  actionsequence = ( shellcommands.pre shellcommands.post shellcommands
)
 
shellcommands:
  pre::  "/bin/echo pre"
  post:: "/bin/echo post"
  any::  "/bin/echo any"

# cfagent -qKf ./t.cf
cfengine::/bin/echo pre: pre
cfengine::/bin/echo any: any
cfengine::/bin/echo post: post
-------------------------------------------------

A verbose output shows 'any::' being executed within "shellcommands.pre
pass 1".   In fact, placing the unqualified action anywhere in the
sequence definition except before the first qualified use of the action,
is exactly the same as leaving it out altogether.

So, moral of the story remains the same, it's best to qualify all if you
qualify any, if you want to be really clear. 

-Ed







reply via email to

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