Forum: CFEngine Help
Subject: Re: filecopy, transform with grep.
Author: davidlee
Link to topic: https://cfengine.com/forum/read.php?3,22985,23030#msg-23030
OK. Let's come from a different angle! Clarity.
Clarity, clarity, clarity.
We are about making promises to do certain things based on certain conditions.
So the 'cfengine' user, a real human being, needs to be able to express a
promise as clearly and as simply as possible.
If I pin a notice on my land saying "Do not trespass", that is clear, concise
and obvious. The lawyers and keepers of "legal theory" might not like it; they
might prefer a twenty-page document in tiny typeface and obscuranist
gobble-de-gook linguistic legalese that attempts to say the same thing. But
in reality, which is actually the better statement of intent for real people in
the real world? The clear, simple, "Do not trespass"? Or a twenty-page
equivalent that might be so complicated that it could contain errors and be
riddled with unforeseen loopholes, undermining and shooting in the foot the
very principle it is trying to defend? Give me the clear, simple "Do not
trespass" notice any day.
Right. In the light of that, as a simple user of the "Do not trespass" class,
look at:
==========
classes:
"do_update" ... => ... isnewer("$(resultfile)", "$(sourcefile)) ...;
files:
"$(resultfile)"
create => true,
transformer => (/path/to/transformer "$(sourcefile)"),
transformer_stdout => "true",
if varclass => "do_update";
==========
Is not the intention of that, as far as cfengine syntax permits, as clear as
reasonably possible? I challenge anyone to come up with anything with greater
clarity and simplicity using cfengine language.
To translate that into "promise" language. I want to make a simple promise:
"When the sourcefile changes, update resultfile, using a transformer which I am
content is good enough for the purpose of my promise".
That translation applies equally to the two existing examples of "gzip" and
"postalias": in both cases the user is stating that the transformer program is
good enough, including GIGO considerations, for the purpose of their promise.
My "grep" (or any other UNIX program that writes to stdout) case is exactly
equivalent in all respects.
There is one, and only one difference that I can see in my request. That is,
that for such a "transformer_stdout" variant, the open of the destination file
needs to be done by 'cfengine' rather than by the transformer itself. cfengine
continues to call the transformer as normal, with that open file descriptor
being given to the transformer as its stdout.
If adherence to "promise theory" means that it is horrendously difficult to
express my simple promise, then something, somewhere has failed. If it
becomes any more complicated, then that comprises my (the user's) ability to be
able to express the promise, and that undermines the very thing that "promise
theory" is aiming to achieve. (Recall my "do not trespass vs. the lawyers"
analogy.)
So my challenge to you! From the perspective of clarity, and bearing in mind
the existing clear 'postfix' example, try to improve upon my
'transformer_stdout' example above, using existing cfengine syntax. Every
additional line is additional place for unforeseen loopholes, compounding
exponentially, and corresponding to exponentially increasing number of pages of
"lawyer-speak" in our "Do not trespass" analogy.
Have a good weekend!
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine