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>pull/4420/head
parent
875c1343a9
commit
b30f3b9f4d
|
@ -63,6 +63,8 @@ options:
|
||||||
or relative to the root of the implemented role or playbook.
|
or relative to the root of the implemented role or playbook.
|
||||||
This argument is mutually exclusive with the I(lines) and
|
This argument is mutually exclusive with the I(lines) and
|
||||||
I(parents) arguments. It can be a Jinja2 template as well.
|
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
|
required: false
|
||||||
default: null
|
default: null
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
|
@ -279,7 +281,7 @@ from ansible.module_utils.network.eos.eos import check_args
|
||||||
|
|
||||||
|
|
||||||
def get_candidate(module):
|
def get_candidate(module):
|
||||||
candidate = NetworkConfig(indent=2)
|
candidate = NetworkConfig(indent=3)
|
||||||
if module.params['src']:
|
if module.params['src']:
|
||||||
candidate.load(module.params['src'])
|
candidate.load(module.params['src'])
|
||||||
elif module.params['lines']:
|
elif module.params['lines']:
|
||||||
|
@ -298,7 +300,7 @@ def get_running_config(module, config=None):
|
||||||
if module.params['defaults']:
|
if module.params['defaults']:
|
||||||
flags.append('all')
|
flags.append('all')
|
||||||
contents = get_config(module, flags=flags)
|
contents = get_config(module, flags=flags)
|
||||||
return NetworkConfig(indent=2, contents=contents)
|
return NetworkConfig(indent=3, contents=contents)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -362,7 +364,7 @@ def main():
|
||||||
|
|
||||||
if module.params['backup'] or (module._diff and module.params['diff_against'] == 'running'):
|
if module.params['backup'] or (module._diff and module.params['diff_against'] == 'running'):
|
||||||
contents = get_config(module)
|
contents = get_config(module)
|
||||||
config = NetworkConfig(indent=2, contents=contents)
|
config = NetworkConfig(indent=3, contents=contents)
|
||||||
if module.params['backup']:
|
if module.params['backup']:
|
||||||
result['__backup__'] = contents
|
result['__backup__'] = contents
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue