mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Update eos, ios, vyos cliconf plugin (#42300)
* Update eos cliconf plugin methods * Refactor eos cliconf plugin * Changes in eos module_utils as per cliconf plugin refactor * Fix unit test and sanity failures * Fix review comment
This commit is contained in:
parent
2aa81bf05d
commit
c068b88b38
14 changed files with 444 additions and 299 deletions
|
@ -131,25 +131,8 @@ def to_commands(module, commands):
|
|||
|
||||
|
||||
def run_commands(module, commands, check_rc=True):
|
||||
responses = list()
|
||||
connection = get_connection(module)
|
||||
|
||||
try:
|
||||
outputs = connection.run_commands(commands)
|
||||
except ConnectionError as exc:
|
||||
if check_rc:
|
||||
module.fail_json(msg=to_text(exc))
|
||||
else:
|
||||
outputs = exc
|
||||
|
||||
for item in to_list(outputs):
|
||||
try:
|
||||
item = to_text(item, errors='surrogate_or_strict')
|
||||
except UnicodeError:
|
||||
module.fail_json(msg=u'Failed to decode output from %s: %s' % (item, to_text(item)))
|
||||
|
||||
responses.append(item)
|
||||
return responses
|
||||
return connection.run_commands(commands=commands, check_rc=check_rc)
|
||||
|
||||
|
||||
def load_config(module, commands):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue