当前位置: 首页>>代码示例>>Python>>正文


Python Utils.getConfdErrStr方法代码示例

本文整理汇总了Python中utils.Utils.getConfdErrStr方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.getConfdErrStr方法的具体用法?Python Utils.getConfdErrStr怎么用?Python Utils.getConfdErrStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.Utils的用法示例。


在下文中一共展示了Utils.getConfdErrStr方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initBlinky

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def initBlinky (self, confdAddress, confdPort):
        self.mySetNameGuard.isInitOrCrash()
        self.myInitBlinkyGuard.crashIfInitDone()
        pyconfdlib.confd_init(self.myName, self.myConfdDebugLevel)

        self.myConfdAddress=confdAddress
        self.myConfdPort=confdPort

        # wait for confd to start up
        connectToConfdFunctor=functools.partial(self.connectToConfd)
        res=Retry(self._log).callUntil(connectToConfdFunctor, self.myNetworkOperationRetryMax, 
                                       self.myNetworkOperationRetryIntervalMili, successValue=pyconfdlib.CONFD_OK)
        if not res.ok():
            for logFunc in self._log("connect-to-confd-failed").errorFunc(): logFunc("connectToConfd failed, last error is %s, confd_error=%s", res.ret(),
                                                    Utils.getConfdErrStr())
            a.infra.process.processFatal("Could not connect to confd (connectToConfd failed), confd_error=%s" % Utils.getConfdErrStr())

        for logFunc in self._log("connect-to-confd-succeeded").debug1Func(): logFunc("connectToConfd succeeded")

        res = pyconfdlib.maapi_wait_start(self.myMaapiSocketId, 2)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("maapi-wait-start-failed").errorFunc(): logFunc("maapi_wait_start failed, last error is %s, confd_error=%s", res.ret(),
                                                       Utils.getConfdErrStr())
            a.infra.process.processFatal("Could not wait for confd to start (maapi_wait_start failed), confd_error=%s" % Utils.getConfdErrStr())

        for logFunc in self._log("maapi-wait-start-succeeded").noticeFunc(): logFunc("Connected to CONFD")

        res = pyconfdlib.confd_load_schemas(pyconfdlib.AF_INET, self.myConfdAddress, self.myConfdPort)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("load-schemas-failed").errorFunc(): logFunc("Failed loading schemas, last error is %s, confd_error=%s", res.ret(),
                                                   Utils.getConfdErrStr())
            a.infra.process.processFatal("Could not load schemas, confd_error=%s" % Utils.getConfdErrStr())

        for logFunc in self._log("init-blonky-done").debug2Func(): logFunc("initBlinky(): Done loading schemas")
        self.myInitBlinkyGuard.initDone()
开发者ID:afeset,项目名称:miner2-tools,代码行数:37,代码来源:agent.py

