diff options
author | elie <elie> | 2012-12-05 20:57:40 +0000 |
---|---|---|
committer | elie <elie> | 2012-12-05 20:57:40 +0000 |
commit | dda11e834107d039d3bf391ec17f18cbab7340c1 (patch) | |
tree | 1dbced9d41f081fd5b4535a60a0d13990a0facca /pysnmp/smi | |
parent | cac5af846a55c46e48c29f26344544a4a4ba0d23 (diff) | |
download | pysnmp-dda11e834107d039d3bf391ec17f18cbab7340c1.tar.gz |
* probe setValue() rather than instrumClone() at terminal node value object
* group SNMP table management exceptions under TableRowManagement class
* preserve table row management exceptions propagation through MIB nodes
tree to make row operartions working again
Diffstat (limited to 'pysnmp/smi')
-rw-r--r-- | pysnmp/smi/error.py | 5 | ||||
-rw-r--r-- | pysnmp/smi/mibs/SNMPv2-SMI.py | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/pysnmp/smi/error.py b/pysnmp/smi/error.py index b65282d..b55e764 100644 --- a/pysnmp/smi/error.py +++ b/pysnmp/smi/error.py @@ -33,5 +33,6 @@ class NoSuchInstanceError(MibOperationError): pass class EndOfMibViewError(MibOperationError): pass # Row management -class RowCreationWanted(MibOperationError): pass -class RowDestructionWanted(MibOperationError): pass +class TableRowManagement(MibOperationError): pass +class RowCreationWanted(TableRowManagement): pass +class RowDestructionWanted(TableRowManagement): pass diff --git a/pysnmp/smi/mibs/SNMPv2-SMI.py b/pysnmp/smi/mibs/SNMPv2-SMI.py index 4b60fd9..55e5602 100644 --- a/pysnmp/smi/mibs/SNMPv2-SMI.py +++ b/pysnmp/smi/mibs/SNMPv2-SMI.py @@ -527,13 +527,17 @@ class MibScalarInstance(MibTree): def setValue(self, value, name, idx): try: - if hasattr(self.syntax, 'instrumClone'): - return self.syntax.instrumClone(value) + if hasattr(self.syntax, 'setValue'): + return self.syntax.setValue(value) else: return self.syntax.clone(value) except PyAsn1Error: - debug.logger & debug.flagIns and debug.logger('setValue: %s=%r failed: %s' % (self.name, value, sys.exc_info()[1])) - raise error.WrongValueError(idx=idx, name=name, msg=sys.exc_info()[1]) + why = sys.exc_info()[1] + debug.logger & debug.flagIns and debug.logger('setValue: %s=%r failed: %s' % (self.name, value, why)) + if isinstance(why, error.TableRowManagement): + raise why + else: + raise error.WrongValueError(idx=idx, name=name, msg=why) # # Subtree traversal |