Unpin flake8, fix lint
Change-Id: I7f47c1dac0761101980ebba3f9aab8732cb0d1ce
This commit is contained in:
parent
e350ff6144
commit
0ca99c2fc3
@ -63,6 +63,7 @@ def osd_in(args):
|
|||||||
check_call(cmd)
|
check_call(cmd)
|
||||||
assess_status()
|
assess_status()
|
||||||
|
|
||||||
|
|
||||||
# A dictionary of all the defined actions to callables (which take
|
# A dictionary of all the defined actions to callables (which take
|
||||||
# parsed arguments).
|
# parsed arguments).
|
||||||
ACTIONS = {"osd-out": osd_out, "osd-in": osd_in}
|
ACTIONS = {"osd-out": osd_out, "osd-in": osd_in}
|
||||||
|
@ -43,5 +43,6 @@ def main():
|
|||||||
}
|
}
|
||||||
return audits.action_parse_results(audits.run(config))
|
return audits.action_parse_results(audits.run(config))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
@ -66,7 +66,7 @@ def zap():
|
|||||||
len(failed_devices),
|
len(failed_devices),
|
||||||
", ".join(failed_devices))
|
", ".join(failed_devices))
|
||||||
if not_block_devices:
|
if not_block_devices:
|
||||||
if message is not '':
|
if len(message):
|
||||||
message += "\n\n"
|
message += "\n\n"
|
||||||
message += "{} devices are not block devices: {}".format(
|
message += "{} devices are not block devices: {}".format(
|
||||||
len(not_block_devices),
|
len(not_block_devices),
|
||||||
|
@ -53,9 +53,9 @@ def run_main():
|
|||||||
# command in the collect phase does fail, and so the start of the line is
|
# command in the collect phase does fail, and so the start of the line is
|
||||||
# 'Failed'
|
# 'Failed'
|
||||||
state = STATE_OK
|
state = STATE_OK
|
||||||
for l in lines:
|
for line in lines:
|
||||||
print(l, end='')
|
print(line, end='')
|
||||||
if l.startswith('Failed'):
|
if line.startswith('Failed'):
|
||||||
state = STATE_CRITICAL
|
state = STATE_CRITICAL
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
@ -20,7 +20,8 @@ def check_ceph_status(args):
|
|||||||
.check_output(["ceph", "status"])
|
.check_output(["ceph", "status"])
|
||||||
.decode('UTF-8')
|
.decode('UTF-8')
|
||||||
.split('\n'))
|
.split('\n'))
|
||||||
status_data = dict(l.strip().split(' ', 1) for l in lines if len(l) > 1)
|
status_data = dict(
|
||||||
|
line.strip().split(' ', 1) for line in lines if len(line) > 1)
|
||||||
|
|
||||||
if ('health' not in status_data or
|
if ('health' not in status_data or
|
||||||
'monmap' not in status_data or
|
'monmap' not in status_data or
|
||||||
@ -40,7 +41,7 @@ def check_ceph_status(args):
|
|||||||
msg += '"'
|
msg += '"'
|
||||||
raise nagios_plugin.CriticalError(msg)
|
raise nagios_plugin.CriticalError(msg)
|
||||||
|
|
||||||
osds = re.search("^.*: (\d+) osds: (\d+) up, (\d+) in",
|
osds = re.search(r"^.*: (\d+) osds: (\d+) up, (\d+) in",
|
||||||
status_data['osdmap'])
|
status_data['osdmap'])
|
||||||
if osds.group(1) > osds.group(2): # not all OSDs are "up"
|
if osds.group(1) > osds.group(2): # not all OSDs are "up"
|
||||||
msg = 'CRITICAL: Some OSDs are not up. Total: {}, up: {}'.format(
|
msg = 'CRITICAL: Some OSDs are not up. Total: {}, up: {}'.format(
|
||||||
|
@ -30,8 +30,8 @@ def lsb_release():
|
|||||||
"""Return /etc/lsb-release in a dict"""
|
"""Return /etc/lsb-release in a dict"""
|
||||||
d = {}
|
d = {}
|
||||||
with open('/etc/lsb-release', 'r') as lsb:
|
with open('/etc/lsb-release', 'r') as lsb:
|
||||||
for l in lsb:
|
for el in lsb:
|
||||||
k, v = l.split('=')
|
k, v = el.split('=')
|
||||||
d[k.strip()] = v.strip()
|
d[k.strip()] = v.strip()
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ def get_blacklist():
|
|||||||
|
|
||||||
def get_journal_devices():
|
def get_journal_devices():
|
||||||
if config('osd-journal'):
|
if config('osd-journal'):
|
||||||
devices = [l.strip() for l in config('osd-journal').split(' ')]
|
devices = [el.strip() for el in config('osd-journal').split(' ')]
|
||||||
else:
|
else:
|
||||||
devices = []
|
devices = []
|
||||||
storage_ids = storage_list('osd-journals')
|
storage_ids = storage_list('osd-journals')
|
||||||
@ -287,6 +287,6 @@ def is_sata30orless(device):
|
|||||||
result = subprocess.check_output(["/usr/sbin/smartctl", "-i", device])
|
result = subprocess.check_output(["/usr/sbin/smartctl", "-i", device])
|
||||||
print(result)
|
print(result)
|
||||||
for line in str(result).split("\\n"):
|
for line in str(result).split("\\n"):
|
||||||
if re.match("SATA Version is: *SATA (1\.|2\.|3\.0)", str(line)):
|
if re.match(r"SATA Version is: *SATA (1\.|2\.|3\.0)", str(line)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
charm-tools>=2.4.4
|
charm-tools>=2.4.4
|
||||||
requests>=2.18.4
|
requests>=2.18.4
|
||||||
mock>=1.2
|
mock>=1.2
|
||||||
flake8>=2.2.4,<=2.4.1
|
flake8>=2.2.4
|
||||||
stestr>=2.2.0
|
stestr>=2.2.0
|
||||||
coverage>=4.5.2
|
coverage>=4.5.2
|
||||||
pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking)
|
pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user