예제 #1
0
def startup(app=None):  
    global appPath
    #cmd.appPath =  os.getcwd()  EO TODO final set make sure you get the right dir !
    cs =''
    
    if app is not None:
        appPath = app  # Use to give a defined path for debug
        print " overriding appPath with app ==> %s " % appPath
    
    mg.logger  = _getLogger(appPath,True)       # logFile
    if (mg.logger is None): print('Cannot Create Log File. Check Config %s/log4py.conf' % appPath)
    mg.logger.info ("Logger targets ", mg.logger.get_targets())   
    
    cfg = _getConfig()
    if cfg is None:
        mg.logger.error("Configuration Error Exiting the program !!!")
        return -1
   
    mg.dbHandler = _getDBHandler()
    res = mg.dbHandler.connToDB()
    if ( res != 0): 
        mg.logger.error("Cannot connect to DB %s Driver %s "  % (cs,DB_DRIVER))
        return res 
    
    # Set mg globals
    mg.imgDir  = "%s\images\\" % appPath
    mg.binDir   = bindir
    mg.softdepo = softdepo     
    mg.docdepo  = softdepo     
    
    if res == 0 :
        print("Invoking _set_defaults DB %s Driver %s "  % (cs,DB_DRIVER))
        mg.logger.debug("Invoking _set_defaults DB %s Driver %s "  % (cs,DB_DRIVER))
        _setDefaults()
    
    #closeDBHandler()
    mg.logger.info("\nStarting ==> appPath", appPath)
    mg.logger.info(mg.printGlob())    
    return res   
예제 #2
0


if __name__ == '__main__':
    #r = startup("C:\\")
    #print "startup RC = %s " % r
    #startup('C:\infaapp\softinv')

    startup()
    print "XOR = %s" % XOR
    sys.exit()
    print "mg.soft_ver_rs %s " %   mg.soft_ver_rs 
    print "mg.soft_eol_rs %s " %   mg.soft_eol_rs
    print " mg.soft_ver_pid  = %s " %  mg.soft_ver_pid 
    print " mg.soft_eol_pid  = %s " %  mg.soft_eol_pid
    mg.printGlob()
    mg.printSoftInv()
    print " mg.infa_dom_rs  " , mg.infa_dom_rs 
    for d in mg.infa_dom_rs :
        print d
     
#    print "Server Cred " , mg.serv_cred_rs
    print " mg.serv_cred_rs  " , mg.serv_cred_rs
    for sc in mg.serv_cred_rs :
        print sc
    #mg.printInfaMain()
    #print "mg.env_lkup", mg.env_lkup
    #print "mg.user_lkup", mg.user_lkup
    print "mg.serv_lkup" , mg.serv_lkup
    closeDBHandler()