diff options
Diffstat (limited to 'examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py')
-rw-r--r-- | examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py index 90561015..4e1b3754 100644 --- a/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py +++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py @@ -29,6 +29,7 @@ def success(args, hostname): print('%s: %s at %s' % (hostname, errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) + else: for varBind in varBinds: print(' = '.join([x.prettyPrint() for x in varBind])) @@ -43,13 +44,17 @@ def getSystem(reactor, hostname): snmpEngine = SnmpEngine() def getScalar(objectType): - d = getCmd(snmpEngine, - CommunityData('public', mpModel=0), - UdpTransportTarget((hostname, 161)), - ContextData(), - objectType) - d.addCallback(success, hostname).addErrback(failure, hostname) - return d + deferred = getCmd( + snmpEngine, + CommunityData('public', mpModel=0), + UdpTransportTarget((hostname, 161)), + ContextData(), + objectType + ) + + deferred.addCallback(success, hostname).addErrback(failure, hostname) + + return deferred return DeferredList( [getScalar(ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0))), |