From 7c4e3438649bcc39121e689a9a1abe54bb90800c Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Fri, 9 Feb 2018 11:37:02 +0530 Subject: [PATCH] networking fix cherry-pick (#35936) * Add minor conditional checks to nxos_bgp sanity test (#35476) * Add minor conditional checks to nxos_bgp sanity test * Make ansibot happy (cherry picked from commit 5a198e1e6a64c6dd362f659950e309f296133892) * fixing the removed_in_version to 2.6. (#35853) (cherry picked from commit 73650cf854a1c726dfaa017d669429282bd52204) * 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 (cherry picked from commit b30f3b9f4dee11736075c14781c4a161c2b5d402) * update CHANGELOG Signed-off-by: Trishna Guha --- CHANGELOG.md | 4 ++++ lib/ansible/modules/network/eos/eos_config.py | 8 +++++--- lib/ansible/modules/network/ios/ios_config.py | 4 ++-- .../targets/nxos_bgp/tests/common/sanity.yaml | 9 ++++++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d154b2326e2..bd03c0d3454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ Ansible Changes By Release (https://github.com/ansible/ansible/pull/35590) * Include dest i nthe results from file copy: https://github.com/ansible/ansible/pull/35702/ +* Fix eos_config second-level indent idempotece + https://github.com/ansible/ansible/pull/35588 +* Fix the removed_in_version to 2.6 ios_config force option + https://github.com/ansible/ansible/pull/35853 diff --git a/lib/ansible/modules/network/eos/eos_config.py b/lib/ansible/modules/network/eos/eos_config.py index 595bc915a5f..7aac07d7a40 100644 --- a/lib/ansible/modules/network/eos/eos_config.py +++ b/lib/ansible/modules/network/eos/eos_config.py @@ -62,6 +62,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" @@ -278,7 +280,7 @@ from ansible.module_utils.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']: @@ -297,7 +299,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(): @@ -360,7 +362,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 diff --git a/lib/ansible/modules/network/ios/ios_config.py b/lib/ansible/modules/network/ios/ios_config.py index 188ccfcc6bc..ef5a7329d67 100644 --- a/lib/ansible/modules/network/ios/ios_config.py +++ b/lib/ansible/modules/network/ios/ios_config.py @@ -122,7 +122,7 @@ options: without first checking if already configured. - Note this argument should be considered deprecated. To achieve the equivalent, set the C(match=none) which is idempotent. This argument - will be removed in Ansible 2.7. + will be removed in Ansible 2.6. required: false default: false type: bool @@ -410,7 +410,7 @@ def main(): save=dict(default=False, type='bool', removed_in_version='2.8'), # force argument deprecated in ans2.2 - force=dict(default=False, type='bool', removed_in_version='2.7') + force=dict(default=False, type='bool', removed_in_version='2.6') ) argument_spec.update(ios_argument_spec) diff --git a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml index 0b7d0ab53bf..b8b5f8af9f8 100644 --- a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml @@ -2,10 +2,13 @@ - debug: msg="START TRANSPORT:{{ connection.transport }} nxos_bgp sanity test" - set_fact: neighbor_down_fib_accelerate="true" - when: not titanium + when: (not titanium) and ((imagetag != 'N1') and (imagetag != 'D1')) - set_fact: reconnect_interval="55" - when: not titanium + when: (not titanium) and ((imagetag != 'N1') and (imagetag != 'D1')) + +- set_fact: isolate="false" + when: platform is not match("N35") - name: "Enable feature BGP" nxos_feature: @@ -75,7 +78,7 @@ graceful_restart_helper: true graceful_restart_timers_restart: 130 graceful_restart_timers_stalepath_time: 310 - isolate: false + isolate: "{{isolate|default(omit)}}" log_neighbor_changes: true maxas_limit: 50 neighbor_down_fib_accelerate: "{{neighbor_down_fib_accelerate|default(omit)}}"