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

Ensure the correct crypt is loaded. #67797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vzhestkov
Copy link
Contributor

@vzhestkov vzhestkov commented Mar 7, 2025

What does this PR do?

This change is intended to avoid an issue on loading crypt module which is removed in Python 3.13, but LazyLoader can load salt.utils.crypt instead of it.

What issues does this PR fix or reference?

Tracks: https://github.com/SUSE/spacewalk/issues/26467

Previous Behavior

In case if there is no crypt module shipped with Python, LazyLoader can accidentally load salt.utils.crypt instead and cause exceptions like the following:

  File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1120, in load_module
  File "<frozen importlib._bootstrap_external>", line 945, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File ".../python3.11/site-packages/salt/modules/bsd_shadow.py", line 22, in <module>
    import salt.utils.pycrypto
  File ".../python3.11/site-packages/salt/utils/pycrypto.py", line 106, in <module>
    methods = {m.name.lower(): m for m in crypt.methods}

New Behavior

Normally fallsback to using passlib instead of crypt.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes/No

@vzhestkov vzhestkov requested a review from a team as a code owner March 7, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant