[megaclisas-status] Minor fix when MegaCli* is not found in the PATH...

This commit is contained in:
Vincent S. Cojot 2016-02-18 16:01:50 -05:00
parent 4bfc7d7dfb
commit 26094a11b3
1 changed files with 11 additions and 8 deletions

View File

@ -90,18 +90,21 @@ for megabin in "MegaCli64","MegaCli","megacli":
dbgprint ('Looking for '+str(megabin)+' in PATH next..')
megaclipath = which(megabin)
if (megaclipath != None):
dbgprint ('Will use MegaCLI from here: '+str(megaclipath))
break
else:
dbgprint ('Found MegaCLI here: '+str(megaclipath))
# Check binary exists (and +x), if not print an error message
if os.path.exists(megaclipath) and os.access(megaclipath, os.X_OK):
pass
else:
if nagiosmode:
print 'UNKNOWN - Cannot find '+megaclipath
if (megaclipath != None):
if os.path.exists(megaclipath) and os.access(megaclipath, os.X_OK):
pass
else:
print 'Cannot find ' + megaclipath + 'in your PATH. Please install it.'
if nagiosmode:
print 'UNKNOWN - Cannot find '+megaclipath
else:
print 'Cannot find ' + megaclipath + 'in your PATH. Please install it.'
sys.exit(3)
else:
print 'Cannot find "MegaCli64","MegaCli" or "megacli" in your PATH. Please install it.'
sys.exit(3)