summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryanzhangi <51999930+yanzhangi@users.noreply.github.com>2019-10-12 03:39:41 +0800
committerToshio Kuratomi <a.badger@gmail.com>2019-10-12 09:17:09 -0700
commitc8790739e7790901f3f4b2a50a23556151b89b5d (patch)
treedfb467a02b29d92f41a3c0e33f87dbec8b4d7539
parent1d55db2e145b46e14b66657f6438ab207faffa5b (diff)
downloadansible-c8790739e7790901f3f4b2a50a23556151b89b5d.tar.gz
[Backport/2.9/61013]Update ce_evpn_global to fix bugs (#62694)
* Update ce_evpn_global modified information * Update ce_evpn_global to fix bugs (cherry picked from commit 9c6899a92f4e1f62581f3958f7a8627e1027a37a)
-rw-r--r--changelogs/fragments/61013-ce_evpn_bgp-to-fix-bugs.yml2
-rw-r--r--lib/ansible/modules/network/cloudengine/ce_evpn_global.py12
2 files changed, 8 insertions, 6 deletions
diff --git a/changelogs/fragments/61013-ce_evpn_bgp-to-fix-bugs.yml b/changelogs/fragments/61013-ce_evpn_bgp-to-fix-bugs.yml
new file mode 100644
index 0000000000..09369260d0
--- /dev/null
+++ b/changelogs/fragments/61013-ce_evpn_bgp-to-fix-bugs.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- ce_evpn_global - update to fix some bugs - Modify the configured query statement and replace get_config with exec_command. (https://github.com/ansible/ansible/pull/61013)
diff --git a/lib/ansible/modules/network/cloudengine/ce_evpn_global.py b/lib/ansible/modules/network/cloudengine/ce_evpn_global.py
index b57c887ed5..bdc9d29626 100644
--- a/lib/ansible/modules/network/cloudengine/ce_evpn_global.py
+++ b/lib/ansible/modules/network/cloudengine/ce_evpn_global.py
@@ -102,7 +102,7 @@ changed:
from ansible.module_utils.basic import AnsibleModule
-from ansible.module_utils.network.cloudengine.ce import get_config, load_config
+from ansible.module_utils.network.cloudengine.ce import exec_command, load_config
from ansible.module_utils.network.cloudengine.ce import ce_argument_spec
@@ -153,11 +153,11 @@ class EvpnGlobal(object):
""" get current EVPN global configuration"""
self.global_info['evpnOverLay'] = 'disable'
- flags = list()
- exp = " | include evpn-overlay enable"
- flags.append(exp)
- config = get_config(self.module, flags)
- if config:
+ cmd = "display current-configuration | include ^evpn-overlay enable"
+ rc, out, err = exec_command(self.module, cmd)
+ if rc != 0:
+ self.module.fail_json(msg=err)
+ if out:
self.global_info['evpnOverLay'] = 'enable'
def get_existing(self):