From 3cd89bd8a44c7cca9a15aab17634f794d862d497 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Thu, 6 Apr 2017 23:14:50 +0530 Subject: [PATCH] Fix #23360 junos_config set format issue (#23365) (#23373) (cherry picked from commit 990ba90380c3ea28138d3942810c46a90f49194a) --- lib/ansible/modules/network/junos/junos_config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/junos/junos_config.py b/lib/ansible/modules/network/junos/junos_config.py index 39b6fe49825..a60098ab8fe 100644 --- a/lib/ansible/modules/network/junos/junos_config.py +++ b/lib/ansible/modules/network/junos/junos_config.py @@ -234,8 +234,6 @@ def filter_delete_statements(module, candidate): def configure_device(module, warnings): candidate = module.params['lines'] or module.params['src'] - if isinstance(candidate, string_types): - candidate = candidate.split('\n') kwargs = { 'comment': module.params['comment'], @@ -257,6 +255,9 @@ def configure_device(module, warnings): else: kwargs.update({'format': config_format, 'action': module.params['update']}) + if isinstance(candidate, string_types): + candidate = candidate.split('\n') + # this is done to filter out `delete ...` statements which map to # nothing in the config as that will cause an exception to be raised if any((module.params['lines'], config_format == 'set')):