From b30f3b9f4dee11736075c14781c4a161c2b5d402 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Mon, 5 Feb 2018 18:39:47 +0530 Subject: [PATCH] fix eos_config second-level indent idempotece (#35588) * fix eos_config second-level indent idempotece Signed-off-by: Trishna Guha * address ganeshrn's comment - update doc Signed-off-by: Trishna Guha --- lib/ansible/modules/network/eos/eos_config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/eos/eos_config.py b/lib/ansible/modules/network/eos/eos_config.py index fbb765fd003..aad9032d2de 100644 --- a/lib/ansible/modules/network/eos/eos_config.py +++ b/lib/ansible/modules/network/eos/eos_config.py @@ -63,6 +63,8 @@ options: or relative to the root of the implemented role or playbook. This argument is mutually exclusive with the I(lines) and I(parents) arguments. It can be a Jinja2 template as well. + src file must have same indentation as a live switch config. + Arista EOS device config has 3 spaces indentation. required: false default: null version_added: "2.2" @@ -279,7 +281,7 @@ from ansible.module_utils.network.eos.eos import check_args def get_candidate(module): - candidate = NetworkConfig(indent=2) + candidate = NetworkConfig(indent=3) if module.params['src']: candidate.load(module.params['src']) elif module.params['lines']: @@ -298,7 +300,7 @@ def get_running_config(module, config=None): if module.params['defaults']: flags.append('all') contents = get_config(module, flags=flags) - return NetworkConfig(indent=2, contents=contents) + return NetworkConfig(indent=3, contents=contents) def main(): @@ -362,7 +364,7 @@ def main(): if module.params['backup'] or (module._diff and module.params['diff_against'] == 'running'): contents = get_config(module) - config = NetworkConfig(indent=2, contents=contents) + config = NetworkConfig(indent=3, contents=contents) if module.params['backup']: result['__backup__'] = contents