[Backport/2.9/64018]update ce_acl_interface to fix bugs (#64025)

* update ce_acl_interface to fix bugs

(cherry picked from commit 2849738e24)

* Module modification information
pull/64756/head
yanzhangi 5 years ago committed by Matt Davis
parent 7ca3b677c4
commit fd392ecb46

@ -0,0 +1,2 @@
bugfixes:
- ce_acl_interface - update to fix some bugs - Modified the prompt statement when the switch device cannot be configured. (https://github.com/ansible/ansible/pull/64018)

@ -122,7 +122,7 @@ updates:
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, exec_command from ansible.module_utils.network.cloudengine.ce import get_config, exec_command, cli_err_msg
from ansible.module_utils.network.cloudengine.ce import ce_argument_spec from ansible.module_utils.network.cloudengine.ce import ce_argument_spec
@ -231,11 +231,31 @@ class AclInterface(object):
end.append(item.strip()) end.append(item.strip())
self.end_state["acl interface"] = end self.end_state["acl interface"] = end
def load_config(self, config):
"""Sends configuration commands to the remote device"""
rc, out, err = exec_command(self.module, 'mmi-mode enable')
if rc != 0:
self.module.fail_json(msg='unable to set mmi-mode enable', output=err)
rc, out, err = exec_command(self.module, 'system-view immediately')
if rc != 0:
self.module.fail_json(msg='unable to enter system-view', output=err)
for cmd in config:
rc, out, err = exec_command(self.module, cmd)
if rc != 0:
if "unrecognized command found" in err.lower():
self.module.fail_json(msg="Error:The parameter is incorrect or the interface does not support this parameter.")
else:
self.module.fail_json(msg=cli_err_msg(cmd.strip(), err))
exec_command(self.module, 'return')
def cli_load_config(self, commands): def cli_load_config(self, commands):
""" Cli method to load config """ """ Cli method to load config """
if not self.module.check_mode: if not self.module.check_mode:
load_config(self.module, commands) self.load_config(commands)
def work(self): def work(self):
""" Work function """ """ Work function """

Loading…
Cancel
Save