help-cfengine
[Top][All Lists]
Advanced

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

Re: Determine file to copy based on classes


From: Kai Großjohann
Subject: Re: Determine file to copy based on classes
Date: Thu, 30 Jan 2003 21:49:16 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.3.50 (i686-pc-linux-gnu)

address@hidden writes:

> The cfengine way of doing this is to put the hosts and their
> resources in the same class container. Then it happens automatically

Hm?

I don't grok this answer.  I wanted to have a directory (tree?) with
files, and adding a file with the right name should make the right
copying happen: derive the class from the name, then copy.

I could specify to recursively copy some repository tree.  I'd have
one tree per class.  Then I'd make a rule for each tree/class.  I'd
put the most general rule first and the most specific rule last, so
that the most specific file wins.

The problem with this approach is that it always copies files, even
if there is no change: if a specific file is to be used on a certain
host, then the first rule to fire is the most general, which
determines that the file is different, so copies it.  Then comes the
more specific rule, which finds the file from the general rule, and
copies it again.

Hm.  Given classes a, b, c, with a being most general and c being
most specific, I could craft copying rules like so:

copy:
    a.!b.!c::
        ...copy directory a here...

    !a.b.!c::
        ...copy directory b here...

    !a.!b.c::
        ...copy directory c here...

That would work, after a fashion.  But it's a bear to maintain: I
currently have 15 classes (for just about a dozen hosts), so adding a
16th class requires me to frob 15 "::" lines, making sure that there
is no mistake, and also to add the 16th line.

And what happens if a host belongs to classes a and b?

Nonono, that won't work.

Did the above make it clearer what I mean?

PS: What is a "class container"?  I searched for "container" in the
    CFengine reference and the tutorial, and found one match in the
    "ACL" node.  The match didn't appear to be relevant.
-- 
Ambibibentists unite!




reply via email to

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