code cleaning

This commit is contained in:
Benjamin Renard 2021-05-21 13:04:32 +02:00
parent 9693e0d22b
commit c3f1fd1e04

View file

@ -188,7 +188,10 @@ ceph_cmd.append('--format=json')
p = subprocess.Popen(ceph_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = p.communicate()
if output:
if not output:
print("UNKNOWN : fail to execute ceph status command")
sys.exit(STATUS['UNKNOWN'])
data = json.loads(output.decode(sys.getdefaultencoding()))
status = 'OK'
@ -258,6 +261,3 @@ if output:
else:
print("%s / %s OSDs down (OSDs UP : %s/%s)" % (msg, num_lost_osd, total_osd_up, total_osd))
sys.exit(STATUS[status])
else:
print("UNKNOWN : fail to execute ceph status command")
sys.exit(STATUS['UNKNOWN'])