[Python-modules-team] Bug#420962: python-twisted-snmp: patches for/from zenoss

Bernd Zeimetz bernd at bzed.de
Wed Apr 25 14:35:51 UTC 2007


Package: python-twisted-snmp
Version: 0.3.13-2
Severity: wishlist
Tags: patch


Hey Stefano,

as discussed some weeks ago, here are the patches from/for Zenoss.
Please review and test them. I'm not sure if patch 01 is really an
enhancement, it could probably break other programs using the library -
but that's easy to fix in Zenoss instead.

Thanks,


Bernd
-------------- next part --------------
--- snmpprotocol.py.~1~	2006-03-23 16:54:51.000000000 -0500
+++ snmpprotocol.py	2006-05-15 10:34:58.000000000 -0400
@@ -145,7 +145,7 @@
 					key, log.getException(err),
 				)
 			else:
-				return target, ID.get()
+				return ID.get()
 		raise KeyError( """Unable to get a request key id from %s for target %s"""%( request, target))
 
 	def decode( self, message ):
-------------- next part --------------
--- v3/agentproxy.py.~2~	2006-05-03 09:23:26.000000000 -0400
+++ v3/agentproxy.py	2006-05-15 10:36:21.000000000 -0400
@@ -284,9 +284,8 @@
 			if request is not None:
 				# this is hacky, initialValue is the incrementer for the global value
 				pdu = request['pdu'][pduKey]
-				#current = pdu['request_id'].get()
-				pdu['request_id'].inc(1)
-				#assert pdu['request_id'].get() == current + 1, (pdu['request_id'].get(),current+1)
+				pdu['request_id'].initialValue()
+				# print pdu['request_id'].get()
 				return request
 		implementation = self.getImplementation()
 		if bulk:
-------------- next part --------------
--- v3/agentproxy.py	2006-08-08 09:39:11.000000000 -0400
+++ v3/agentproxy.py	2006-08-15 14:57:34.000000000 -0400
@@ -328,7 +328,8 @@
 			return [
 				(OID(a),b.getTerminal().get())
 				for a,b in answer
-				if not isinstance( b, v2c.EndOfMibView)
+				if not isinstance( b, (v2c.EndOfMibView,
+                                                       v2c.NoSuchObject))
 			]
 		return []
 	def _timeout(self, key, df, oids, timeout, retryCount):
-------------- next part --------------
--- tableretriever.py	2006-03-23 17:38:00.000000000 -0500
+++ tableretriever.py.new	2007-02-13 10:42:10.000000000 -0500
@@ -246,12 +246,12 @@
 		"""
 		if not df.called:
 			try:
+				try:
+					if self.proxy.protocol.requests[key][0] is df:
+						del self.proxy.protocol.requests[ key ]
+				except KeyError:
+					pass
 				if retryCount > 0:
-					try:
-						if self.proxy.protocol.requests[key][0] is df:
-							del self.proxy.protocol.requests[ key ]
-					except KeyError:
-						pass
 					return self.getTable( oids, roots, includeStart, retryCount-1, delay*1.5 )
 				try:
 					if not self.finished and getattr(self,'df',None):


More information about the Python-modules-team mailing list