[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Gerhard Lausser gerhard.lausser at consol.de
Tue Feb 28 22:18:39 UTC 2012


The following commit has been merged in the debian/master branch:
commit 8187bcdef14efdfda228caafb48260b3c8731ca5
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date:   Sun Feb 5 03:51:50 2012 +0100

    Fix issue #155 for < 2.7 where the submodule does not make a difference between a plugin's exit(1) and an angry shell.

diff --git a/shinken/action.py b/shinken/action.py
index 1e0c0d3..95ab258 100644
--- a/shinken/action.py
+++ b/shinken/action.py
@@ -123,8 +123,8 @@ class __Action(object):
                 return
             return
         # Get standards outputs
-        self.exit_status = self.process.returncode
         (stdoutdata, stderrdata) = self.process.communicate()
+        self.exit_status = self.process.returncode
 
         # we should not keep the process now
         del self.process
@@ -133,6 +133,12 @@ class __Action(object):
         # TODO : Anormal should be logged properly no?
         if self.exit_status not in valid_exit_status:
             stdoutdata = stdoutdata + stderrdata
+        elif 'sh: -c: line 0: unexpected EOF while looking for matching' in stderrdata:
+            # Very, very ugly. But subprocess._handle_exitstatus does not see
+            # a difference between a regular "exit 1" and a bailing out shell.
+            # Strange, because strace clearly shows a difference. (exit_group(1) vs. exit_group(257))
+            stdoutdata = stdoutdata + stderrdata
+            self.exit_status = 3
         # Now grep what we want in the output
         self.get_outputs(stdoutdata, max_plugins_output_length)
 
diff --git a/test/test_action.py b/test/test_action.py
index 679b28c..9ada250 100755
--- a/test/test_action.py
+++ b/test/test_action.py
@@ -23,6 +23,7 @@
 #
 
 import os
+import sys
 
 #It's ugly I know....
 from shinken_test import *
@@ -152,8 +153,12 @@ class TestAction(ShinkenTest):
         self.assert_(a.status == 'done')
         self.wait_finished(a)
         print "FUck", a.status, a.output
-        self.assert_(a.exit_status == 3)
-        self.assert_(a.output == 'Not a valid shell command: No closing quotation')
+        if sys.version_info < (2, 7):
+            self.assert_('sh: -c: line 0: unexpected EOF while looking for matching' in a.output)
+            self.assert_(a.exit_status == 3)
+        else:
+            self.assert_(a.output == 'Not a valid shell command: No closing quotation')
+            self.assert_(a.exit_status == 3)
 
 
 if __name__ == '__main__':

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list