From fab695ddb16b266d79bc6659ca913dd9d52d3dd2 Mon Sep 17 00:00:00 2001 From: chidanandpujar <46497833+chidanandpujar@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:42:06 +0530 Subject: [PATCH] fix for ping packet loss in float (#686) --- ansible_collections/juniper/device/plugins/modules/pmtud.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible_collections/juniper/device/plugins/modules/pmtud.py b/ansible_collections/juniper/device/plugins/modules/pmtud.py index 5e9450cc..bbb6832d 100644 --- a/ansible_collections/juniper/device/plugins/modules/pmtud.py +++ b/ansible_collections/juniper/device/plugins/modules/pmtud.py @@ -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) @@ -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