From ba41260ae04f7ce12856990e037c9cdac22e2a5d Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sun, 6 Mar 2016 23:21:32 -0500 Subject: [PATCH] bugfix for ios_config module This commit address a bug in the ios_config module when using the match: strict argument. When the argument is used, the module will compare the configuration block same as match: exact which is not the intended behavior. This commit updates the behavior to propertly handle the strict argument. --- lib/ansible/modules/network/ios/ios_config.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_config.py b/lib/ansible/modules/network/ios/ios_config.py index e6b7772532..86c8395835 100644 --- a/lib/ansible/modules/network/ios/ios_config.py +++ b/lib/ansible/modules/network/ios/ios_config.py @@ -166,15 +166,12 @@ def build_candidate(lines, parents, config, strategy): candidate = list() if strategy == 'strict': - if len(lines) != len(config): - candidate = list(lines) - else: - for index, cmd in enumerate(lines): - try: - if cmd != config[index]: - candidate.append(cmd) - except IndexError: + for index, cmd in enumerate(lines): + try: + if cmd != config[index]: candidate.append(cmd) + except IndexError: + candidate.append(cmd) elif strategy == 'exact': if len(lines) != len(config):