diff --git a/lib/ansible/module_utils/vyos.py b/lib/ansible/module_utils/vyos.py index 143871e17ef..f60b5486740 100644 --- a/lib/ansible/module_utils/vyos.py +++ b/lib/ansible/module_utils/vyos.py @@ -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') diff --git a/lib/ansible/modules/network/vyos/vyos_config.py b/lib/ansible/modules/network/vyos/vyos_config.py index 95d1073726f..514bde1d378 100644 --- a/lib/ansible/modules/network/vyos/vyos_config.py +++ b/lib/ansible/modules/network/vyos/vyos_config.py @@ -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 ' diff --git a/lib/ansible/plugins/action/vyos.py b/lib/ansible/plugins/action/vyos.py index 86e476a026d..76072b7f03b 100644 --- a/lib/ansible/plugins/action/vyos.py +++ b/lib/ansible/plugins/action/vyos.py @@ -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 - - - diff --git a/lib/ansible/plugins/action/vyos_config.py b/lib/ansible/plugins/action/vyos_config.py index 65df2212563..f8e06862249 100644 --- a/lib/ansible/plugins/action/vyos_config.py +++ b/lib/ansible/plugins/action/vyos_config.py @@ -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: diff --git a/test/integration/targets/vyos_config/tests/cli/comment.yaml b/test/integration/targets/vyos_config/tests/cli/comment.yaml index 56746aab833..89a320ed4d0 100644 --- a/test/integration/targets/vyos_config/tests/cli/comment.yaml +++ b/test/integration/targets/vyos_config/tests/cli/comment.yaml @@ -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: diff --git a/test/integration/targets/vyos_config/tests/cli/simple.yaml b/test/integration/targets/vyos_config/tests/cli/simple.yaml index 70aea105f04..33017f48234 100644 --- a/test/integration/targets/vyos_config/tests/cli/simple.yaml +++ b/test/integration/targets/vyos_config/tests/cli/simple.yaml @@ -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: