Vyos config fixes (#21862)

* Fix vyos signatures to match new versions

* Fix test cases referring to 'updates' instead of 'commands'

* I think this is an artifact of `connection: network_cli`?
This commit is contained in:
Nathaniel Case 2017-02-25 21:14:40 -05:00 committed by Peter Sprygada
parent ca21d09483
commit 9b9ed59d98
6 changed files with 5 additions and 29 deletions

View file

@ -78,7 +78,7 @@ def load_config(module, commands, commit=False, comment=None):
module.fail_json(msg='unable to enter configuration mode', output=err)
for cmd in to_list(commands):
rc, out, err = exec_command(module, cmd, check_rc=False)
rc, out, err = exec_command(module, cmd)
if rc != 0:
# discard any changes in case of failure
exec_command(module, 'exit discard')

View file

@ -221,10 +221,9 @@ def run(module, result):
commit = not module.check_mode
comment = module.params['comment']
save = module.params['save']
if commands:
load_config(module, commands, commit=commit, comment=comment, save=save)
load_config(module, commands, commit=commit, comment=comment)
if result.get('filtered'):
result['warnings'].append('Some configuration commands were '

View file

@ -40,7 +40,6 @@ except ImportError:
class ActionModule(_ActionModule):
def run(self, tmp=None, task_vars=None):
if self._play_context.connection != 'local':
return dict(
failed=True,
@ -114,6 +113,3 @@ class ActionModule(_ActionModule):
return strategy(*args, **kwargs)
except AnsibleFallbackNotFound:
pass

View file

@ -43,10 +43,7 @@ class ActionModule(_ActionModule):
except ValueError as exc:
return dict(failed=True, msg=exc.message)
if self._play_context.connection == 'local':
result = self.normal(tmp, task_vars)
else:
result = super(ActionModule, self).run(tmp, task_vars)
result = super(ActionModule, self).run(tmp, task_vars)
if self._task.args.get('backup') and result.get('__backup__'):
# User requested backup and no error occurred in module.
@ -64,22 +61,6 @@ class ActionModule(_ActionModule):
return result
def normal(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
#results = super(ActionModule, self).run(tmp, task_vars)
# remove as modules might hide due to nolog
#del results['invocation']['module_args']
results = {}
results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))
# hack to keep --verbose from showing all the setup module results
if self._task.action == 'setup':
results['_ansible_verbose_override'] = True
return results
def _get_working_path(self):
cwd = self._loader.get_basedir()
if self._task._role is not None:

View file

@ -17,7 +17,7 @@
- assert:
that:
- "result.changed == true"
- "'set system host-name foo' in result.updates"
- "'set system host-name foo' in result.commands"
- name: collect system commits
vyos_command:

View file

@ -16,7 +16,7 @@
- assert:
that:
- "result.changed == true"
- "'set system host-name foo' in result.updates"
- "'set system host-name foo' in result.commands"
- name: check simple config command idempontent
vyos_config: