Skip to content

Commit

Permalink
make pysnmp version available at MibBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Nov 5, 2017
1 parent 408fe6c commit 1739070
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Revision 4.4.2, released 2017-11-XX
-----------------------------------

- The pysnmp version being used gets exposed to the MIB modules
via the `MibBuilder` instance
- The .setObjects() method of the SMI types now accepts
`append=False` parameter to let the caller adding more
than 255 elements over the course of multiple calls
Expand Down
8 changes: 7 additions & 1 deletion pysnmp/smi/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from errno import ENOENT
except ImportError:
ENOENT = -1
from pysnmp import __version__ as pysnmp_version
from pysnmp.smi import error
from pysnmp import debug

Expand Down Expand Up @@ -235,13 +236,18 @@ def _getData(self, f, mode):


class MibBuilder(object):
loadTexts = 0
defaultCoreMibs = os.pathsep.join(
('pysnmp.smi.mibs.instances', 'pysnmp.smi.mibs')
)
defaultMiscMibs = 'pysnmp_mibs'

moduleID = 'PYSNMP_MODULE_ID'

loadTexts = False

# MIB modules can use this to select the features they can use
version = pysnmp_version

def __init__(self):
self.lastBuildId = self._autoName = 0
sources = []
Expand Down

0 comments on commit 1739070

Please sign in to comment.