FS#73020 - [salt 3004-3] AttributeError: 'PathDistribution' object has no attribute '_normalized_name'

Attached to Project: Community Packages
Opened by Imran Iqbal (myii) - Tuesday, 14 December 2021, 15:04 GMT
Last edited by Morten Linderud (Foxboron) - Sunday, 19 December 2021, 18:36 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Johannes Löthberg (demize)
Morten Linderud (Foxboron)
Architecture All
Severity Critical
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Setting the severity as critical since no `salt` commands can be run.

With the update to Python 3.10, this bug is being hit, when running any `salt` command:

```
# salt -V
Traceback (most recent call last):
File "/usr/sbin/salt", line 33, in <module>
sys.exit(load_entry_point('salt==3004', 'console_scripts', 'salt')())
File "/usr/lib/python3.10/site-packages/salt/scripts.py", line 521, in salt_main
client.run()
File "/usr/lib/python3.10/site-packages/salt/cli/salt.py", line 35, in run
self.parse_args()
File "/usr/lib/python3.10/site-packages/salt/utils/parsers.py", line 177, in parse_args
self.print_versions_report()
File "/usr/lib/python3.10/site-packages/salt/utils/parsers.py", line 246, in print_versions_report
print("\n".join(version.versions_report()), file=file, flush=True)
File "/usr/lib/python3.10/site-packages/salt/version.py", line 874, in versions_report
ver_info = versions_information(
File "/usr/lib/python3.10/site-packages/salt/version.py", line 864, in versions_information
extensions_info = extensions_information()
File "/usr/lib/python3.10/site-packages/salt/version.py", line 840, in extensions_information
for entry_point in salt.utils.entrypoints.iter_entry_points("salt.loader"):
File "/usr/lib/python3.10/site-packages/salt/utils/entrypoints.py", line 43, in _wrapped
return f(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/salt/utils/entrypoints.py", line 55, in iter_entry_points
entry_points = importlib.metadata.entry_points()
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 971, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 429, in load
ordered = sorted(eps, key=by_group)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 968, in <genexpr>
eps = itertools.chain.from_iterable(
File "/usr/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
```

This has already been reported and fixed upstream:

* https://github.com/saltstack/salt/issues/61062
* https://github.com/saltstack/salt/pull/61064
- Applying this fix resolves the problem.

Steps to reproduce:

* Run the `archlinux/archlinux:latest` Docker container.
* Install `salt`.
* Run any `salt` command, such as `salt -V`.
This task depends upon

Closed by  Morten Linderud (Foxboron)
Sunday, 19 December 2021, 18:36 GMT
Reason for closing:  Fixed
Additional comments about closing:  3004-4
Comment by Imran Iqbal (myii) - Tuesday, 14 December 2021, 15:11 GMT
This is a duplicate of #73019 (by a few minutes). The upstream bug and proposed fix is mentioned above, though.
Comment by Morten Linderud (Foxboron) - Tuesday, 14 December 2021, 15:18 GMT
Closed by accident :p Lets keep this one
Comment by Tomasz Juszkiewicz (tjuszki) - Thursday, 16 December 2021, 16:04 GMT
As a workaround, installing 'python-importlib-metadata' package fixed the issue for me.
Comment by Doc Bone (dr-bone) - Thursday, 16 December 2021, 19:09 GMT
I can confirm the workaround works. (tested on master and minion)
thanks!

Loading...