Module: check_mk
Branch: master
Commit: 3d6b824f9343b88a813bd1f7459306f9e43cadf1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d6b824f9343b8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Oct 16 15:51:56 2018 +0200
6805 FIX printer_supply_ricoh: Fixed conversion of parameters which have an old format
Change-Id: I1777dea1c7a3c4353576c71ee3584a1772727bae
---
.werks/6805 | 11 +++++++++++
checks/printer_supply_ricoh | 9 ++++++---
cmk/gui/plugins/wato/check_parameters.py | 18 ++++++++----------
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/.werks/6805 b/.werks/6805
new file mode 100644
index 0000000..cf993d7
--- /dev/null
+++ b/.werks/6805
@@ -0,0 +1,11 @@
+Title: printer_supply_ricoh: Fixed conversion of parameters which have an old format
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1539696328
+
+
diff --git a/checks/printer_supply_ricoh b/checks/printer_supply_ricoh
index 6b4835e..2008837 100644
--- a/checks/printer_supply_ricoh
+++ b/checks/printer_supply_ricoh
@@ -92,11 +92,14 @@ def check_printer_supply_ricoh(item, params, parsed):
# unknown code
return handle_regular(0)
- if type(params) == tuple:
- params = { "levels" : params }
+ if isinstance(params, tuple):
+ if len(params) == 2:
+ params = {"levels" : params}
+ else:
+ params = {"levels" : params[:2],
+ "upturn_toner": params[2]}
warn, crit = params["levels"]
-
for name, supply_level in parsed.items():
if item == name:
if supply_level < 0:
diff --git a/cmk/gui/plugins/wato/check_parameters.py
b/cmk/gui/plugins/wato/check_parameters.py
index 5b63ea8..ce0fce7 100644
--- a/cmk/gui/plugins/wato/check_parameters.py
+++ b/cmk/gui/plugins/wato/check_parameters.py
@@ -6723,16 +6723,14 @@ register_check_parameters(
# | |___/ |
# '----------------------------------------------------------------------'
-def transform_printer_supply(l):
- if type(l) == tuple:
- if len(l) == 2:
- return { "levels" : l }
-
- return {
- "levels" : l[:2],
- "upturn_toner" : l[2],
- }
- return l
+def transform_printer_supply(params):
+ if isinstance(params, tuple):
+ if len(params) == 2:
+ return {"levels" : params}
+ else:
+ return {"levels" : params[:2],
+ "upturn_toner": params[2]}
+ return params
register_check_parameters(
subgroup_printing,