changed_when can be used to decide when to trigger a handler based on the output or return code of a shell command. It is similar to failed_when like I previously posted about
This file has been truncated.
# a simple demo showing change controls
# normally a shell command will always notify a handler
# how do we control that based on return codes or output?
from opsmop.core.easy import *
return dict(a=5, b=6, c=True)
VELOCIRAPTOR_DANGER = Eval("z.rc == 7 or 'fence power down' in z.data")
Shell("echo 'fence power down'", register='z', changed_when=VELOCIRAPTOR_DANGER, signals='evt_01'),
Let me know if you think other language features other than resources and push/pull modes are needed. I'm trying to keep things pretty minimal, though it's common enough to want to corral the output of shell commands, so that's why these are there.