#!/bin/env python '''Testlet to check that various filesystems are accessible''' import os import time import test_utils as util # paths we are testig Test_Paths = ('/nas/gemd/georisk_models', ) name = 'Test of filesystem accessibility' def test(logfile): result = True (cluster, domain) = util.get_hostname() # get python to run python_env_var = os.getenv('PYTHON') # get max width of the filesystem paths width = 0 for path in Test_Paths: width = max(len(path), width) # test each path for path in Test_Paths: util.log_print(logfile, "Testing: %s" % path.ljust(width+2)) if os.path.isdir(path): util.log_print_nl(logfile, 'OK') else: util.log_print_nl(logfile, 'NOT ACCESSIBLE') result = False return result if __name__ == '__main__': import sys logfile = 'test.log' if len(sys.argv) > 1: logfile = sys.argv[1] try: os.remove(logfile) except: pass if not test(logfile): sys.exit(10) sys.exit(0)