Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 795198 - app-admin/ansible-lint-5.0.2: packaging.version.InvalidVersion: Invalid version: '[core'
Summary: app-admin/ansible-lint-5.0.2: packaging.version.InvalidVersion: Invalid versi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-10 09:15 UTC by Guilherme Amadio
Modified: 2021-06-10 09:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Amadio gentoo-dev 2021-06-10 09:15:23 UTC
Package installs, but seems to be broken:

$ ansible-lint --help
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.8/ansible-lint", line 33, in <module>
    sys.exit(load_entry_point('ansible-lint==5.0.2', 'console_scripts', 'ansible-lint')())
  File "/usr/lib/python-exec/python3.8/ansible-lint", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/ansiblelint/__main__.py", line 34, in <module>
    from ansiblelint import cli
  File "/usr/lib/python3.8/site-packages/ansiblelint/cli.py", line 18, in <module>
    from ansiblelint.file_utils import expand_path_vars
  File "/usr/lib/python3.8/site-packages/ansiblelint/file_utils.py", line 16, in <module>
    from ansiblelint.config import options
  File "/usr/lib/python3.8/site-packages/ansiblelint/config.py", line 108, in <module>
    if ansible_collections_path() in os.environ:
  File "/usr/lib/python3.8/site-packages/ansiblelint/config.py", line 76, in ansible_collections_path
    if ansible_version() >= ansible_version("2.10.0.dev0"):
  File "/usr/lib/python3.8/site-packages/ansiblelint/config.py", line 105, in ansible_version
    return Version(version)
  File "/usr/lib/python3.8/site-packages/packaging/version.py", line 298, in __init__
    raise InvalidVersion("Invalid version: '{0}'".format(version))
packaging.version.InvalidVersion: Invalid version: '[core'

Extra info:
$ equery l -p ansible
 * Searching for ansible ...
[-P-] [  ] app-admin/ansible-2.10.7:0
[IP-] [  ] app-admin/ansible-2.11.1:0
[-P-] [ -] app-admin/ansible-9999:0
Comment 1 Guilherme Amadio gentoo-dev 2021-06-10 09:26:56 UTC
Here's a patch that fixes the version checking:

--- a/ansiblelint/config.py	2021-02-21 16:45:37.000000000 +0100
+++ b/ansiblelint/config.py	2021-06-10 11:24:41.062360346 +0200
@@ -87,20 +87,10 @@
     to Version object in order to make it usable in comparisons.
     """
     if not version:
-        proc = subprocess.run(
-            ["ansible", "--version"],
-            universal_newlines=True,
-            check=False,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
-        )
-        if proc.returncode == 0:
-            version = proc.stdout.splitlines()[0].split()[1]
-        else:
-            print(
-                "Unable to find a working copy of ansible executable.",
-                proc,
-            )
+        try:
+            from ansible.release import __version__ as version
+        except:
+            print("Unable to find ansible")
             sys.exit(ANSIBLE_MISSING_RC)
     return Version(version)
Comment 2 Guilherme Amadio gentoo-dev 2021-06-10 09:28:07 UTC
Well, that only fixes part of it, it still fails after that with:

FATAL: Ansible CLI ([core) and python module (2.11.1) versions do not match. This indicates a broken execution environment.

So there are more places where this needs fixing, I guess.
Comment 3 Guilherme Amadio gentoo-dev 2021-06-10 09:56:39 UTC
A version bump fixed this, but I made a mistake when copying the bug number, so adding the comment here again by hand:

The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74c26305143a9b11ff87311a038b6db39dcb46e8

commit 74c26305143a9b11ff87311a038b6db39dcb46e8
Author:     Guilherme Amadio <amadio@gentoo.org>
AuthorDate: 2021-06-10 09:50:25 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-06-10 09:50:25 +0000

    app-admin/ansible-lint: version bump
    
    Closes: https://bugs.gentoo.org/795189
    Package-Manager: Portage-3.0.19, Repoman-3.0.3
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 app-admin/ansible-lint/Manifest                   |  1 +
 app-admin/ansible-lint/ansible-lint-5.0.12.ebuild | 38 +++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dab281e88ea62652004c7c85cc0080be04374b34

commit dab281e88ea62652004c7c85cc0080be04374b34
Author:     Guilherme Amadio <amadio@gentoo.org>
AuthorDate: 2021-06-10 09:52:00 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-06-10 09:52:00 +0000

    app-admin/ansible-lint: drop old
    
    Does not work with latest ansible from the tree.
    
    Bug: https://bugs.gentoo.org/795189
    Package-Manager: Portage-3.0.19, Repoman-3.0.3
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 app-admin/ansible-lint/Manifest                  |  1 -
 app-admin/ansible-lint/ansible-lint-5.0.2.ebuild | 37 ------------------------
 2 files changed, 38 deletions(-)