Skip to content

Commit

Permalink
fix for ping packet loss in float (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidanandpujar authored Aug 27, 2024
1 parent b69231d commit fab695d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansible_collections/juniper/device/plugins/modules/pmtud.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def main():
results_for_minimal = junos_module.ping(ping_params,
acceptable_percent_loss=100,
results=results_for_minimal)
if int(results_for_minimal.get('packet_loss', 100)) == 100:
if round(float(results_for_minimal.get('packet_loss', 100))) == 100:
results['msg'] = "Basic connectivity to %s failed." % (results['host'])
junos_module.exit_json(**results)

Expand All @@ -368,7 +368,7 @@ def main():
current_results = junos_module.ping(ping_params,
acceptable_percent_loss=100,
results=current_results)
loss = int(current_results.get('packet_loss', 100))
loss = round(float(current_results.get('packet_loss', 100)))
if loss < 100 and test_size == params['max_size']:
# ping success with max test_size, save and break
results['failed'] = False
Expand Down

0 comments on commit fab695d

Please sign in to comment.