1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-04 03:07:01 +00:00

Fix linting errors; fix some real bugs (#5111)

* Fix linting errors.

* Fix bugs.

* Another linter error ignored.

* More fixes.

* Ignore sanity errors with older versions.

ci_complete

* Forgot to commit more changes.
This commit is contained in:
Felix Fontein 2022-08-12 11:07:30 +02:00 committed by GitHub
parent 0338eb7a7c
commit a54af8909c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 115 additions and 94 deletions

View file

@ -98,13 +98,13 @@ from ansible.module_utils.facts.packages import CLIMgr
class PIP(CLIMgr):
def __init__(self, pip):
def __init__(self, pip, module):
self.CLI = pip
self.module = module
def list_installed(self):
global module
rc, out, err = module.run_command([self._cli, 'list', '-l', '--format=json'])
rc, out, err = self.module.run_command([self._cli, 'list', '-l', '--format=json'])
if rc != 0:
raise Exception("Unable to list packages rc=%s : %s" % (rc, err))
return json.loads(out)
@ -117,7 +117,6 @@ class PIP(CLIMgr):
def main():
# start work
global module
module = AnsibleModule(
argument_spec=dict(
clients=dict(type='list', elements='path', default=['pip']),
@ -134,7 +133,7 @@ def main():
module.warn('Skipping invalid pip client: %s' % (pip))
continue
try:
pip_mgr = PIP(pip)
pip_mgr = PIP(pip, module)
if pip_mgr.is_available():
found += 1
packages[pip] = pip_mgr.get_packages()

View file

@ -222,7 +222,7 @@ class Yarn(object):
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
return out, err
return(None, None)
return None, None
def list(self):
cmd = ['list', '--depth=0', '--json']