Skip to content
Snippets Groups Projects
Commit 622beba6 authored by Erik Reid's avatar Erik Reid
Browse files

de-camelcased some var names

parent 87d24110
No related branches found
No related tags found
No related merge requests found
...@@ -72,13 +72,13 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover ...@@ -72,13 +72,13 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
:return: :return:
""" """
mibBuilder = builder.MibBuilder() mib_builder = builder.MibBuilder()
# mibViewController = view.MibViewController(mibBuilder) # mibViewController = view.MibViewController(mibBuilder)
compiler.addMibCompiler( compiler.addMibCompiler(
mibBuilder, mib_builder,
sources=['http://mibs.snmplabs.com/asn1/@mib@']) sources=['http://mibs.snmplabs.com/asn1/@mib@'])
# Pre-load MIB modules we expect to work with # Pre-load MIB modules we expect to work with
mibBuilder.loadModules( mib_builder.loadModules(
'SNMPv2-MIB', 'SNMPv2-MIB',
'SNMP-COMMUNITY-MIB', 'SNMP-COMMUNITY-MIB',
'RFC1213-MIB') 'RFC1213-MIB')
...@@ -86,10 +86,10 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover ...@@ -86,10 +86,10 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
logger.debug("walking %s: %s" % (agent_hostname, base_oid)) logger.debug("walking %s: %s" % (agent_hostname, base_oid))
try: try:
for (engineErrorIndication, for (engine_error_indication,
pduErrorIndication, pdu_error_indication,
errorIndex, error_index,
varBinds) in nextCmd( var_binds) in nextCmd(
SnmpEngine(), SnmpEngine(),
CommunityData(community), CommunityData(community),
UdpTransportTarget((agent_hostname, 161)), UdpTransportTarget((agent_hostname, 161)),
...@@ -101,17 +101,17 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover ...@@ -101,17 +101,17 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
# cf. http://snmplabs.com/ # cf. http://snmplabs.com/
# pysnmp/examples/hlapi/asyncore/sync/contents.html # pysnmp/examples/hlapi/asyncore/sync/contents.html
if engineErrorIndication: if engine_error_indication:
raise SNMPWalkError( raise SNMPWalkError(
f'snmp response engine error indication: ' f'snmp response engine error indication: '
f'{str(engineErrorIndication)} - {agent_hostname}') f'{str(engine_error_indication)} - {agent_hostname}')
if pduErrorIndication: if pdu_error_indication:
raise SNMPWalkError( raise SNMPWalkError(
'snmp response pdu error %r at %r' % ( 'snmp response pdu error %r at %r' % (
pduErrorIndication, pdu_error_indication,
errorIndex error_index
and varBinds[int(errorIndex) - 1][0] or '?')) and var_binds[int(error_index) - 1][0] or '?'))
if errorIndex != 0: if error_index != 0:
raise SNMPWalkError( raise SNMPWalkError(
'sanity failure: errorIndex != 0, ' 'sanity failure: errorIndex != 0, '
'but no error indication') 'but no error indication')
...@@ -120,7 +120,7 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover ...@@ -120,7 +120,7 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
# rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]),x[1]) # rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]),x[1])
# .resolveWithMib(mibViewController) # .resolveWithMib(mibViewController)
# for x in varBinds] # for x in varBinds]
for oid, val in varBinds: for oid, val in var_binds:
result = { result = {
"oid": _canonify_oid(oid), "oid": _canonify_oid(oid),
"value": _cast_snmp_value(val) "value": _cast_snmp_value(val)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment