Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'collections' has no attribute 'Hashable' #77927

Closed
1 task done
M41doror opened this issue May 28, 2022 · 3 comments · Fixed by #77936
Closed
1 task done

AttributeError: module 'collections' has no attribute 'Hashable' #77927

M41doror opened this issue May 28, 2022 · 3 comments · Fixed by #77936
Labels
affects_2.14 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.

Comments

@M41doror
Copy link

M41doror commented May 28, 2022

Summary

It seems an upgrade broke my ansible configuration on Fedora 36 not much to say any commands is followed by the output past down in the issue.
I have seen this error, but for another package "Spades", don't know what it is, don't have installed on my machine :

Kernel: 5.17.7-300.fc36.x86_64

Best regards.

Issue Type

Bug Report

Component Name

dnf

Ansible Version

$ ansible rpm -qa | grep ansible

ansible-core-2.12.5-1.fc36.noarch
ansible-5.8.0-1.fc36.noarch

Configuration

$ ansible-config dump --only-changed -t all

Traceback (most recent call last):
  File "/usr/bin/ansible-config", line 65, in <module>
    import ansible.constants as C
  File "/usr/lib/python3.10/site-packages/ansible/constants.py", line 180, in <module>
    config = ConfigManager()
  File "/usr/lib/python3.10/site-packages/ansible/config/manager.py", line 291, in __init__
    self._base_defs = self._read_config_yaml_file(defs_file or ('%s/base.yml' % os.path.dirname(__file__)))
  File "/usr/lib/python3.10/site-packages/ansible/config/manager.py", line 312, in _read_config_yaml_file
    return yaml_load(config_def) or {}
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 37, in get_single_data
    return self.construct_document(node)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 46, in construct_document
    for dummy in generator:
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 204, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

OS / Environment

OS: Fedora release 36 (Thirty Six) x86_64

Steps to Reproduce

Expected Results

Any ansible commands return the same output bellow.

Actual Results

Traceback (most recent call last):
  File "/usr/bin/ansible-config", line 65, in <module>
    import ansible.constants as C
  File "/usr/lib/python3.10/site-packages/ansible/constants.py", line 180, in <module>
    config = ConfigManager()
  File "/usr/lib/python3.10/site-packages/ansible/config/manager.py", line 291, in __init__
    self._base_defs = self._read_config_yaml_file(defs_file or ('%s/base.yml' % os.path.dirname(__file__)))
  File "/usr/lib/python3.10/site-packages/ansible/config/manager.py", line 312, in _read_config_yaml_file
    return yaml_load(config_def) or {}
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 37, in get_single_data
    return self.construct_document(node)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 46, in construct_document
    for dummy in generator:
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 204, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/paco.garcia/.local/lib/python3.10/site-packages/yaml/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented May 28, 2022

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.14 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels May 28, 2022
@s-hertel
Copy link
Contributor

I'm able to reproduce this using PyYAML older than 5.1b3 with Python 3.8+. It looks like it was fixed in yaml/pyyaml@9959328.

@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 31, 2022
@mkrizek
Copy link
Contributor

mkrizek commented May 31, 2022

Possible fix would be to add a version requirement to requirements.txt for ansible-core.

@ansibot ansibot added the has_pr This issue has an associated PR. label May 31, 2022
@ansible ansible locked and limited conversation to collaborators Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.14 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants