1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Update ios_ping.py to allow for count > 70. (#36142)

* Update ios_ping.py to allow for count > 70.

Find 'Success...' output rather than relying on list index.  Index -1 won't pass unit test.
This commit is contained in:
nwgarner 2018-02-15 09:07:29 -08:00 committed by Nathaniel Case
parent 06f73ad578
commit fed20b825f

View file

@ -143,7 +143,12 @@ def main():
ping_results = run_commands(module, commands=results["commands"]) ping_results = run_commands(module, commands=results["commands"])
ping_results_list = ping_results[0].split("\n") ping_results_list = ping_results[0].split("\n")
success, rx, tx, rtt = parse_ping(ping_results_list[3]) stats = ""
for line in ping_results_list:
if line.startswith('Success'):
stats = line
success, rx, tx, rtt = parse_ping(stats)
loss = abs(100 - int(success)) loss = abs(100 - int(success))
results["packet_loss"] = str(loss) + "%" results["packet_loss"] = str(loss) + "%"
results["packets_rx"] = int(rx) results["packets_rx"] = int(rx)