diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-05-07 00:56:25 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-05-07 00:56:25 +0200 |
commit | a1b34606a6fce1cf30e6717be6559cf0befaa835 (patch) | |
tree | cae7d38ed01c8349696c3c0778cdf99b26fd5c16 | |
parent | e9d05a16fdd949cd2993244ab16a8fa89fdd73b5 (diff) | |
download | pysnmp-git-a1b34606a6fce1cf30e6717be6559cf0befaa835.tar.gz |
fix to SNMP engine boot counter persistence
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | pysnmp/entity/engine.py | 9 |
2 files changed, 3 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9b8393e9..458a5431 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,7 @@ Github `repo <https://github.com/etingof/pysnmp>`_ run. - Fix to NotificationType to make additional var-binds overriding MIB objects implicitly included through NOTIFICATION-TYPE OBJECTS. +- Fix to SNMP engine boots counter persistence on Python 3. Revision 4.3.2, released 2016-02-12 ----------------------------------- diff --git a/pysnmp/entity/engine.py b/pysnmp/entity/engine.py index ed91c7a1..96646286 100644 --- a/pysnmp/entity/engine.py +++ b/pysnmp/entity/engine.py @@ -7,6 +7,7 @@ import os import sys import tempfile +from pyasn1.compat.octets import str2octs from pysnmp.proto.rfc3412 import MsgAndPduDispatcher from pysnmp.proto.mpmod.rfc2576 import SnmpV1MessageProcessingModel, \ SnmpV2cMessageProcessingModel @@ -131,16 +132,10 @@ class SnmpEngine: try: fd, fn = tempfile.mkstemp(dir=persistentPath) - os.write(fd, snmpEngineBoots.syntax.prettyPrint()) + os.write(fd, str2octs(snmpEngineBoots.syntax.prettyPrint())) os.close(fd) os.rename(fn, f) except Exception: - try: - os.close(fd) - os.unlink(fn) - except Exception: - pass - debug.logger & debug.flagApp and debug.logger( 'SnmpEngine: could not stored SNMP Engine Boots: %s' % sys.exc_info()[1]) else: |