Update ce_stp to fix bugs (#61774)

This commit is contained in:
yanzhangi 2019-09-18 09:45:06 +08:00 committed by ansibot
parent b2d145d924
commit 466c3e63ce

View file

@ -167,14 +167,23 @@ updates:
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 load_config, ce_argument_spec from ansible.module_utils.network.cloudengine.ce import exec_command, load_config, ce_argument_spec
from ansible.module_utils.network.cloudengine.ce import get_config as get_cli_config
def get_config(module, flags): def get_config(module, flags):
cfg = get_cli_config(module, flags) """Retrieves the current config from the device or cache"""
config = cfg.strip() if cfg else ""
flags = [] if flags is None else flags
cmd = 'display current-configuration '
cmd += ' '.join(flags)
cmd = cmd.strip()
rc, out, err = exec_command(module, cmd)
if rc != 0:
module.fail_json(msg=err)
config = str(out).strip()
if config.startswith("display"): if config.startswith("display"):
configs = config.split("\n") configs = config.split("\n")
if len(configs) > 1: if len(configs) > 1: