Thanks for the details. The current code will send an event if there there's a problem running the plugin.

-Eric

Willi Langenberger wrote:
According to Eric Newton:
I'm not sure this patch fixes anything. Do you have a test case in which the original code was failing?

For example if the path to the plugin is wrong, eg

   zNagiosPath = '/does/not/exist'

What happens is, that the error never is signaled, because:

  class Cmd:
    def processEnded(self, pr):
        self.result = pr
        self.lastStop = time.time()
        if not isinstance(pr, failure.Failure):
           ...

the above "if" is always True. "pr" is the ProcessRunner instance and is
never a "failure.Failure" instance. "pr.reason" is one, but thats not
tested.

Thus the program flow is as if the cmd went ok, and below we get the
"unparsable output" error, because there is no output in case of
"command not found":

  class zenagios(RRDDaemon):

    [...]

    def finished(self, cmd):
        if isinstance(cmd, failure.Failure):
            if isinstance(cmd.value, TimeoutError):
                cmd, = cmd.value.args
                log.error("Command timed out on device %s: %s",
                          cmd.device, cmd.command)
            else:
                log.exception(cmd.value)
        else:
            output = cmd.result.output
            if output.find('|') >= 0:
                msg, values = output.split('|', 1)
            else:
                msg, values = 'unparsable response', ''
            exitCode = cmd.result.exitCode


\wlang{}


_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to