From 68de182555b185737353e780882159a3d213908c Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 23 Oct 2019 10:16:43 -0400 Subject: eos_eapi: Added fix for bug # 51144 (#63632) * Added fix for bug # 51144 * Corrected Lint errors * Added fix for bug 51144 * Corrected errors * Added unit testcase --- lib/ansible/modules/network/eos/eos_eapi.py | 2 +- test/units/modules/network/eos/test_eos_eapi.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/eos/eos_eapi.py b/lib/ansible/modules/network/eos/eos_eapi.py index 07eeaf93eb..d3825a30df 100644 --- a/lib/ansible/modules/network/eos/eos_eapi.py +++ b/lib/ansible/modules/network/eos/eos_eapi.py @@ -264,7 +264,7 @@ def map_obj_to_commands(updates, module, warnings): else: add('protocol unix-socket') - if needs_update('state') and not needs_update('vrf'): + if needs_update('state'): if want['state'] == 'stopped': add('shutdown') elif want['state'] == 'started': diff --git a/test/units/modules/network/eos/test_eos_eapi.py b/test/units/modules/network/eos/test_eos_eapi.py index 3d80f19bd3..f002689e0c 100644 --- a/test/units/modules/network/eos/test_eos_eapi.py +++ b/test/units/modules/network/eos/test_eos_eapi.py @@ -134,7 +134,7 @@ class TestEosEapiModule(TestEosModule): def test_eos_eapi_vrf(self): set_module_args(dict(vrf='test')) - commands = ['management api http-commands', 'vrf test', 'no shutdown'] + commands = ['management api http-commands', 'no shutdown', 'vrf test', 'no shutdown'] self.start_unconfigured(changed=True, commands=commands) def test_eos_eapi_change_from_default_vrf(self): @@ -142,6 +142,10 @@ class TestEosEapiModule(TestEosModule): commands = ['management api http-commands', 'vrf test', 'no shutdown'] self.start_configured(changed=True, commands=commands) + def test_eos_eapi_default(self): + set_module_args(dict()) + self.start_configured(changed=False, commands=[]) + def test_eos_eapi_vrf_missing(self): set_module_args(dict(vrf='missing')) self.start_unconfigured(failed=True) -- cgit v1.2.1