diff options
author | yanzhangi <51999930+yanzhangi@users.noreply.github.com> | 2019-10-12 03:56:13 +0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2019-10-12 09:17:09 -0700 |
commit | c68c3ad81f809ddf8a75d70276ef84fe39458b71 (patch) | |
tree | e0305a05bace6fe0a032fb4c7a73a6fd3744cff9 | |
parent | b4222e2b1f5c7a1e6148bd629bbf4b0d113adb8c (diff) | |
download | ansible-c68c3ad81f809ddf8a75d70276ef84fe39458b71.tar.gz |
[Backport/2.9/61652]Update ce_netstream_export to fix bugs (#62682)
* Update ce_netstream_export to fix bugs (#61652)
* Update ce_netstream_export to fix bugs
* Update ce_netstream_export to fix bugs
(cherry picked from commit 82333894462d2ca37b6aa8c757b776a3c6dc3d09)
* Update ce_netstream_export modified information
-rw-r--r-- | changelogs/fragments/61652-ce_netstream_export-to-fix-bugs.yml | 2 | ||||
-rw-r--r-- | lib/ansible/modules/network/cloudengine/ce_netstream_export.py | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/changelogs/fragments/61652-ce_netstream_export-to-fix-bugs.yml b/changelogs/fragments/61652-ce_netstream_export-to-fix-bugs.yml new file mode 100644 index 0000000000..980c1b2ca1 --- /dev/null +++ b/changelogs/fragments/61652-ce_netstream_export-to-fix-bugs.yml @@ -0,0 +1,2 @@ +bugfixes: +- ce_netstream_export- update to fix some bugs - Modify the configured query statement and replace get_config with exec_command. (https://github.com/ansible/ansible/pull/61652) diff --git a/lib/ansible/modules/network/cloudengine/ce_netstream_export.py b/lib/ansible/modules/network/cloudengine/ce_netstream_export.py index 0437d4ceb6..a4232c9d6b 100644 --- a/lib/ansible/modules/network/cloudengine/ce_netstream_export.py +++ b/lib/ansible/modules/network/cloudengine/ce_netstream_export.py @@ -190,7 +190,7 @@ changed: import re 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 @@ -261,10 +261,12 @@ class NetstreamExport(object): def get_netstream_config(self): """get current netstream configuration""" - flags = list() - exp = " | inc ^netstream export" - flags.append(exp) - return get_config(self.module, flags) + cmd = "display current-configuration | include ^netstream export" + rc, out, err = exec_command(self.module, cmd) + if rc != 0: + self.module.fail_json(msg=err) + config = str(out).strip() + return config def get_existing(self): """get existing config""" @@ -433,7 +435,7 @@ class NetstreamExport(object): if cmd == 'netstream export ip version 5': cmd_tmp = "netstream export ip version" - if is_config_exist(self.config, cmd_tmp): + if cmd_tmp in self.config: if self.state == 'present': self.cli_add_command(cmd, False) else: |