From bc9aacd83227226ce8b910e2fdff8ea747b5c433 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sat, 6 Feb 2016 09:04:25 -0500 Subject: [PATCH] bug fix for eos_config module This addresses a bug in the eos_config module that would prevent it from running properly. The module should now properly process the config and the candidate --- lib/ansible/modules/network/eos/eos_config.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/network/eos/eos_config.py b/lib/ansible/modules/network/eos/eos_config.py index 95e95ef7877..ce2bbf072b8 100644 --- a/lib/ansible/modules/network/eos/eos_config.py +++ b/lib/ansible/modules/network/eos/eos_config.py @@ -216,7 +216,8 @@ def main(): lines = module.params['lines'] parents = module.params['parents'] or list() - result = dict(changed=False) + before = module.params['before'] + after = module.params['after'] match = module.params['match'] replace = module.params['replace'] @@ -249,17 +250,12 @@ def main(): candidate = list(parents) candidate.extend(lines) - if not line.parents: - if line.text not in toplevel: - expand(line, commands) - else: - item = compare(line, config, ignore_missing) - if item: - expand(item, commands) + if before: + candidate[:0] = before - commands = flatten(commands, list()) + if after: + candidate.extend(after) - if commands: if not module.check_mode: response = module.configure(candidate) result['response'] = response