diff options
author | elie <elie> | 2010-11-14 08:30:18 +0000 |
---|---|---|
committer | elie <elie> | 2010-11-14 08:30:18 +0000 |
commit | c770b66faac4527396f13ef3bd28ce7b187d8fe5 (patch) | |
tree | 4a088410331caa306e828338ebf059873cc00649 | |
parent | b439d79d3e5c0ab71b306678a7fc34c76cff3a6d (diff) | |
download | pysnmp-c770b66faac4527396f13ef3bd28ce7b187d8fe5.tar.gz |
fix to use errorIndex only when it is set (to non-zero)
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | examples/v3arch/manager/setgen.py | 9 | ||||
-rw-r--r-- | examples/v3arch/oneliner/manager/bulkgen.py | 2 | ||||
-rw-r--r-- | examples/v3arch/oneliner/manager/getgen.py | 3 | ||||
-rw-r--r-- | examples/v3arch/oneliner/manager/nextgen.py | 2 | ||||
-rw-r--r-- | examples/v3arch/oneliner/manager/setgen.py | 3 |
6 files changed, 13 insertions, 7 deletions
@@ -29,6 +29,7 @@ Revision 4.1.15a with genErr - Fix to GETBULK CommandResponder to do a by-column MIB walk, not by-raw. - Fix to getVarBindTable() API function logic. +- Fix to example Manager scripts to use errorIndex when available. Revision 4.1.14a ---------------- diff --git a/examples/v3arch/manager/setgen.py b/examples/v3arch/manager/setgen.py index 0681025..4b90f31 100644 --- a/examples/v3arch/manager/setgen.py +++ b/examples/v3arch/manager/setgen.py @@ -51,10 +51,13 @@ snmpEngine.transportDispatcher.runDispatcher() if cbCtx['errorIndication']: print cbCtx['errorIndication'] elif cbCtx['errorStatus']: - print '%s at %s' % ( - cbCtx['errorStatus'].prettyPrint(), - cbCtx['varBinds'][int(cbCtx['errorIndex'])-1] + if cbCtx['errorIndex']: + print '%s at %s' % ( + cbCtx['errorStatus'].prettyPrint(), + cbCtx['varBinds'][int(cbCtx['errorIndex'])-1] ) + else: + print cbCtx['errorStatus'].prettyPrint() else: for o, v in cbCtx['varBinds']: print '%s = %s' % (o.prettyPrint(), v.prettyPrint()) diff --git a/examples/v3arch/oneliner/manager/bulkgen.py b/examples/v3arch/oneliner/manager/bulkgen.py index db6c654..98646a1 100644 --- a/examples/v3arch/oneliner/manager/bulkgen.py +++ b/examples/v3arch/oneliner/manager/bulkgen.py @@ -20,7 +20,7 @@ else: if errorStatus: print '%s at %s\n' % ( errorStatus.prettyPrint(), - varBindTable[-1][int(errorIndex)-1] + errorIndex and varBindTable[-1][int(errorIndex)-1] or '?' ) else: for varBindTableRow in varBindTable: diff --git a/examples/v3arch/oneliner/manager/getgen.py b/examples/v3arch/oneliner/manager/getgen.py index 3b7fce8..80f52c9 100644 --- a/examples/v3arch/oneliner/manager/getgen.py +++ b/examples/v3arch/oneliner/manager/getgen.py @@ -21,7 +21,8 @@ if errorIndication: else: if errorStatus: print '%s at %s\n' % ( - errorStatus.prettyPrint(), varBinds[int(errorIndex)-1] + errorStatus.prettyPrint(), + errorIndex and varBinds[int(errorIndex)-1] or '?' ) else: for name, val in varBinds: diff --git a/examples/v3arch/oneliner/manager/nextgen.py b/examples/v3arch/oneliner/manager/nextgen.py index defbfe4..a5ad517 100644 --- a/examples/v3arch/oneliner/manager/nextgen.py +++ b/examples/v3arch/oneliner/manager/nextgen.py @@ -19,7 +19,7 @@ else: if errorStatus: print '%s at %s\n' % ( errorStatus.prettyPrint(), - varBindTable[-1][int(errorIndex)-1] + errorIndex and varBindTable[-1][int(errorIndex)-1] or '?' ) else: for varBindTableRow in varBindTable: diff --git a/examples/v3arch/oneliner/manager/setgen.py b/examples/v3arch/oneliner/manager/setgen.py index 0eabdd3..30e13fb 100644 --- a/examples/v3arch/oneliner/manager/setgen.py +++ b/examples/v3arch/oneliner/manager/setgen.py @@ -22,7 +22,8 @@ if errorIndication: else: if errorStatus: print '%s at %s\n' % ( - errorStatus.prettyPrint(), varBinds[int(errorIndex)-1] + errorStatus.prettyPrint(), + errorIndex and varBinds[int(errorIndex)-1] or '?' ) else: for name, val in varBinds: |