[Backport/2.9/61774]Update ce_stp to fix bugs (#62512)

* Update ce_stp to fix bugs

(cherry picked from commit c62a0b35c7)

* Update ce_stp modified information
pull/62524/head
yanzhangi 5 years ago committed by Toshio Kuratomi
parent c202f39f47
commit 82879b03f7

@ -0,0 +1,2 @@
bugfixes:
- ce_stp - update to fix some bugs - Modify the configured query statement and replace get_config with exec_command. (https://github.com/ansible/ansible/pull/61774)

@ -167,14 +167,23 @@ updates:
import re
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 get_config as get_cli_config
from ansible.module_utils.network.cloudengine.ce import exec_command, load_config, ce_argument_spec
def get_config(module, flags):
cfg = get_cli_config(module, flags)
config = cfg.strip() if cfg else ""
"""Retrieves the current config from the device or cache"""
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"):
configs = config.split("\n")
if len(configs) > 1:

Loading…
Cancel
Save