From 80fa2a081634747be5ddd916ac41ae63591b9c6e Mon Sep 17 00:00:00 2001 From: yanzhangi <51999930+yanzhangi@users.noreply.github.com> Date: Wed, 18 Sep 2019 11:56:09 +0800 Subject: [PATCH] Update ce_netstream_aging to fix bugs (#61653) * Update ce_netstream_aging to fix bugs * Update ce_netstream_aging to fix bugs --- .../network/cloudengine/ce_netstream_aging.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py b/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py index 42ac8950dde..bdb478bcd1a 100644 --- a/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py +++ b/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py @@ -192,7 +192,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 @@ -273,10 +273,12 @@ class NetStreamAging(object): inactive_tmp["vxlan"] = "30" tcp_tmp["ip"] = "absent" tcp_tmp["vxlan"] = "absent" - flags = list() - exp = " | ignore-case include netstream timeout" - flags.append(exp) - config = get_config(self.module, flags) + + cmd = "display current-configuration | include ^netstream timeout" + rc, out, err = exec_command(self.module, cmd) + if rc != 0: + self.module.fail_json(msg=err) + config = str(out).strip() if config: config = config.lstrip() config_list = config.split('\n') @@ -313,10 +315,11 @@ class NetStreamAging(object): inactive_tmp["vxlan"] = "30" tcp_tmp["ip"] = "absent" tcp_tmp["vxlan"] = "absent" - flags = list() - exp = " | ignore-case include netstream timeout" - flags.append(exp) - config = get_config(self.module, flags) + cmd = "display current-configuration | include ^netstream timeout" + rc, out, err = exec_command(self.module, cmd) + if rc != 0: + self.module.fail_json(msg=err) + config = str(out).strip() if config: config = config.lstrip() config_list = config.split('\n')