def initializeCMDLOptions(opts): for o,a in opts: if LOG.isDebug(2): LOG.ndebug(2,"Parsing option '%s' <=> '%s'",o,a) if o in ("-h", "--help"): printUsage() exitScript() elif o in ("-v", "--version"): print "v",VERSION exitScript() elif o in ("-p", "--provider"): Config.setProvider(a) elif o in ("--mainClass",): Config.setMainClass(a) elif o in ("--testingMode",): Config.setTestingMode(True) elif o in ("-e", "--exec"): Config.setExecTool(a) elif o in ("-d","--debug"): RALogger.setRootLogLevel(a) elif o in ("-s","--showKeys"): Keys.printAllKeys() exitScript(0) elif o in ("--printDep",): env.putEnv(PRINT_DEPENDENCIES_AND_EXIT,"true") else: LOG.warn("Not found or path {%s}" , o)
from configuration.Configuration import Config,Keys,env, KeyEntry from configuration.Parser import ParserManger START_TIME_MS = Timer.time() VERSION = "1.0.0" USAGE_FP = os.path.dirname(Config.getScriptRootPath())+os.sep+"usage.txt" #RALogger.setRootDebugLevel() LOG = RALogging.getLogger("runapp") #LOG.setLevel(RALogging.DEBUG) PRINT_DEPENDENCIES_AND_EXIT = KeyEntry("PRINT_DEPENDENCIES_AND_EXIT") Keys.registerKey(PRINT_DEPENDENCIES_AND_EXIT) def exitScript(exitCode=0): wait = env.getEnvInt(Keys.WAIT_ON_EXIT) if wait and wait>0: if LOG.isDebug(2): LOG.ndebug(2,"Wait on exit %d" , wait) time.sleep(wait) exit(exitCode) def readConfig(path,parserName="bash-parser",auto_update=True): path = FSUtil.resolveSymlink(path)