Ejemplo n.º 1
0
    def synchronize(self, config):
        DATABASE_STRING = config.get('FB_DATABASE_STRING',None)
        DATABASE_PSWD = config.get('FB_DATABASE_PASSWORD',None)

        if DATABASE_STRING is None or DATABASE_PSWD is None:
            raise Exception(FBE_CONFIG_ERROR,'FB_DATABASE_STRING and FB_DATABASE_PASSWORD must be set for this cluster')

        self.database = DBConnection.create_connection( DATABASE_STRING % DATABASE_PSWD )

        self.audit_level = config.get('AUDIT_LEVEL',5)

        audittypes= self.database.execute(SQL.get_audittype)

        audit_types = {}
        for atype in audittypes:
            audit_types[atype[1]] = (atype[0],atype[2])


        objectstypes= self.database.execute(SQL.get_objectstype)
        object_types = {}
        for atype in objectstypes:
            object_types[atype[1]] = atype[0]


        self.__lock.acquire_lock()
        self.audit_types = audit_types
        self.object_types = object_types
        self.__lock.release_lock()
Ejemplo n.º 2
0
    def __init__(self, config):
        DATABASE_STRING = config.get("FB_DATABASE_STRING", None)
        DATABASE_PSWD = config.get("FB_DATABASE_PASSWORD", None)

        if DATABASE_STRING is None or DATABASE_PSWD is None:
            raise Exception(
                FBE_CONFIG_ERROR, "FB_DATABASE_STRING and FB_DATABASE_PASSWORD must be set for this cluster"
            )

        self.database = DBConnection.create_connection(DATABASE_STRING % DATABASE_PSWD)