summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2019-10-23 10:16:43 -0400
committerSumit Jaiswal <sjaiswal@redhat.com>2019-10-23 19:46:43 +0530
commit68de182555b185737353e780882159a3d213908c (patch)
tree3594419c59ecd2e48b578577f60a914594d34bf3
parentb1e8a6c1cbd2a668b462995487b819ef7dd8ba4b (diff)
downloadansible-68de182555b185737353e780882159a3d213908c.tar.gz
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
-rw-r--r--lib/ansible/modules/network/eos/eos_eapi.py2
-rw-r--r--test/units/modules/network/eos/test_eos_eapi.py6
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)