Update ce_netstream_export to fix bugs (#61652)

* Update ce_netstream_export to fix bugs

* Update ce_netstream_export to fix bugs
This commit is contained in:
yanzhangi 2019-09-18 11:56:15 +08:00 committed by ansibot
parent 80fa2a0816
commit 8233389446

View file

@ -190,7 +190,7 @@ changed:
import re import re
from ansible.module_utils.basic import AnsibleModule 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 from ansible.module_utils.network.cloudengine.ce import ce_argument_spec
@ -261,10 +261,12 @@ class NetstreamExport(object):
def get_netstream_config(self): def get_netstream_config(self):
"""get current netstream configuration""" """get current netstream configuration"""
flags = list() cmd = "display current-configuration | include ^netstream export"
exp = " | inc ^netstream export" rc, out, err = exec_command(self.module, cmd)
flags.append(exp) if rc != 0:
return get_config(self.module, flags) self.module.fail_json(msg=err)
config = str(out).strip()
return config
def get_existing(self): def get_existing(self):
"""get existing config""" """get existing config"""
@ -433,7 +435,7 @@ class NetstreamExport(object):
if cmd == 'netstream export ip version 5': if cmd == 'netstream export ip version 5':
cmd_tmp = "netstream export ip version" cmd_tmp = "netstream export ip version"
if is_config_exist(self.config, cmd_tmp): if cmd_tmp in self.config:
if self.state == 'present': if self.state == 'present':
self.cli_add_command(cmd, False) self.cli_add_command(cmd, False)
else: else: