From 77be9cb42dacff76f43cbfae771f1557a81833d1 Mon Sep 17 00:00:00 2001
From: Denis GERMAIN
Date: Sun, 4 Dec 2016 12:20:06 +0100
Subject: [PATCH] Added a safeguard and print usage when no argument given
---
check_rhcs/check_rhcs.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/check_rhcs/check_rhcs.py b/check_rhcs/check_rhcs.py
index 5a8db20..6f4142d 100644
--- a/check_rhcs/check_rhcs.py
+++ b/check_rhcs/check_rhcs.py
@@ -110,6 +110,7 @@ def main():
sys.exit(2)
check_suspend = False
+ typeCheck = None
for o, a in opts:
if o in ('-c', '--cluster'):
typeCheck = 'cluster'
@@ -122,6 +123,10 @@ def main():
usage()
sys.exit()
+ if typeCheck == None:
+ usage()
+ sys.exit()
+
try:
clustatOutput = os.popen('/usr/sbin/clustat -fx')
dom = xml.dom.minidom.parse(clustatOutput)