[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Gerhard Lausser
gerhard.lausser at consol.de
Tue Feb 28 22:18:23 UTC 2012
The following commit has been merged in the debian/master branch:
commit e7082bb00ecaca7d69e367d5bb518820aa41bcb2
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Sat Feb 4 13:20:52 2012 +0100
Fix issue #155 and add a test fixture
diff --git a/shinken/action.py b/shinken/action.py
index 44eb52f..4c22329 100644
--- a/shinken/action.py
+++ b/shinken/action.py
@@ -176,7 +176,15 @@ if os.name != 'nt':
if sys.version_info < (2, 7) or force_shell:
cmd = self.command.encode('utf8', 'ignore')
else:
- cmd = shlex.split(self.command.encode('utf8', 'ignore'))
+ try:
+ cmd = shlex.split(self.command.encode('utf8', 'ignore'))
+ except Exception, exp:
+ self.output = 'Not a valid shell command: ' + exp.__str__()
+ self.exit_status = 3
+ self.status = 'done'
+ self.execution_time = time.time() - self.check_time
+ return
+
# safe_print("Launching", cmd)
# safe_print("With env", self.local_env)
diff --git a/test/test_action.py b/test/test_action.py
index 9cb3456..679b28c 100755
--- a/test/test_action.py
+++ b/test/test_action.py
@@ -139,6 +139,23 @@ class TestAction(ShinkenTest):
self.assert_(a.status == 'done')
+ def test_got_unclosed_quote(self):
+ # https://github.com/naparuba/shinken/issues/155
+ a = Action()
+ a.timeout = 10
+ a.command = "libexec/dummy_command_nobang.sh -a 'wwwwzzzzeeee"
+ a.env = {}
+ if os.name == 'nt':
+ return
+ a.execute()
+
+ 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 __name__ == '__main__':
import sys
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list