How to ignore error with anon-zero exit status
Ganesh Pal
ganesh1pal at gmail.com
Sun Dec 20 12:30:27 EST 2015
def run_scanner():
"""
Mount /filesystems and run scanner
"""
for cmd in [" mount /filesystems ", " scanner_start"]:
try:
out, err, ret = run(cmd, timeout=3600)
if ret != 0:
logging.error("Can't run %s got %s (%d)!" % (cmd, err, ret))
return False
except Exception as e:
logging.exception("Failed to run %s got %s" % (cmd, e))
return False
logging.info("Mount /tmp.....Done !!!")
time.sleep(30)
Iam on python 2.6 and Linux , I need you inputs on how to ignore an
specific error when the mount fails
In general the mount has zero status if it succeeds and anon-zero exit
status if it fails.
1.But for one rare case the mount succeeds but returns anon-zero exit
status and when we get “Reading GUID from da0xxx: No such file or
directory” error , how to ignore this error and proceed with the above
code
2. Also need to add this check only for mount case i.e mount
/filesystems and not scanner_start
Any recommendations would be appreciated.
Regards,
Ganesh
More information about the Python-list
mailing list