From 82333894462d2ca37b6aa8c757b776a3c6dc3d09 Mon Sep 17 00:00:00 2001 From: yanzhangi <51999930+yanzhangi@users.noreply.github.com> Date: Wed, 18 Sep 2019 11:56:15 +0800 Subject: [PATCH] Update ce_netstream_export to fix bugs (#61652) * Update ce_netstream_export to fix bugs * Update ce_netstream_export to fix bugs --- .../network/cloudengine/ce_netstream_export.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/network/cloudengine/ce_netstream_export.py b/lib/ansible/modules/network/cloudengine/ce_netstream_export.py index 0437d4ceb60..a4232c9d6bd 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: