Module: check_mk
Branch: master
Commit: 501e2447cd75921f02472d92993e46b0939d312f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=501e2447cd7592…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 15:07:19 2018 +0200
Fixed and enabled blacklisted-name warnings.
Change-Id: I73ae03719eb4e4f8543b8cf15e882ba714ffc6f0
---
checks/blade_powerfan | 3 ++-
checks/fsc_fans | 3 ++-
checks/fsc_subsystems | 3 ++-
checks/genua_fan | 3 ++-
checks/logwatch | 30 ++++++++++++++++++++----------
checks/netctr | 3 ++-
cmk/gui/config.py | 27 ++++++++++++++++++---------
cmk/gui/logwatch.py | 24 ++++++++++++++++--------
cmk/gui/md5crypt.py | 6 ++++--
cmk/gui/plugins/views/layouts.py | 3 ++-
cmk/gui/views.py | 3 ++-
cmk/gui/visuals.py | 3 ++-
omd/packages/omd/omd | 6 ++++--
tests/pylint/pylintrc | 1 -
14 files changed, 78 insertions(+), 40 deletions(-)
diff --git a/checks/blade_powerfan b/checks/blade_powerfan
index a85495a..46f4d32 100644
--- a/checks/blade_powerfan
+++ b/checks/blade_powerfan
@@ -31,7 +31,8 @@ def inventory_blade_powerfan(info):
def check_blade_powerfan(item, params, info):
warn_perc, crit_perc = params
for index, present, status, fancount, speedperc, rpm, ctrlstate in info:
- if index != item: continue
+ if index != item:
+ continue
perfdata=[ ('perc', speedperc, warn_perc, crit_perc, "0",
"100" ),
('rpm', rpm ) ]
speedperc_int = saveint(speedperc)
diff --git a/checks/fsc_fans b/checks/fsc_fans
index 10e9369..5ea3177 100644
--- a/checks/fsc_fans
+++ b/checks/fsc_fans
@@ -34,7 +34,8 @@ def check_fsc_fans(item, params, info):
for line in info: # , value1, value2 in info:
name = line[0]
- if name != item: continue
+ if name != item:
+ continue
rpm = int(line[1])
return check_fan(rpm, params)
diff --git a/checks/fsc_subsystems b/checks/fsc_subsystems
index a3e3e37..aa0dce7 100644
--- a/checks/fsc_subsystems
+++ b/checks/fsc_subsystems
@@ -32,7 +32,8 @@ def check_fsc_subsystems(item, params, info):
warn, crit = params
for line in info: # , value1, value2 in info:
name = line[0]
- if name != item: continue
+ if name != item:
+ continue
if line[1] == u"":
return 3, "Status not found in SNMP data"
status = int(line[1])
diff --git a/checks/genua_fan b/checks/genua_fan
index 85f06b4..ae002a2 100644
--- a/checks/genua_fan
+++ b/checks/genua_fan
@@ -57,7 +57,8 @@ def check_genua_fan(item, params, info):
upperwarn, uppercrit = params["upper"]
for line in info[0]:
fanNo, fanName, fanRPM, fanState = line
- if fanName != item: continue
+ if fanName != item:
+ continue
rpm = saveint(fanRPM)
state, state_readable = map_states[fanState]
diff --git a/checks/logwatch b/checks/logwatch
index 02a824a..0729d7b 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -136,19 +136,29 @@ def logwatch_state(state):
def logwatch_level_name(level):
- if level == 'O': return 'OK'
- elif level == 'W': return 'WARN'
- elif level == 'u': return 'WARN' # undefined states are treated as
warning
- elif level == 'C': return 'CRIT'
- else: return 'IGN'
+ if level == 'O':
+ return 'OK'
+ elif level == 'W':
+ return 'WARN'
+ elif level == 'u':
+ return 'WARN' # undefined states are treated as warning
+ elif level == 'C':
+ return 'CRIT'
+ else:
+ return 'IGN'
def logwatch_level_worst(worst, level):
- if level == 'O': return max(worst, 0)
- elif level == 'W': return max(worst, 1)
- elif level == 'u': return max(worst, 1)
- elif level == 'C': return max(worst, 2)
- else: return worst
+ if level == 'O':
+ return max(worst, 0)
+ elif level == 'W':
+ return max(worst, 1)
+ elif level == 'u':
+ return max(worst, 1)
+ elif level == 'C':
+ return max(worst, 2)
+ else:
+ return worst
# Extracts patterns that are relevant for the current host and item.
diff --git a/checks/netctr b/checks/netctr
index e223d3f..5a21fd7 100644
--- a/checks/netctr
+++ b/checks/netctr
@@ -73,7 +73,8 @@ def check_netctr_combined(nic, params, info):
# Look for line describing this nic
for nicline in info[1:]:
- if nicline[0] != nic: continue
+ if nicline[0] != nic:
+ continue
perfdata = []
infotxt = ""
problems_per_sec = 0.0
diff --git a/cmk/gui/config.py b/cmk/gui/config.py
index 44f1b3a..643b2ab 100644
--- a/cmk/gui/config.py
+++ b/cmk/gui/config.py
@@ -91,15 +91,24 @@ permission_declaration_functions = []
ALL_HOSTS = '(.*)'
HOST_STATE = ('__HOST_STATE__',)
HIDDEN = ('__HIDDEN__',)
-class FOREACH_HOST(object): pass
-class FOREACH_CHILD(object): pass
-class FOREACH_CHILD_WITH(object): pass
-class FOREACH_PARENT(object): pass
-class FOREACH_SERVICE(object): pass
-class REMAINING(object): pass
-class DISABLED(object): pass
-class HARD_STATES(object): pass
-class DT_AGGR_WARN(object): pass
+class FOREACH_HOST(object):
+ pass
+class FOREACH_CHILD(object):
+ pass
+class FOREACH_CHILD_WITH(object):
+ pass
+class FOREACH_PARENT(object):
+ pass
+class FOREACH_SERVICE(object):
+ pass
+class REMAINING(object):
+ pass
+class DISABLED(object):
+ pass
+class HARD_STATES(object):
+ pass
+class DT_AGGR_WARN(object):
+ pass
# Has to be declared here once since the functions can be assigned in
# bi.py and also in multisite.mk. "Double" declarations are no problem
diff --git a/cmk/gui/logwatch.py b/cmk/gui/logwatch.py
index e866568..b3d0650 100644
--- a/cmk/gui/logwatch.py
+++ b/cmk/gui/logwatch.py
@@ -482,16 +482,24 @@ stylesheets = [ 'pages', 'status',
'logwatch' ]
nagios_illegal_chars = '`;~!$%^&*|\'"<>?,()='
def level_name(level):
- if level == 'W': return 'WARN'
- elif level == 'C': return 'CRIT'
- elif level == 'O': return 'OK'
- else: return 'OK'
+ if level == 'W':
+ return 'WARN'
+ elif level == 'C':
+ return 'CRIT'
+ elif level == 'O':
+ return 'OK'
+ else:
+ return 'OK'
def level_state(level):
- if level == 'W': return 1
- elif level == 'C': return 2
- elif level == 'O': return 0
- else: return 0
+ if level == 'W':
+ return 1
+ elif level == 'C':
+ return 2
+ elif level == 'O':
+ return 0
+ else:
+ return 0
#.
diff --git a/cmk/gui/md5crypt.py b/cmk/gui/md5crypt.py
index 2d9ff1d..c11611e 100644
--- a/cmk/gui/md5crypt.py
+++ b/cmk/gui/md5crypt.py
@@ -88,10 +88,12 @@ def md5crypt(password, salt, magic='$1$'):
for a, b, c in ((0, 6, 12), (1, 7, 13), (2, 8, 14), (3, 9, 15), (4, 10, 5)):
v = ord(final[a]) << 16 | ord(final[b]) << 8 | ord(final[c])
for i in range(4):
- rearranged += itoa64[v & 0x3f]; v >>= 6
+ rearranged += itoa64[v & 0x3f]
+ v >>= 6
v = ord(final[11])
for i in range(2):
- rearranged += itoa64[v & 0x3f]; v >>= 6
+ rearranged += itoa64[v & 0x3f]
+ v >>= 6
return magic + salt + '$' + rearranged
diff --git a/cmk/gui/plugins/views/layouts.py b/cmk/gui/plugins/views/layouts.py
index ebcdfb1..c3fea76 100644
--- a/cmk/gui/plugins/views/layouts.py
+++ b/cmk/gui/plugins/views/layouts.py
@@ -654,7 +654,8 @@ def render_grouped_list(rows, view, group_cells, cells, num_columns,
show_checkb
# render state, if available through whole tr
if not row.get('service_description'):
state = row.get("host_state", 0)
- if state > 0: state +=1 # 1 is critical for hosts
+ if state > 0:
+ state +=1 # 1 is critical for hosts
else:
state = row.get("service_state", 0)
else:
diff --git a/cmk/gui/views.py b/cmk/gui/views.py
index a06b116..003c306 100644
--- a/cmk/gui/views.py
+++ b/cmk/gui/views.py
@@ -1582,7 +1582,8 @@ def sort_data(data, sorters):
c = neg * func(e1, e2, *args)
else:
c = neg * func(e1, e2)
- if c != 0: return c
+ if c != 0:
+ return c
return 0 # equal
data.sort(multisort)
diff --git a/cmk/gui/visuals.py b/cmk/gui/visuals.py
index 221ca13..6a222b8 100644
--- a/cmk/gui/visuals.py
+++ b/cmk/gui/visuals.py
@@ -103,7 +103,8 @@ def load_plugins(force):
},
})
- global title_functions ; title_functions = []
+ global title_functions
+ title_functions = []
utils.load_web_plugins('visuals', globals())
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index 126554d..b01701b 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -4420,11 +4420,13 @@ def md5crypt(password, salt, magic='$1$'):
for a, b, c in ((0, 6, 12), (1, 7, 13), (2, 8, 14), (3, 9, 15), (4, 10, 5)):
v = ord(final[a]) << 16 | ord(final[b]) << 8 | ord(final[c])
for i in range(4):
- rearranged += itoa64[v & 0x3f]; v >>= 6
+ rearranged += itoa64[v & 0x3f]
+ v >>= 6
v = ord(final[11])
for i in range(2):
- rearranged += itoa64[v & 0x3f]; v >>= 6
+ rearranged += itoa64[v & 0x3f]
+ v >>= 6
return magic + salt + '$' + rearranged
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index cafe9aa..7537c78 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -37,7 +37,6 @@ disable=
logging-not-lazy,
missing-docstring,
multiple-imports,
- multiple-statements,
no-else-return,
no-self-use,
protected-access,