summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrishna Guha <trishnaguha17@gmail.com>2017-11-27 22:56:16 +0530
committerToshio Kuratomi <a.badger@gmail.com>2017-12-06 12:08:10 -0800
commit790e290b6b3f8519c8823a0b1dabafa0b7485b51 (patch)
treefbfa8d7fa4e1a70c44e39921d720337a85ff7f96
parent8b05ac687c9861ee909b8bedbbdb053db5e2ef7a (diff)
downloadansible-790e290b6b3f8519c8823a0b1dabafa0b7485b51.tar.gz
loopback doesn't support passive_interface (#33252)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commit 25a465ffcb950df1501484a728b6d460634bf52b)
-rw-r--r--lib/ansible/modules/network/nxos/nxos_interface_ospf.py2
-rw-r--r--test/units/modules/network/nxos/test_nxos_interface_ospf.py4
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py
index 63f42ba0d1..f415be3f73 100644
--- a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py
+++ b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py
@@ -296,6 +296,8 @@ def state_present(module, existing, proposed, candidate):
if existing_commands[key] == proposed_commands[key]:
continue
+ if key == 'ip ospf passive-interface' and module.params.get('interface').upper().startswith('LO'):
+ module.fail_json(msg='loopback interface does not support passive_interface')
if value is True:
commands.append(key)
elif value is False:
diff --git a/test/units/modules/network/nxos/test_nxos_interface_ospf.py b/test/units/modules/network/nxos/test_nxos_interface_ospf.py
index f47d2f9cf2..130f72819b 100644
--- a/test/units/modules/network/nxos/test_nxos_interface_ospf.py
+++ b/test/units/modules/network/nxos/test_nxos_interface_ospf.py
@@ -47,3 +47,7 @@ class TestNxosInterfaceOspfModule(TestNxosModule):
def test_nxos_interface_ospf(self):
set_module_args(dict(interface='ethernet1/32', ospf=1, area=1))
self.execute_module(changed=True, commands=['interface Ethernet1/32', 'ip router ospf 1 area 0.0.0.1'])
+
+ def test_loopback_interface_failed(self):
+ set_module_args(dict(interface='loopback0', ospf=1, area=0, passive_interface=True))
+ self.execute_module(failed=True, changed=False)