From 9eb638f651df8ba00f4e4cfa39ef4857876ee733 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Tue, 2 Nov 2021 01:53:02 +1300 Subject: [PATCH] fix modules' output by using publish_cmd (#3655) * fix modules' output by using publish_cmd * added changelog frag * Update changelogs/fragments/3655-use-publish_cmd.yaml Co-authored-by: Felix Fontein * Update changelogs/fragments/3655-use-publish_cmd.yaml Co-authored-by: Felix Fontein * Update changelogs/fragments/3655-use-publish_cmd.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/3655-use-publish_cmd.yaml | 4 ++++ plugins/modules/packaging/language/ansible_galaxy_install.py | 2 +- plugins/modules/packaging/language/pipx.py | 2 +- plugins/modules/packaging/os/snap_alias.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/3655-use-publish_cmd.yaml diff --git a/changelogs/fragments/3655-use-publish_cmd.yaml b/changelogs/fragments/3655-use-publish_cmd.yaml new file mode 100644 index 0000000000..6b20efcf33 --- /dev/null +++ b/changelogs/fragments/3655-use-publish_cmd.yaml @@ -0,0 +1,4 @@ +bugfixes: + - ansible_galaxy_install - the output value ``cmd_args`` was bringing the intermediate command used to gather the state, instead of the command that actually performed the state change (https://github.com/ansible-collections/community.general/pull/3655). + - pipx - the output value ``cmd_args`` was bringing the intermediate command used to gather the state, instead of the command that actually performed the state change (https://github.com/ansible-collections/community.general/pull/3655). + - snap_alias - the output value ``cmd_args`` was bringing the intermediate command used to gather the state, instead of the command that actually performed the state change (https://github.com/ansible-collections/community.general/pull/3655). diff --git a/plugins/modules/packaging/language/ansible_galaxy_install.py b/plugins/modules/packaging/language/ansible_galaxy_install.py index 9e9b5cc4f6..8efa9d842b 100644 --- a/plugins/modules/packaging/language/ansible_galaxy_install.py +++ b/plugins/modules/packaging/language/ansible_galaxy_install.py @@ -238,7 +238,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): def _list_element(self, _type, path_re, elem_re): params = ({'type': _type}, {'galaxy_cmd': 'list'}, 'dest') elems = self.run_command(params=params, - publish_rc=False, publish_out=False, publish_err=False, + publish_rc=False, publish_out=False, publish_err=False, publish_cmd=False, process_output=self._process_output_list, check_rc=False) elems_dict = {} diff --git a/plugins/modules/packaging/language/pipx.py b/plugins/modules/packaging/language/pipx.py index 5458941eec..f771cf6025 100644 --- a/plugins/modules/packaging/language/pipx.py +++ b/plugins/modules/packaging/language/pipx.py @@ -197,7 +197,7 @@ class PipX(CmdStateModuleHelper): return results installed = self.run_command(params=[{'_list': True}], process_output=process_list, - publish_rc=False, publish_out=False, publish_err=False) + publish_rc=False, publish_out=False, publish_err=False, publish_cmd=False) if self.vars.name is not None: app_list = installed.get(self.vars.name) diff --git a/plugins/modules/packaging/os/snap_alias.py b/plugins/modules/packaging/os/snap_alias.py index e9bd610725..036be12004 100644 --- a/plugins/modules/packaging/os/snap_alias.py +++ b/plugins/modules/packaging/os/snap_alias.py @@ -134,7 +134,7 @@ class SnapAlias(CmdStateModuleHelper): return results return self.run_command(params=[{'state': 'info'}, 'name'], check_rc=True, - publish_rc=False, publish_out=False, publish_err=False, + publish_rc=False, publish_out=False, publish_err=False, publish_cmd=False, process_output=process_get_aliases) def _get_aliases_for(self, name):