Ejemplo n.º 1
0
def checkKeys(conf, keyList, optional=False):

    if type(keyList) is str:
        list1 = list(keyList)
    else:
        list1 = keyList

    if not optional:
        Basic.checkExistsKeys(conf, list1, isAbort=True)

    eventDir = Globals.EventDir()
    isOk = True

    for key in list1:
        val = conf[key]
        msg = None

        if key == duration:
            msg = Basic.checkGreaterZero(val)
        elif key in [mindist, maxdist]:
            msg = Basic.checkNotNegative(val)
        elif key in [keyfilefolder, metaCatalog]:
            Basic.checkExistsDir(os.path.join(eventDir, val), isAbort=True)
        elif key in [blacklist, mail, pwd]:
            continue

        if msg is not None:
            isOk = Logfile.error('Key <' + key + '> in config file: ' + msg)

    if not isOk:
        Logfile.abort()
    return True
Ejemplo n.º 2
0
    def __init__(self):

        parser = OptionParser(usage="%prog -f Eventpath ")
        parser.add_option("-f",
                          "--evpath",
                          type="string",
                          dest="evpath",
                          help="evpath")

        (options, args) = parser.parse_args()
        self.eventpath = options.evpath

        Basic.checkExistsDir(self.eventpath, isAbort=True)
        Globals.setEventDir(self.eventpath)
        MainObj.__init__(self, self, 'ok', 'cluster_run.log', 'cluster.log')