Forum: CFEngine Help Subject: Re: filecopy, transform with grep. Author: bbomgardner Link to topic: https://cfengine.com/forum/read.php?3,22985,23024#msg-23024
Wait, David. In your example you want cfengine to take the output of grep and write it to the promiser (file). The other promises don't do that. They are simply commands to complete an action. Grep is actually retrieving data for cfengine to use. This is the difference. The problem that we have with your proposal is that it will turn a promise that is intended to do just one thing - run a command - into one that will do two things: run a command, and also write to a file. This isn't dark and evil or any of that, its just not how cfengine was intended. Ideally, each change or action done by the agent should be independent of another. That way if one thing fails, the other isn't impacted. The more "promises" that are "kept" or "repaired", the closer we are to our intended goal. So while your idea is fine, it starts us down a slippery slope away from the principles of convergence. Also, we are talking about resources and dependencies. Cfengine wants to be lean and mean - and to accomplish its tasks without having to worry about what other programs the system has installed on it. In your proposal, you would ask it to use not only an external program but also a shell, which is certainly more expensive than the low level system calls it could instead use to read and write files. Mark says in the ref guide: NOTE: a common mistake in using cfengine is to embed many shell commands instead of using the built-in functionality. Use of cfengine internals is preferred as it assures convergence and proper integrated checking. Extensive use of shell commands will make a cfengine execution very heavy-weight like other management systems. To minimize the system cost of execution, always use cfengine internals. Now I can't fully defend that statement as I don't have the authority, but it shows the author's intent for the tool. Alllll of that said, I confess completely that cfengine is a mind warp. It took me a long time to wrap my head around some of the concepts and rules that Mark has created. But this is the reason why I ascribe to them - Mark built the theory first and then the program, not the other way around. The program's purpose is to facilitate a different way of administration that is based on (IMHO) good philosophy and research: it isn't just another framework or high-level language to script things in. If it were just another language without these theories behind it, I would fully support your idea because it is a fantastic way of adding very useful functionality. Does that make sense? I hope I'm not coming across as combative - I am really enjoying the discussion. We certainly care about your opinion, although we also might be a bit stubborn. =) _______________________________________________ Help-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/help-cfengine
