diff options
author | yanzhangi <51999930+yanzhangi@users.noreply.github.com> | 2019-10-12 03:46:22 +0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2019-10-12 09:17:09 -0700 |
commit | b4222e2b1f5c7a1e6148bd629bbf4b0d113adb8c (patch) | |
tree | 14a73b0f836a74c921b010b9342c739cff441e15 | |
parent | fca2fc708e6cf37b39617cb17b861f9cbe03f590 (diff) | |
download | ansible-b4222e2b1f5c7a1e6148bd629bbf4b0d113adb8c.tar.gz |
[Backport/2.9/61653]Update ce_netstream_aging to fix bugs (#62658)
* Update ce_netstream_aging to fix bugs (#61653)
* Update ce_netstream_aging to fix bugs
* Update ce_netstream_aging to fix bugs
(cherry picked from commit 80fa2a081634747be5ddd916ac41ae63591b9c6e)
* Update ce_netstream_aging modified information
-rw-r--r-- | changelogs/fragments/61653-ce_netstream_aging-to-fix-bugs.yml | 2 | ||||
-rw-r--r-- | lib/ansible/modules/network/cloudengine/ce_netstream_aging.py | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/changelogs/fragments/61653-ce_netstream_aging-to-fix-bugs.yml b/changelogs/fragments/61653-ce_netstream_aging-to-fix-bugs.yml new file mode 100644 index 0000000000..9f22058402 --- /dev/null +++ b/changelogs/fragments/61653-ce_netstream_aging-to-fix-bugs.yml @@ -0,0 +1,2 @@ +bugfixes: +- ce_netstream_aging- update to fix some bugs - Modify the configured query statement and replace get_config with exec_command. (https://github.com/ansible/ansible/pull/61653) diff --git a/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py b/lib/ansible/modules/network/cloudengine/ce_netstream_aging.py index 42ac8950dd..bdb478bcd1 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') |