roll up of eos fixes (#21629)

* fixes error where eos would close the cli shell
* fixes network_cli connection plugin to check before calling open_shell()
* fixes json commands being sent over eapi
This commit is contained in:
Peter Sprygada 2017-02-19 08:46:14 -05:00 committed by GitHub
commit d5f7a0181b
4 changed files with 23 additions and 19 deletions

View file

@ -64,7 +64,7 @@ eos_argument_spec = {
def check_args(module, warnings):
provider = module.params['provider'] or {}
for key in eos_argument_spec:
if key != ['provider', 'transport'] and module.params[key]:
if key not in ['provider', 'transport'] and module.params[key]:
warnings.append('argument %s has been deprecated and will be '
'removed in a future version' % key)
@ -157,6 +157,7 @@ class Cli:
def send_config(self, commands):
multiline = False
rc = 0
for command in to_list(commands):
if command == 'end':
pass
@ -170,8 +171,8 @@ class Cli:
rc, out, err = self.exec_command(command)
if rc != 0:
return (rc, out, err)
return (rc, 'ok','')
return (rc, 'ok','')
def configure(self, commands):
"""Sends configuration commands to the remote device
@ -322,13 +323,11 @@ class Eapi:
return response['result']
for item in to_list(commands):
if item['output'] == 'json' and not is_json(item['command']):
item['command'] = '%s | json' % item['command']
if is_json(item['command']):
item['command'] = str(item['command']).replace('| json', '')
item['output'] == 'json'
if item['output'] == 'text' and is_json(item['command']):
item['command'] = str(item['command']).split('|')[0]
if all((output == 'json', is_text(item['command']))) or all((output =='text', is_json(item['command']))):
if output != item['output']:
responses.extend(_send(queue, output))
queue = list()