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: Berthold Cogel
Subject: Re: Possible bug: parsing/scheduling of editfiles sections in multiple cfengine scripts
Date: Fri, 09 Sep 2005 15:11:16 +0200
User-agent: Mozilla Thunderbird 1.0.2-1.4.1.SL3 (X11/20050324)

Ed Brown wrote:
My experience with actionsequence suggests two things:

1.) Declaring actionsequences in multiple files means that your
actionsequence is basically indeterminate.  Actionsequences do not apply
per file.  If you want control over your actionsequence, it's best to
declare it only once at the top level (well, twice, update.conf and
cfagent.conf both need an actionsequence).

2.) Lines like this:


actionsequence = ( ... copy.pre editfiles copy.post ... copy ... )


are misleading.  Once you qualify an action, you should qualify all of
them, if you care about the sequence.  The above does not mean that
using 'copy:' without 'pre::' or 'post::' will take place last.  In
fact, any copy actions without the qualifiers will take place when the
first copy action is scheduled.

hope this helps,
Ed

The cfengine reference for actionsequence says:

...
Under normal circumstances this coarse ordering is enough to suit most purposes. In some cases you might want to, say, only perform half the link operations before mounting filesystems and then, say, perform the remainder. You can do this (and similar things) by using the idea of defining and undefining classes. See Defining classes.

The syntax


     actionsequence =
        (
        links.firstpass.include
        ...
        links.secondpass
        )

means that cfengine first executes links with the classes firstpass and include defined. Later it executes links with secondpass defined. You can use this method of adding classes to distinguish more finely the flow of control in programs.
...

So this is exactly what I wanted to do. If I define a unique order of actions for all of my files I will lose a lot of flexibility.

And:
I don't have a problem of with the sequence of copy actions. I can use different varaiations:

        ... copy ...
        ... copy copy.pre editfiles copy.post ...
        ... copy.pre copy.post editfiles copy ...
        ... editfiles copy.post copy ...

Each of them is carried out in the correct order.
The editfiles sections get mixed up and are *all* carried out together at the first occurence in the over all actionsequence. Although the other entrys *exist* in the over all actionsequence!

directories copy
directories copy copy.pre editfiles copy.post shellcommands processes
directories copy
directories copy
directories copy.pre editfiles copy.post copy shellcommands processes
directories editfiles copy
directories copy.pre editfiles copy.post copy shellcommands
directories copy
directories files copy.pre editfiles copy.post copy shellcommands processes
directories links copy copy.pre editfiles copy.post

I get a sequence with a lot of empty 'slots' (no action assigned):

processes directories copy directories copy directories editfiles copy.pre editfiles copy.post copy shellcommands directories copy copy.pre editfiles copy.post shellcommands processes directories links copy copy.pre editfiles copy.post shellcommands processes directories copy.pre editfiles copy.post copy shellcommands processes directories copy directories files copy.pre editfiles copy.post copy shellcommands processes directories copy directories copy directories copy

What I see in the resulting actions is that the actions get grouped if possible and that not all action 'slots' have a correspondent action.


If I have two action sequences

(directories(A) editfiles(A) copy.post(A))
and
(directories(B) copy.pre(B) editfiles(B) copy.post(B))

I would expect a result like:

directories(A) editfiles(A) copy.post(A) directories(B) copy.pre(B) \
editfiles(B) copy.post(B)

or

directories(A,B) editfiles(A) copy.pre(B) editfiles(B) copy.post(A,B)

or

directories(A,B) copy.pre(B) editfiles(A,B) copy.post(A,B)



But *not*:

directories(A,B) editfiles(A,B) copy.pre(B) editfiles() copy.post(A,B)

But this is exactly what happened! The copy statements are executed as expected in perfect order.
The editfiles statements get mixed up in a very bad way.


If I define a actionsequence I expect it to be executed in the defined order.

Oh I almost forgot:
The editfiles section in question should have been ignored on all machines exept on one single machine. This section was indeed executed only on the defined machine. But an *all* machines the actionsequence got mixed up.


Berthold Cogel




reply via email to

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