Skip to content

Commit f82db34

Browse files
committed
[snmp_facts] separate system description query
- snmp cpu test consistently fails on s6000 with default timeout. - System description takes more than 1 seconds in snmp cpu test (when all cores are pined at 100% busy). - Give this query its own timeout (5 seconds).
1 parent d3999e9 commit f82db34

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

ansible/library/snmp_facts.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,26 @@ def main():
290290

291291
results = Tree()
292292

293+
# Getting system description could take more than 1 second on some Dell platform
294+
# (e.g. S6000), increse timeout to tolerate the delay.
293295
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
294296
snmp_auth,
295-
cmdgen.UdpTransportTarget((m_args['host'], 161)),
297+
cmdgen.UdpTransportTarget((m_args['host'], 161), timeout=5.0),
296298
cmdgen.MibVariable(p.sysDescr,),
299+
)
300+
301+
if errorIndication:
302+
module.fail_json(msg=str(errorIndication) + ' querying system description.')
303+
304+
for oid, val in varBinds:
305+
current_oid = oid.prettyPrint()
306+
current_val = val.prettyPrint()
307+
if current_oid == v.sysDescr:
308+
results['ansible_sysdescr'] = decode_hex(current_val)
309+
310+
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
311+
snmp_auth,
312+
cmdgen.UdpTransportTarget((m_args['host'], 161)),
297313
cmdgen.MibVariable(p.sysObjectId,),
298314
cmdgen.MibVariable(p.sysUpTime,),
299315
cmdgen.MibVariable(p.sysContact,),
@@ -307,9 +323,7 @@ def main():
307323
for oid, val in varBinds:
308324
current_oid = oid.prettyPrint()
309325
current_val = val.prettyPrint()
310-
if current_oid == v.sysDescr:
311-
results['ansible_sysdescr'] = decode_hex(current_val)
312-
elif current_oid == v.sysObjectId:
326+
if current_oid == v.sysObjectId:
313327
results['ansible_sysobjectid'] = current_val
314328
elif current_oid == v.sysUpTime:
315329
results['ansible_sysuptime'] = current_val

0 commit comments

Comments
 (0)