mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
ios test changes (#35510)
* Fix over-byte * Update ios tests to call `provider` To continue to support testing `connection: local` * Fix command dict handling in ios_user * Clean up unit tests, too
This commit is contained in:
@@ -181,12 +181,12 @@ def validate_privilege(value, module):
|
||||
|
||||
|
||||
def user_del_cmd(username):
|
||||
return json.dumps({
|
||||
return {
|
||||
'command': 'no username %s' % username,
|
||||
'prompt': 'This operation will remove all username related configurations with same name',
|
||||
'answer': 'y',
|
||||
'newline': False,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def map_obj_to_commands(updates, module):
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import ast
|
||||
import re
|
||||
import json
|
||||
|
||||
@@ -58,9 +57,9 @@ class Cliconf(CliconfBase):
|
||||
if source not in ('running', 'startup'):
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
if source == 'running':
|
||||
cmd = b'show running-config all'
|
||||
cmd = 'show running-config all'
|
||||
else:
|
||||
cmd = b'show startup-config'
|
||||
cmd = 'show startup-config'
|
||||
|
||||
flags = [] if flags is None else flags
|
||||
cmd += ' '.join(flags)
|
||||
@@ -71,13 +70,12 @@ class Cliconf(CliconfBase):
|
||||
@enable_mode
|
||||
def edit_config(self, command):
|
||||
for cmd in chain(['configure terminal'], to_list(command), ['end']):
|
||||
try:
|
||||
cmd = ast.literal_eval(cmd)
|
||||
if isinstance(cmd, dict):
|
||||
command = cmd['command']
|
||||
prompt = cmd['prompt']
|
||||
answer = cmd['answer']
|
||||
newline = cmd.get('newline', True)
|
||||
except:
|
||||
else:
|
||||
command = cmd
|
||||
prompt = None
|
||||
answer = None
|
||||
|
||||
Reference in New Issue
Block a user