示例2: confdReloadConfig

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def confdReloadConfig (self):
        if not self.myMaapiSocketId:
            for logFunc in self._log("confd-reload-config-no-maapi-socket").errorFunc(): logFunc("maapi socket not initialized, cannot reload config!")
            return ReturnCodes.kGeneralError
        
        res = pyconfdlib.maapi_reload_config(self.myMaapiSocketId)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("confd-reload-config-lib-failed").errorFunc(): logFunc("maappi_reload_config failed, last error is %s, confd_error=%s", res.ret(),
                                                              Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:14,代码来源:agent.py

示例3: attachMaapi

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def attachMaapi (self, trxContext):
        for logFunc in self._log("attach-maapi").debug3Func(): logFunc("called. trxContext=%s, self._userTrx=%s", trxContext, self._userTrx)

        transactionHandle = trxContext.getTransHandle()
        if transactionHandle in self._userTrx.keys():
            self._userTrx[transactionHandle][self.REF_COUNT_KEY_NAME] += 1
            if self._userTrx[transactionHandle][self.ATTACHED_KEY_NAME]:
                for logFunc in self._log("attach-maapi-already-attached").debug3Func(): logFunc(
                    "trx already atthaced. not calling maapi_attach. trxContext=%s, user-transactions=%s", 
                    trxContext, self._userTrx[transactionHandle])
                return ReturnCodes.kOk
        else:
            self._userTrx[transactionHandle] = {
                self.REF_COUNT_KEY_NAME : 1,
                self.ATTACHED_KEY_NAME : False
                }

        res = pyconfdlib.maapi_attach(self._maapiUserSocket, 0, trxContext)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("attach-maapi-lib-failed").errorFunc(): logFunc("maapi_attach() failed. trxContext=%s, error=%s", trxContext, Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        self._userTrx[transactionHandle][self.ATTACHED_KEY_NAME] = True

        for logFunc in self._log("attach-maapi-done").debug3Func(): logFunc("done. trxContext=%s, self._userTrx=%s", trxContext, self._userTrx)
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:28,代码来源:maapi_domain.py

示例4: buildMaapiConnection

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def buildMaapiConnection (self):
        for logFunc in self._log("build-maapi-connection").debug2Func(): logFunc("called.")

        self._maapiUserSocket=socket.socket()
        self._maapiSystemSocket=socket.socket()

        for logFunc in self._log("build-maapi-connection-sockets").debug2Func(): logFunc("sockets: user-socket=%s, system-socket=%s", self._maapiUserSocket.fileno(), self._maapiSystemSocket.fileno())

        socketList = [self._maapiUserSocket, self._maapiSystemSocket]

        for sock in socketList:
            res = pyconfdlib.maapi_connect(sock, pyconfdlib.AF_INET, self.myAgent.getConfdAddress(), self.myAgent.getConfdPort())
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("build-maapi-connection-maapi-connect-failed").errorFunc(): logFunc('maapi_connect() failed. error=%s', Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError
            res = pyconfdlib.maapi_load_schemas(sock)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("build-maapi-connection-load-schemas-failed").errorFunc(): logFunc("maapi_load_schemas() failed. error=%s", Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        res = self.startMaapiSystemSession()
        if res != ReturnCodes.kOk:
            for logFunc in self._log("build-maapi-connection-start-system-session-failed").errorFunc(): logFunc("startMaapiSystemSession() failed.")
            return ReturnCodes.kGeneralError

        for logFunc in self._log("build-maapi-connection").debug2Func(): logFunc("done.")
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:29,代码来源:maapi_domain.py

示例5: _doReadMaapiKeys

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def _doReadMaapiKeys (self, keyPath, keys, transactionHandle, socket):
        for logFunc in self._log("do-read-maapi-keys").debug3Func(): logFunc("called. keyPath=%s, trxContext=%s, transactionHandle=%s, socket=%s", keyPath, transactionHandle, transactionHandle, socket)

        cursor = a.sys.confd.pyconfdlib.pyconfdlib_high.MaapiCursor()
        res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_init_cursor(socket, transactionHandle, cursor, keyPath)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("do-read-maapi-keys-init-cursor-failed").errorFunc(): logFunc("maapi_init_cursor() failed. keyPath=%s, transactionHandle=%s, error=%s",
                                                                     keyPath, transactionHandle, Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_get_next(cursor)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("do-read-maapi-keys-get-next-first-failed").errorFunc(): logFunc("maapi_get_next() (first time) failed. keyPath=%s, error=%s", keyPath, Utils.getConfdErrStr())
            a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_destroy_cursor(cursor)
            return ReturnCodes.kGeneralError

        while cursor.getN() != 0:
            currentKey = cursor.getValue()
            if not currentKey:
                for logFunc in self._log("do-read-maapi-keys-empty-cursor").errorFunc(): logFunc("maapi_get_next() return an empty cursor. keyPath=%s, keys=%s", keyPath, [x for x in keys])
                a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_destroy_cursor(cursor)
                return ReturnCodes.kGeneralError
            keys.append(currentKey)

            res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_get_next(cursor)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("do-read-maapi-keys-get-next-failed").errorFunc(): logFunc("maapi_get_next() failed. keyPath=%s, keys=%s, error=%s", keyPath, [x for x in keys], Utils.getConfdErrStr())
                a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_destroy_cursor(cursor)
                return ReturnCodes.kGeneralError

        a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_destroy_cursor(cursor)

        for logFunc in self._log("do-read-maapi-keys-done").debug3Func(): logFunc("done. keyPath=%s, keys=%s, transactionHandle=%s", keyPath, [str(x) for x in keys], transactionHandle)
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:36,代码来源:maapi_domain.py

示例6: getNextMaapiCursor

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def getNextMaapiCursor (self, cursor):
        for logFunc in self._log("get-next-maapi-cursor").debug3Func(): logFunc("called")

        res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_get_next(cursor)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("get-next-maapi-cursor-get-next-first-failed").errorFunc(): logFunc("maapi_get_next() failed. error=%s", Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:10,代码来源:maapi_domain.py

示例7: deleteMaapiByStringKeyPath

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def deleteMaapiByStringKeyPath (self, itemsToDelete, trxContext):
        """
        This method is a workaround for cases where we must access multiple keys paths (like SNMP-VIEW-BASED-ACM-MIB vacmSecurityToGroup table) 
        """
        for logFunc in self._log("delete-maapi-by-string-key-path").debug3Func(): logFunc("called. itemsToDelete=%s", ['%s' % x for x in itemsToDelete])

        socket = self._maapiUserSocket
        transactionHandle = self.getTrxHandle(trxContext)
        if not transactionHandle:
            for logFunc in self._log("delete-maapi-by-string-key-path-get-trx-handle-failed").errorFunc(): logFunc(
                "getTrxHandle() failed. trxContext=%s", trxContext)
            return ReturnCodes.kGeneralError

        for item in itemsToDelete:
            for logFunc in self._log("delete-maapi-by-string-key-path-going-to-delete-item").debug3Func(): logFunc("going to delete an item: %s", item)
            res = a.sys.confd.pyconfdlib.pyconfdlib.maapi_delete(self._maapiUserSocket, transactionHandle, item)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("delete-maapi-by-string-key-path-maapi-delete-failed").errorFunc(): logFunc("maapi_delete(%s) failed. error=%s", item, Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:23,代码来源:maapi_domain.py

示例8: _doWriteMaapi

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def _doWriteMaapi (self, tagValueList, keyPath, transactionHandle, socket, itemsToDelete):
        for logFunc in self._log("do-write-maapi").debug3Func(): logFunc("called. keyPath=%s, tagValueList=%s, itemsToDelete=%s",
                                           keyPath, tagValueList, ['%s' % x for x in itemsToDelete])

        if keyPath and keyPath.getLen() == 0 and tagValueList and tagValueList.getLen() != 0:
            (xmlTag, val) = tagValueList.getAt(0)
            (tag, ns) = xmlTag
            res = pyconfdlib.maapi_set_namespace(socket, transactionHandle, ns)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("do-write-maapi-set-namespace-failed").errorFunc(): logFunc("maapi_set_namespace() failed. ns=%s, error=%s", ns, Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        if keyPath and tagValueList:
            res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_set_values(socket, transactionHandle, tagValueList, keyPath)
            if res != ReturnCodes.kOk:
                for logFunc in self._log("do-write-maapi-set-values-failed").errorFunc(): logFunc("maapi_set_values() failed. error=%s", Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        for item in itemsToDelete:
            for logFunc in self._log("do-write-maapi-going-to-delete-item").debug3Func(): logFunc("going to delete an item: %s", item)
            res = a.sys.confd.pyconfdlib.pyconfdlib.maapi_delete(socket, transactionHandle, item.getCannonicalStr())
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("do-write-maapi-maapi-delete-failed").errorFunc(): logFunc("maapi_delete(%s) failed. error=%s", item, Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:28,代码来源:maapi_domain.py

示例9: _doReadMaapi

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def _doReadMaapi (self, tagValueList, keyPath, transactionHandle, socket):
        for logFunc in self._log("do-read-maapi").debug3Func(): logFunc("called. keyPath=%s, tagValueList=%s, transactionHandler=%s, socket=%s",
                                          keyPath, tagValueList, transactionHandle, socket.fileno())

        if keyPath.getLen() == 0 and tagValueList.getLen() != 0:
            (xmlTag, val) = tagValueList.getAt(0)
            (tag, ns) = xmlTag
            res = pyconfdlib.maapi_set_namespace(socket, transactionHandle, ns)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("do-read-maapi-set-namespace-failed").errorFunc(): logFunc("maapi_set_namespace() failed. ns=%s, error=%s", ns, Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError

        res = a.sys.confd.pyconfdlib.pyconfdlib_high.maapi_get_values(socket, transactionHandle, tagValueList, keyPath)
        if res != ReturnCodes.kOk:
            for logFunc in self._log("do-read-maapi-get-values-failed").errorFunc(): logFunc("maapi_get_values() failed. error=%s", Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:20,代码来源:maapi_domain.py

示例10: startMaapiWriteTransaction

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def startMaapiWriteTransaction (self, socket):
        for logFunc in self._log("start-maapi-write-transaction").debug2Func(): logFunc("called.")

        transactionHandle = pyconfdlib.maapi_start_trans(socket, pyconfdlib.CONFD_RUNNING, pyconfdlib.CONFD_READ_WRITE)
        if not transactionHandle:
            for logFunc in self._log('start-maapi-write-transaction').errorFunc(): logFunc('pyconfdlib.maapi_start_trans() failed. error=%s', Utils.getConfdErrStr())
            return None

        for logFunc in self._log("start-maapi-write-transaction").debug2Func(): logFunc("done.")
        return transactionHandle
开发者ID:afeset,项目名称:miner2-tools,代码行数:12,代码来源:maapi_domain.py

示例11: startMaapiReadTransaction

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def startMaapiReadTransaction (self, socket):
        for logFunc in self._log("start-maapi-read-transaction").debug2Func(): logFunc("called. socket=%s", socket.fileno())

        db = pyconfdlib.CONFD_RUNNING
        transactionHandle = pyconfdlib.maapi_start_trans(socket, db, pyconfdlib.CONFD_READ)
        if not transactionHandle:
            for logFunc in self._log('start-maapi-read-transaction').errorFunc(): logFunc('pyconfdlib.maapi_start_trans() failed. error=%s', Utils.getConfdErrStr())
            return None

        for logFunc in self._log("start-maapi-read-transaction").debug2Func(): logFunc("done. socket=%s", socket.fileno())
        return transactionHandle
开发者ID:afeset,项目名称:miner2-tools,代码行数:13,代码来源:maapi_domain.py

示例12: endMaapiSystemSession

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def endMaapiSystemSession (self):
        for logFunc in self._log("end-maapi-system-session").debug2Func(): logFunc("called.")
        res = pyconfdlib.maapi_end_user_session(self._maapiSystemSocket)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("end-maapi-system-session-end-user-session-failed").errorFunc(): logFunc("maapi_end_user_session() failed. error=%s", Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        for logFunc in self._log("end-maapi-system-session").debug2Func(): logFunc("done.")
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:11,代码来源:maapi_domain.py

示例13: startMaapiSystemSession

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def startMaapiSystemSession (self):
        for logFunc in self._log("start-maapi-system-session").debug2Func(): logFunc("called.")
        res = pyconfdlib.maapi_start_user_session(self._maapiSystemSocket, None, "system", [], pyconfdlib.AF_INET, self.myAgent.getConfdAddress(), 
                                                  pyconfdlib.CONFD_PROTO_TCP)
        if res != pyconfdlib.CONFD_OK:
            for logFunc in self._log("start-maapi-system-session-start-user-session-failed").errorFunc(): logFunc("maapi_start_user_session() failed. error=%s", Utils.getConfdErrStr())
            return ReturnCodes.kGeneralError

        for logFunc in self._log("start-maapi-system-session").debug2Func(): logFunc("done.")
        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:12,代码来源:maapi_domain.py

示例14: detachMaapi

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getConfdErrStr [as 别名]
    def detachMaapi (self, trxContext):
        for logFunc in self._log("detach-maapi").debug3Func(): logFunc("called. trxContext=%s, self._userTrx=%s", trxContext, self._userTrx)

        allowFailure = False

        transactionHandle = trxContext.getTransHandle()
        if transactionHandle not in self._userTrx.keys():
            # trying to detach a transaction that is not the currently attached one.
            for logFunc in self._log("detach-maapi-detaching-unknown-trx").debug1Func(): logFunc(
                "Trying to detach an unknown trx. trxContext=%s, userTrx=%s", trxContext, self._userTrx)
            return ReturnCodes.kOk

        if self._userTrx[transactionHandle][self.ATTACHED_KEY_NAME]:
            res = pyconfdlib.maapi_detach(self._maapiUserSocket, trxContext)
            if res != pyconfdlib.CONFD_OK:
                for logFunc in self._log("detach-maapi-lib-failed").errorFunc(): logFunc("maapi_detach() failed. trxContext=%s, error=%s", trxContext, Utils.getConfdErrStr())
                return ReturnCodes.kGeneralError
            self._userTrx[transactionHandle][self.ATTACHED_KEY_NAME] = False

        self._userTrx[transactionHandle][self.REF_COUNT_KEY_NAME] -= 1
        if self._userTrx[transactionHandle][self.REF_COUNT_KEY_NAME] == 0:
            del self._userTrx[transactionHandle]

        for logFunc in self._log("detach-maapi-done").debug3Func(): logFunc("done. trxContext=%s, self._userTrx=%s", trxContext, self._userTrx)

        return ReturnCodes.kOk
开发者ID:afeset,项目名称:miner2-tools,代码行数:28,代码来源:maapi_domain.py


注:本文中的utils.Utils.getConfdErrStr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。