mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
switches the kickstart arg from True to False for eos (#17858)
The kickstart kwarg should be set to False for eos based devices and was set to True. This change cleans up problems loading json output from cli commands All eos_command test cases are now passing successfully fixes #17441
This commit is contained in:
parent
512ef49c8a
commit
50c445c356
1 changed files with 7 additions and 19 deletions
|
@ -268,26 +268,19 @@ class Cli(EosConfigMixin, CliBase):
|
||||||
NET_PASSWD_RE = re.compile(r"[\r\n]?password: $", re.I)
|
NET_PASSWD_RE = re.compile(r"[\r\n]?password: $", re.I)
|
||||||
|
|
||||||
def connect(self, params, **kwargs):
|
def connect(self, params, **kwargs):
|
||||||
super(Cli, self).connect(params, kickstart=True, **kwargs)
|
super(Cli, self).connect(params, kickstart=False, **kwargs)
|
||||||
self.shell.send('terminal length 0')
|
self.shell.send('terminal length 0')
|
||||||
|
|
||||||
def authorize(self, params, **kwargs):
|
def authorize(self, params, **kwargs):
|
||||||
passwd = params['auth_pass']
|
passwd = params['auth_pass']
|
||||||
|
if passwd:
|
||||||
self.execute(Command('enable', prompt=self.NET_PASSWD_RE, response=passwd))
|
self.execute(Command('enable', prompt=self.NET_PASSWD_RE, response=passwd))
|
||||||
|
else:
|
||||||
|
self.execute('enable')
|
||||||
|
|
||||||
### Command methods ###
|
### Command methods ###
|
||||||
|
|
||||||
def run_commands(self, commands):
|
def run_commands(self, commands):
|
||||||
"""execute the ordered set of commands on the remote host
|
|
||||||
|
|
||||||
This method will take a list of Command objects, convert them
|
|
||||||
to a list of dict objects and execute them on the shell
|
|
||||||
connection.
|
|
||||||
|
|
||||||
:param commands: list of Command objects
|
|
||||||
|
|
||||||
:returns: set of ordered responses
|
|
||||||
"""
|
|
||||||
cmds = list(prepare_commands(commands))
|
cmds = list(prepare_commands(commands))
|
||||||
responses = self.execute(cmds)
|
responses = self.execute(cmds)
|
||||||
for index, cmd in enumerate(commands):
|
for index, cmd in enumerate(commands):
|
||||||
|
@ -297,7 +290,8 @@ class Cli(EosConfigMixin, CliBase):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise NetworkError(
|
raise NetworkError(
|
||||||
msg='unable to load response from device',
|
msg='unable to load response from device',
|
||||||
response=responses[index]
|
response=responses[index],
|
||||||
|
responses=responses
|
||||||
)
|
)
|
||||||
return responses
|
return responses
|
||||||
|
|
||||||
|
@ -312,12 +306,6 @@ def prepare_config(commands):
|
||||||
|
|
||||||
|
|
||||||
def prepare_commands(commands):
|
def prepare_commands(commands):
|
||||||
""" transforms a list of Command objects to dict
|
|
||||||
|
|
||||||
:param commands: list of Command objects
|
|
||||||
|
|
||||||
:returns: list of dict objects
|
|
||||||
"""
|
|
||||||
jsonify = lambda x: '%s | json' % x
|
jsonify = lambda x: '%s | json' % x
|
||||||
for item in to_list(commands):
|
for item in to_list(commands):
|
||||||
if item.output == 'json':
|
if item.output == 'json':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue