Module: check_mk
Branch: master
Commit: 1de0b5a86b679d1e1c85e2dd5eade6b689f9a95a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1de0b5a86b679d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 11:08:18 2018 +0200
Various fixes to previous fixes, more to come...
Change-Id: I628cebc41d76c3661361f7803b40655eac9134c3
---
cmk/gui/plugins/views/inventory.py | 5 +----
cmk/gui/plugins/views/painters.py | 2 +-
cmk/gui/plugins/wato/bi.py | 2 +-
cmk/gui/plugins/wato/check_parameters.py | 21 +++++++--------------
cmk/gui/plugins/wato/utils.py | 5 +----
cmk/gui/wato/__init__.py | 17 +++--------------
6 files changed, 14 insertions(+), 38 deletions(-)
diff --git a/cmk/gui/plugins/views/inventory.py b/cmk/gui/plugins/views/inventory.py
index a425baa..1f86793 100644
--- a/cmk/gui/plugins/views/inventory.py
+++ b/cmk/gui/plugins/views/inventory.py
@@ -1921,10 +1921,7 @@ def ajax_inv_render_tree():
hostname = html.var("host")
invpath = html.var("path")
tree_id = html.var("treeid", "")
- if html.var("show_internal_tree_paths"):
- show_internal_tree_paths = True
- else:
- show_internal_tree_paths = False
+ show_internal_tree_paths = bool(html.var("show_internal_tree_paths"))
if tree_id:
struct_tree = inventory.load_delta_tree(hostname, int(tree_id[1:]))
tree_renderer = DeltaNodeRenderer(hostname, tree_id, invpath)
diff --git a/cmk/gui/plugins/views/painters.py b/cmk/gui/plugins/views/painters.py
index d64bc83..561ac40 100644
--- a/cmk/gui/plugins/views/painters.py
+++ b/cmk/gui/plugins/views/painters.py
@@ -593,7 +593,7 @@ multisite_painters["svc_check_cache_info"] = {
"short" : _("Cached"),
"columns" : [ "service_last_check",
"service_cached_at", "service_cache_interval" ],
"options" : [ "ts_format", "ts_date" ],
- "paint" : lambda row: paint_cache_info(row),
+ "paint" : paint_cache_info,
}
multisite_painters["svc_next_check"] = {
diff --git a/cmk/gui/plugins/wato/bi.py b/cmk/gui/plugins/wato/bi.py
index ab02316..d5392c3 100644
--- a/cmk/gui/plugins/wato/bi.py
+++ b/cmk/gui/plugins/wato/bi.py
@@ -588,7 +588,7 @@ class ModeBI(WatoMode, BIManagement):
title = _("Arguments:"),
),
],
- validate = lambda v, vp: self._validate_rule_call(v, vp),
+ validate = self._validate_rule_call,
)
diff --git a/cmk/gui/plugins/wato/check_parameters.py
b/cmk/gui/plugins/wato/check_parameters.py
index 9f998df..8411166 100644
--- a/cmk/gui/plugins/wato/check_parameters.py
+++ b/cmk/gui/plugins/wato/check_parameters.py
@@ -881,20 +881,13 @@ register_check_parameters(
# '----------------------------------------------------------------------'
def transform_ipmi_inventory_rules(p):
- if type(p) == dict:
- if p.get("summarize", True):
- summarize = True
- else:
- summarize = False
-
- if summarize:
- p = 'summarize'
- else:
- if p.get('ignored_sensors', []):
- p = ('single', {'ignored_sensors' :
p["ignored_sensors"]})
- else:
- p = ('single', {})
- return p
+ if not isinstance(p, dict):
+ return p
+ if p.get("summarize", True):
+ return 'summarize'
+ if p.get('ignored_sensors', []):
+ return ('single', {'ignored_sensors' :
p["ignored_sensors"]})
+ return ('single', {})
register_rule(
group + '/' + subgroup_inventory,
diff --git a/cmk/gui/plugins/wato/utils.py b/cmk/gui/plugins/wato/utils.py
index 9a05127..5f536e2 100644
--- a/cmk/gui/plugins/wato/utils.py
+++ b/cmk/gui/plugins/wato/utils.py
@@ -774,10 +774,7 @@ class TimeperiodValuespec(ValueSpec):
# Checks whether the value itself already uses the tp-mode
def _is_active(self, value):
- if isinstance(value, dict) and self.tp_default_value_key in value:
- return True
- else:
- return False
+ return isinstance(value, dict) and self.tp_default_value_key in value
# Returns simply the value or converts a plain value to a tp-value
diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py
index 3ff0bef..e264154 100644
--- a/cmk/gui/wato/__init__.py
+++ b/cmk/gui/wato/__init__.py
@@ -4432,20 +4432,9 @@ class ModeBulkDiscovery(WatoMode):
def _from_html_vars(self):
- if html.var("_start"):
- self._start = True
- else:
- self._start = False
-
- if html.var("all"):
- self._all = True
- else:
- self._all = False
-
- if html.var("_item"):
- self._item = html.var("_item")
- else:
- self._item = None
+ self._start = bool(html.var("_start"))
+ self._all = bool(html.var("all")):
+ self._item = html.var("_item") if html.var("_item") else
None
def _get_bulk_discovery_params(self):