Module: check_mk
Branch: master
Commit: 3f1bef9dc897d5bf6dd981f604ab6e1c39f54c17
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3f1bef9dc897d5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 8 11:48:34 2014 +0100
check_smtp: fix datatype of port number from str to int
---
checks/check_smtp | 3 ++-
modules/check_mk_base.py | 2 +-
web/plugins/wato/active_checks.py | 20 ++++++++++++--------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/checks/check_smtp b/checks/check_smtp
index 1bd5e4c..bc75c0b 100644
--- a/checks/check_smtp
+++ b/checks/check_smtp
@@ -32,7 +32,8 @@ def check_smtp_arguments(params):
args += ' -e %s' % quote_shell_string(settings["expect"])
if "port" in settings:
- args += ' -p %s' % quote_shell_string(settings["port"])
+ port = int(settings["port"]) # ValueSpec was broken, convert to int
+ args += ' -p %d' % port
if "ip_version" in settings:
if settings['ip_version'] == 'ipv4':
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 5b0225f..00008af 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1872,7 +1872,7 @@ def get_age_human_readable(secs):
# Quote string for use as arguments on the shell
def quote_shell_string(s):
- return "'" + str(s).replace("'",
"'\"'\"'") + "'"
+ return "'" + s.replace("'",
"'\"'\"'") + "'"
# Check if a timeperiod is currently active. We have no other way than
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index cea3cc4..1b5497b 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -935,14 +935,18 @@ register_rule(group,
help = _("You can specify a hostname or IP address
different from the IP address "
"of the host as configured in your host
properties."))),
( "port",
- TextAscii(
- title = _("TCP Port to connect to"),
- help = _("The TCP Port the SMTP server is listening on.
"
- "The default is <tt>25</tt>."),
- size = 5,
- allow_empty = False,
- default_value = "25",
- )
+ Transform(
+ Integer(
+ title = _("TCP Port to connect to"),
+ help = _("The TCP Port the SMTP server is listening on.
"
+ "The default is
<tt>25</tt>."),
+ size = 5,
+ minvalue = 1,
+ maxvalue = 65535,
+ default_value = "25",
+ ),
+ forth = int,
+ )
),
( "ip_version",
Alternative(