diff options
author | elie <elie> | 2012-01-28 15:32:28 +0000 |
---|---|---|
committer | elie <elie> | 2012-01-28 15:32:28 +0000 |
commit | 30f8e5b8e814a7e70fc3fe77cfa498833029b566 (patch) | |
tree | e7e353f529ee98b00920b8d6e8b635ee29beb97a | |
parent | 6f30a09b90537b2dab273bfd11f0af4fc2407c71 (diff) | |
download | pysnmp-30f8e5b8e814a7e70fc3fe77cfa498833029b566.tar.gz |
fix to legacy MibBuilder.getMibPath() to prevent it from missing
.egg-based components in path.
§CVS: ----------------------------------------------------------------------
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | pysnmp/smi/builder.py | 16 |
2 files changed, 12 insertions, 6 deletions
@@ -25,6 +25,8 @@ Revision 4.2.2 module namespace so it could be used by ManagedObjects implementations. - When running on Python3, SMI will re-raise exceptions with the original traceback for easier diagnostics. +- Fix to legacy MibBuilder.getMibPath() to prevent it from missing + .egg-based components in path. - Fix to oneliner configuration routine that used to implicitly tag SNMPv1/v2c auth and transport LCD rows what resulted in huge delays when processing incoming messages wish large number diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py index a5f66df..88da215 100644 --- a/pysnmp/smi/builder.py +++ b/pysnmp/smi/builder.py @@ -87,7 +87,7 @@ class __AbstractMibSource: class ZipMibSource(__AbstractMibSource): def _init(self): p = __import__( - self._srcName, globals(),locals(), self._srcName.split('.') + self._srcName, globals(), locals(), self._srcName.split('.') ) if hasattr(p, '__loader__'): self.__loader = p.__loader__ @@ -126,7 +126,7 @@ class ZipMibSource(__AbstractMibSource): raise IOError('No file in ZIP: %s' % p) def _getData(self, p, mode=None): return self.__loader.get_data(p) - + class DirMibSource(__AbstractMibSource): def _init(self): self._srcName = os.path.normpath(self._srcName) @@ -175,16 +175,20 @@ class MibBuilder: def getMibSources(self): return self.__mibSources - # Legacy/compatibility methods + # Legacy/compatibility methods (won't work for .eggs) def setMibPath(self, *mibPaths): self.setMibSources(*[ DirMibSource(x) for x in mibPaths ]) def getMibPath(self): - l = [] + paths = () for mibSource in self.getMibSources(): if isinstance(mibSource, DirMibSource): - l.append(mibSource.fullPath()) - return tuple(l) + paths += ( mibSource.fillPath(), ) + else: + raise error.SmiError( + 'MIB source is not a plain directory: %s' % (mibSource,) + ) + return paths def loadModules(self, *modNames, **userCtx): # Build a list of available modules |