mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix two regressions in flatpak and flatpak_remote modules (#49651)
* Fix python 3 compatibility in flatpak_remote module * Fix flatpak module for recent versions of flatpak * Add reminder for contributors to run integration tests manually There has been several Python version compatibility regressions introduced into the module which could have been avoided by the integration tests.
This commit is contained in:
parent
ed248a6a86
commit
27fd8e4dc6
2 changed files with 44 additions and 2 deletions
|
@ -6,6 +6,27 @@
|
|||
# Copyright: (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# ATTENTION CONTRIBUTORS!
|
||||
#
|
||||
# TL;DR: Run this module's integration tests manually before opening a pull request
|
||||
#
|
||||
# Long explanation:
|
||||
# The integration tests for this module are currently NOT run on the Ansible project's continuous
|
||||
# delivery pipeline. So please: When you make changes to this module, make sure that you run the
|
||||
# included integration tests manually for both Python 2 and Python 3:
|
||||
#
|
||||
# Python 2:
|
||||
# ansible-test integration -v --docker fedora28 --docker-privileged --allow-unsupported --python 2.7 flatpak
|
||||
# Python 3:
|
||||
# ansible-test integration -v --docker fedora28 --docker-privileged --allow-unsupported --python 3.6 flatpak
|
||||
#
|
||||
# Because of external dependencies, the current integration tests are somewhat too slow and brittle
|
||||
# to be included right now. I have plans to rewrite the integration tests based on a local flatpak
|
||||
# repository so that they can be included into the normal CI pipeline.
|
||||
# //oolongbrothers
|
||||
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -145,7 +166,7 @@ def uninstall_flat(module, binary, name, method):
|
|||
"""Remove an existing flatpak."""
|
||||
global result
|
||||
installed_flat_name = _match_installed_flat_name(module, binary, name, method)
|
||||
command = "{0} uninstall --{1} {2}".format(binary, method, installed_flat_name)
|
||||
command = "{0} uninstall -y --{1} {2}".format(binary, method, installed_flat_name)
|
||||
_flatpak_command(module, module.check_mode, command)
|
||||
result['changed'] = True
|
||||
|
||||
|
|
|
@ -6,6 +6,27 @@
|
|||
# Copyright: (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# ATTENTION CONTRIBUTORS!
|
||||
#
|
||||
# TL;DR: Run this module's integration tests manually before opening a pull request
|
||||
#
|
||||
# Long explanation:
|
||||
# The integration tests for this module are currently NOT run on the Ansible project's continuous
|
||||
# delivery pipeline. So please: When you make changes to this module, make sure that you run the
|
||||
# included integration tests manually for both Python 2 and Python 3:
|
||||
#
|
||||
# Python 2:
|
||||
# ansible-test integration -v --docker fedora28 --docker-privileged --allow-unsupported --python 2.7 flatpak_remote
|
||||
# Python 3:
|
||||
# ansible-test integration -v --docker fedora28 --docker-privileged --allow-unsupported --python 3.6 flatpak_remote
|
||||
#
|
||||
# Because of external dependencies, the current integration tests are somewhat too slow and brittle
|
||||
# to be included right now. I have plans to rewrite the integration tests based on a local flatpak
|
||||
# repository so that they can be included into the normal CI pipeline.
|
||||
# //oolongbrothers
|
||||
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -148,7 +169,7 @@ def remote_exists(module, binary, name, method):
|
|||
output = _flatpak_command(module, False, command)
|
||||
for line in output.splitlines():
|
||||
listed_remote = line.split()
|
||||
if listed_remote[0] == name:
|
||||
if listed_remote[0] == to_native(name):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in a new issue