Module: check_mk
Branch: master
Commit: 24c2d97fa1f2f47d282e01892e1d939b490e1b3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=24c2d97fa1f2f4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 30 08:26:01 2018 +0100
6916 FIX Fixed display of incorrectly quoted commands in classic SNMP verbose output
The executed commands, e.g. when doing SNMP walks or get commands were
quoted correctly. Only the output on the console was writing out
incorrectly quoted arguments.
CMK-1351
Change-Id: I51cc9d8d4d6ad0249b0e19aed1961cedb7885eb3
---
.werks/6916 | 14 ++++++++++++++
cmk_base/classic_snmp.py | 6 ++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.werks/6916 b/.werks/6916
new file mode 100644
index 0000000..67d5f57
--- /dev/null
+++ b/.werks/6916
@@ -0,0 +1,14 @@
+Title: Fixed display of incorrectly quoted commands in classic SNMP verbose output
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1543496404
+
+The executed commands, e.g. when doing SNMP walks or get commands were quoted correctly.
+Only the output on the console was writing out incorrectly quoted arguments.
+
+CMK-1351
diff --git a/cmk_base/classic_snmp.py b/cmk_base/classic_snmp.py
index 7caed13..d39176c 100644
--- a/cmk_base/classic_snmp.py
+++ b/cmk_base/classic_snmp.py
@@ -63,8 +63,7 @@ def walk(access_data, oid, hex_plain=False, context_name=None):
command = _snmp_walk_command(access_data, context_name)
command += ["-OQ", "-OU", "-On", "-Ot",
"%s%s%s" % (protospec, ipaddress, portspec), oid]
- debug_cmd = ["''" if a == "" else a for a in command]
- console.vverbose("Running '%s'\n" % " ".join(debug_cmd))
+ console.vverbose("Running '%s'\n" %
subprocess.list2cmdline(command))
snmp_process = None
exitstatus = None
@@ -158,8 +157,7 @@ def get(access_data, oid, context_name=None):
"%s%s%s" % (protospec, ipaddress, portspec),
oid_prefix ]
- debug_cmd = ["''" if a == "" else a for a in command]
- console.vverbose("Running '%s'\n" % " ".join(debug_cmd))
+ console.vverbose("Running '%s'\n" %
subprocess.list2cmdline(command))
snmp_process = subprocess.Popen(
command, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)