On Thu,  2 Aug 2012 13:51:07 +0200 (CEST) loopx wrote: 

n> This one is working fine :

n>         processes:
n>                 redhat_6::
n>                         "rhsmcertd"
n>                                 #classes                => 
if_ok("rhsmcertd_running"),
n>                                 restart_class   => "rhsmcertd_stopped",
n>                                 action          => immediate,
n>                                 comment         => "Check if process 
'rhsmcertd' is running ; should be stopped ...";


n> ... but I would prefer to set "*_running" ... (if only I was aware of how to 
do it ...).

(I have had these thoughts brewing for a while, and talked to Mark
Burgess about how the CAP theorem may relate to configuration
management, but here's a specific example where it's useful to talk
about persistence of knowledge.)

Perhaps it would help if you considered the semantics of the class name.
I see cfengine classes as knowledge that will expire eventually, the
only question is how soon.  For instance knowledge of the OS type or the
cfengine hub decays very slowly, while knowledge of the system load or
current time decays very quickly.  cf-agent doesn't distinguish the
decay rate of the knowledge it discovers, but that's (in my opinion) an
essential part of the configuration management toolkit.  It's usually
implied but we don't explicitly state it, and I don't think any CM
systems deal with the decay problem directly, except to leave it up to
the user.

"stopped" and "running" are only true at some point in time.  The
process may have been stopped or started since cfengine checked.  I see
this as a decay in the usefulness of the class, directly tied to how
much it is related to a specific instant.

Think, instead, in terms of convergence.  So your class name should
indicate the convergent action, not the system state.  When you name the
class "rhsmcertd_needs_start", that indicates clearly, to a reader, what
you're going to use it for.  The class's meaning doesn't decay as
quickly, because you're not tied to the state of the system X seconds or
minutes ago.

I hope this was useful or at least entertaining :)

Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to