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: Luke Kanies
Subject: Re: Possible bug: parsing/scheduling of editfiles sections in multiple cfengine scripts
Date: Mon, 12 Sep 2005 15:11:35 -0500 (CDT)

On Mon, 12 Sep 2005, Ed Brown wrote:

> 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:

I knew it was dangerous to open my mouth without testing; I was pretty
sure I understood how it all worked a while ago, when I was still
intimately familiar with the code and was also using cfengine daily, but
I obviously was wrong.

[SNIPped examples]

> 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.

That's pretty confusing...

> 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.

Well, that's _one_ of the morals.  The other moral of the story is that
order really does matter in configurations, and cfengine should embrace
it in a way that makes sense, rather than acting like it doesn't matter
but then providing relatively kludgy ways to try to make it matter.

For the record, Puppet acknowledges that order matters in some cases but
not all, and provides a way to specifically order elements based on
dependencies:

    file { "/etc/apache/apache.conf":
        checksum => md5
    }

    service { apache:
        running => true,
        subscribe => file["/etc/apache/apache.conf"]
    }

The 'subscribe' parameter does two things: 1) guarantees that the file
will always be modified before the service, so it provides
dependency-based ordering, and 2) causes the file to notify the service
if it changes, which in turn causes the service to restart.  There's a
similar 'require' parameter that just does the ordering without the
restarting.

So this simple additional parameter attacks two problems that are pretty
hairy in cfengine, dependencies and ordering.

-- 
The Roman Rule
        The one who says it cannot be done should never interrupt the
        one who is doing it.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://config.sage.org





reply via email to

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