1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-09 05:27:17 +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

@ -163,7 +163,7 @@ OUTDATED_FLATPAK_VERSION_ERROR_MESSAGE = "Unknown option --columns=application"
def install_flat(module, binary, remote, names, method, no_dependencies):
"""Add new flatpaks."""
global result
global result # pylint: disable=global-variable-not-assigned
uri_names = []
id_names = []
for name in names:
@ -190,7 +190,7 @@ def install_flat(module, binary, remote, names, method, no_dependencies):
def uninstall_flat(module, binary, names, method):
"""Remove existing flatpaks."""
global result
global result # pylint: disable=global-variable-not-assigned
installed_flat_names = [
_match_installed_flat_name(module, binary, name, method)
for name in names
@ -225,7 +225,7 @@ def _match_installed_flat_name(module, binary, name, method):
# This is a difficult function, since if the user supplies a flatpakref url,
# we have to rely on a naming convention:
# The flatpakref file name needs to match the flatpak name
global result
global result # pylint: disable=global-variable-not-assigned
parsed_name = _parse_flatpak_name(name)
# Try running flatpak list with columns feature
command = [binary, "list", "--{0}".format(method), "--app", "--columns=application"]
@ -249,7 +249,7 @@ def _match_installed_flat_name(module, binary, name, method):
def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, method):
global result
global result # pylint: disable=global-variable-not-assigned
command = [binary, "list", "--{0}".format(method), "--app", "--columns=application"]
output = _flatpak_command(module, False, command)
for row in output.split('\n'):
@ -258,7 +258,7 @@ def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, metho
def _match_flat_using_flatpak_column_feature(module, binary, parsed_name, method):
global result
global result # pylint: disable=global-variable-not-assigned
command = [binary, "list", "--{0}".format(method), "--app"]
output = _flatpak_command(module, False, command)
for row in output.split('\n'):
@ -277,7 +277,7 @@ def _parse_flatpak_name(name):
def _flatpak_version(module, binary):
global result
global result # pylint: disable=global-variable-not-assigned
command = [binary, "--version"]
output = _flatpak_command(module, False, command)
version_number = output.split()[1]
@ -285,7 +285,7 @@ def _flatpak_version(module, binary):
def _flatpak_command(module, noop, command, ignore_failure=False):
global result
global result # pylint: disable=global-variable-not-assigned
result['command'] = ' '.join(command)
if noop:
result['rc'] = 0