1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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 d019e22e7d)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-06-06 10:30:15 +02:00 committed by GitHub
parent 6a51ba5169
commit 69c79f618e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ansible_galaxy_install - minor refactoring using latest ``ModuleHelper`` updates (https://github.com/ansible-collections/community.general/pull/4752).

View file

@ -226,7 +226,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
check_rc = True check_rc = True
def _get_ansible_galaxy_version(self): 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) dummy, out, dummy = self.module.run_command([ansible_galaxy, "--version"], check_rc=True)
line = out.splitlines()[0] line = out.splitlines()[0]
match = self._RE_GALAXY_VERSION.match(line) match = self._RE_GALAXY_VERSION.match(line)
@ -302,9 +302,9 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
self.vars.set("new_roles", {}) self.vars.set("new_roles", {})
self.vars.set("ansible29_change", False, change=True, output=False) self.vars.set("ansible29_change", False, change=True, output=False)
if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211): 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': 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): def _setup210plus(self):
self.vars.set("new_collections", {}, change=True) self.vars.set("new_collections", {}, change=True)