1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-15 00:11:29 +00:00

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

* Fix linting errors.

* Fix bugs.

* Another linter error ignored.

* More fixes.

* Ignore sanity errors with older versions.

ci_complete

* Forgot to commit more changes.

(cherry picked from commit a54af8909c)
This commit is contained in:
Felix Fontein 2022-08-12 14:37:34 +02:00 committed by GitHub
parent 54bf6ef6de
commit e4eead189b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 115 additions and 94 deletions

View file

@ -162,7 +162,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:
@ -189,7 +189,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
@ -224,7 +224,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"]
@ -248,7 +248,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'):
@ -257,7 +257,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'):
@ -276,7 +276,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]
@ -284,7 +284,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