From 69c79f618e9dc90fd58c2fd3ceb5ccc863042b5f Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 10:30:15 +0200 Subject: [PATCH] ansible_galaxy_install: minor improvements based on MH updates (#4752) (#4774) * ansible_galaxy_install: minor improvements based on MH updates * added changelog fragment (cherry picked from commit d019e22e7db36815595a389497003120cdf79efe) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- .../fragments/4752-ansible-galaxy-install-mh-updates.yml | 2 ++ .../modules/packaging/language/ansible_galaxy_install.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/4752-ansible-galaxy-install-mh-updates.yml diff --git a/changelogs/fragments/4752-ansible-galaxy-install-mh-updates.yml b/changelogs/fragments/4752-ansible-galaxy-install-mh-updates.yml new file mode 100644 index 0000000000..b93d885ed4 --- /dev/null +++ b/changelogs/fragments/4752-ansible-galaxy-install-mh-updates.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates (https://github.com/ansible-collections/community.general/pull/4752). diff --git a/plugins/modules/packaging/language/ansible_galaxy_install.py b/plugins/modules/packaging/language/ansible_galaxy_install.py index 968a8d093d..7b7ac160da 100644 --- a/plugins/modules/packaging/language/ansible_galaxy_install.py +++ b/plugins/modules/packaging/language/ansible_galaxy_install.py @@ -226,7 +226,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper): check_rc = True def _get_ansible_galaxy_version(self): - ansible_galaxy = self.module.get_bin_path("ansible-galaxy", required=True) + ansible_galaxy = self.get_bin_path("ansible-galaxy", required=True) dummy, out, dummy = self.module.run_command([ansible_galaxy, "--version"], check_rc=True) line = out.splitlines()[0] match = self._RE_GALAXY_VERSION.match(line) @@ -302,9 +302,9 @@ class AnsibleGalaxyInstall(CmdModuleHelper): self.vars.set("new_roles", {}) self.vars.set("ansible29_change", False, change=True, output=False) if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211): - self.module.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed") + self.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed") if self.vars.requirements_file is not None and self.vars.type == 'both': - self.module.warn("Ansible 2.9 or older: will install only roles from requirement files") + self.warn("Ansible 2.9 or older: will install only roles from requirement files") def _setup210plus(self): self.vars.set("new_collections", {}, change=True)