Ejemplo n.º 1
0
    def writeTest(self, varBind, **context):
        name, val = varBind

        # Besides common checks, request row creation on no-instance
        try:
            # First try the instance
            MibScalar.writeTest(self, varBind, **context)

        # ...otherwise proceed with creating new column
        except (error.NoSuchInstanceError, error.RowCreationWanted):
            excValue = sys.exc_info()[1]
            if isinstance(excValue, error.RowCreationWanted):
                self.__rowOpWanted[name] = excValue
            else:
                self.__rowOpWanted[name] = error.RowCreationWanted()
            self.createTest(varBind, **context)

        except error.RowDestructionWanted:
            self.__rowOpWanted[name] = error.RowDestructionWanted()
            self.destroyTest(varBind, **context)

        if name in self.__rowOpWanted:
            debug.logger & debug.flagIns and debug.logger(
                '%s flagged by %s=%r, exception %s' % (self.__rowOpWanted[name], name, val, sys.exc_info()[1]))
            raise self.__rowOpWanted[name]
Ejemplo n.º 2
0
 def writeUndo(self, name, val, idx, acInfo):
     if name in self.__rowOpWanted:
         self.__rowOpWanted[name] = error.RowDestructionWanted()
     self.__delegateWrite('Undo', name, val, idx, acInfo)
     if name in self.__rowOpWanted:
         e = self.__rowOpWanted[name]
         del self.__rowOpWanted[name]
         debug.logger & debug.flagIns and debug.logger('%s dropped by %s=%r' % (e, name, val))
         raise e
Ejemplo n.º 3
0
    def writeUndo(self, varBind, **context):
        name, val = varBind

        if name in self.__rowOpWanted:
            self.__rowOpWanted[name] = error.RowDestructionWanted()

        self.__delegateWrite('Undo', varBind, **context)

        if name in self.__rowOpWanted:
            e = self.__rowOpWanted[name]
            del self.__rowOpWanted[name]
            debug.logger & debug.flagIns and debug.logger('%s dropped by %s=%r' % (e, name, val))
            raise e
Ejemplo n.º 4
0
 def writeTest(self, name, val, idx, acInfo):
     # Besides common checks, request row creation on no-instance
     try:
         # First try the instance
         MibScalar.writeTest(self, name, val, idx, acInfo)
     # ...otherwise proceed with creating new column
     except (error.NoSuchInstanceError, error.RowCreationWanted):
         self.__rowOpWanted[name] = error.RowCreationWanted()
         self.createTest(name, val, idx, acInfo)
     except error.RowDestructionWanted:
         self.__rowOpWanted[name] = error.RowDestructionWanted()
         self.destroyTest(name, val, idx, acInfo)
     if name in self.__rowOpWanted:
         debug.logger & debug.flagIns and debug.logger(
             '%s flagged by %s=%r' % (self.__rowOpWanted[name], name, val))
         raise self.__rowOpWanted[name]
Ejemplo n.º 5
0
            self._vars[name].destroyUndo(name, val, idx, (acFun, acCtx))
            del self.__destroyedInstances[name]

    # Set/modify column

    def writeTest(self, name, val, idx, (acFun, acCtx)):
        # Besides common checks, request row creation on no-instance
        try:
            # First try the instance
            MibScalar.writeTest(self, name, val, idx, (acFun, acCtx))
        # ...otherwise proceed with creating new column
        except (error.NoSuchObjectError, error.RowCreationWanted):
            self.__rowOpWanted[name] = error.RowCreationWanted()
            self.createTest(name, val, idx, (acFun, acCtx))
        except error.RowDestructionWanted:
            self.__rowOpWanted[name] = error.RowDestructionWanted()
            self.destroyTest(name, val, idx, (acFun, acCtx))
        if self.__rowOpWanted.has_key(name):
            debug.logger & debug.flagIns and debug.logger(
                '%s flagged by %s=%s' % (self.__rowOpWanted[name], name, val))
            raise self.__rowOpWanted[name]

    def __delegateWrite(self, subAction, name, val, idx, (acFun, acCtx)):
        if not self.__rowOpWanted.has_key(name):
            getattr(MibScalar, 'write' + subAction)(self, name, val, idx,
                                                    (acFun, acCtx))
            return
        if isinstance(self.__rowOpWanted[name], error.RowCreationWanted):
            getattr(self, 'create' + subAction)(name, val, idx, (acFun, acCtx))
        if isinstance(self.__rowOpWanted[name], error.RowDestructionWanted):
            getattr(self, 'destroy' + subAction)(name, val, idx,