fix eos_config second-level indent idempotece (#35588)

* fix eos_config second-level indent idempotece

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* address ganeshrn's comment - update doc

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-02-05 18:39:47 +05:30 committed by GitHub
parent 875c1343a9
commit b30f3b9f4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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