def __init__(self, confdir=''): self.confdir = confdir self.config = dict() self.logger = logConf() conffile = os.path.realpath(confdir) + '/config.json' self.timestamp = strftime("%Y_%m_%d_%H_%M_%S", gmtime()) try: with open(conffile, 'r') as conf: self.config = json.load(conf) except: etype = sys.exc_info()[0] evalue = sys.exc_info()[1] estr = str(etype) + ' ' + str(evalue) self.logger.logger.error("Unexpected error:" + estr) raise (CmdException(estr)) self.execdir = '' #extract info self.xmls = list() self.timeouts = list() #real cmd list self.sippcmds = list() self.nccmds = list() #ugly var self.termcmd = None
def __init__(self, confdir=''): self.confdir = confdir self.config = dict() self.logger = logConf() conffile = os.path.realpath(confdir) + '/config.json' self.timestamp = strftime("%Y_%m_%d_%H_%M_%S", gmtime()) try: with open(conffile, 'r') as conf: self.config = json.load(conf) except: etype = sys.exc_info()[0] evalue = sys.exc_info()[1] estr = str(etype) +' '+str(evalue) self.logger.logger.error("Unexpected error:"+ estr) raise(CmdException(estr)) self.execdir = '' #extract info self.xmls = list() self.timeouts = list() #real cmd list self.sippcmds = list() self.nccmds = list() #ugly var self.termcmd = None
def __init__(self, cmd='', timeout=1): #manually print exit code, remove \n self.cmd = cmd + '; echo -e -n \'\n\'$?' self.timeout = int(timeout) self.logger = logConf() self.poller = select.epoll() self.wait = None #only cmd's exit code is useful self.cmdexit = -1
def __init__(self, srcfile=''): self.file = srcfile self.lines = list() self.blocks = list() self.msgs = list() self.logger = logConf() if os.path.exists(self.file): with open(self.file, 'r') as mfile: self.lines = mfile.readlines() else: raise bparserException(self.file + " not exists")
def __init__(self, cmd='', timeout=None, retry=1): """ :param cmd: :param timeout: :param retry: :return: """ self.cmd = cmd self.timeout = timeout self.retry = retry self.logger = logConf() self.poller = select.epoll() self.fds2procs = dict() self.wait = None #returncode should be a list too self.curindex = 0 self.returncode = [-1024] * retry
def __init__(self, brickdir='', confdir='', configfile='', configspec=''): self.attr = ConfAttr() #brick xml dir self.brickdir = brickdir #case def dir self.confdir = confdir self.logger = logConf() #sub config may still exist. self.subconf = list() self.config = None try: conffile = os.path.realpath(confdir + '/' + configfile) config = ConfigObj(conffile, configspec=configspec, file_error=True) self.config = config #remove validate function, just raise exception when keyerror except: etype = sys.exc_info()[0] evalue = sys.exc_info()[1] self.logger.logger.error("Unexpected error:"+ str(etype) +' '+str(evalue))
def __init__(self): #device init self.logger = logConf()
def __init__(self): self.sipmsg = None self.logger = logConf() self.sdpparser = SdpParser()