Skip to content

Remove use of swpd, removed module in py3.13 - #67788

Closed
Vaelatern wants to merge 1 commit into
saltstack:masterfrom
Vaelatern:fix-spwd
Closed

Vaelatern wants to merge 1 commit into
saltstack:masterfrom
Vaelatern:fix-spwd

Conversation

@Vaelatern

Copy link
Copy Markdown
Contributor

What does this PR do?

What issues does this PR fix or reference?

Fixes half of #67119 - I did not test for Solaris so don't have that patch.

Merge requirements satisfied?

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

Commits signed with GPG?

No but I'm willing to

@Rudd-O Rudd-O left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vdloo

vdloo commented May 10, 2025

Copy link
Copy Markdown
Contributor

I can confirm this is an issue on archlinux at the moment when using salt from the aur, which is the recommended way to install salt on archlinux according to the wiki:

----------
          ID: configure_user
    Function: user.present
        Name: root
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python3.13/site-packages/salt/state.py", line 2428, in call
                  ret = self.states[cdata["full"]](
                      *cdata["args"], **cdata["kwargs"]
                  )
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 1317, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python3.13/site-packages/salt/states/user.py", line 649, in present
                  changes = _changes(
                      name,
                  ...<30 lines>...
                      local=local,
                  )
                File "/usr/lib/python3.13/site-packages/salt/states/user.py", line 123, in _changes
                  lshad = __salt__["shadow.info"](name)
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/lib/python3.13/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/usr/lib/python3.13/site-packages/salt/modules/linux_shadow.py", line 74, in info
                  getspnam = functools.partial(spwd.getspnam)
                                               ^^^^
              NameError: name 'spwd' is not defined

A temporary fix for now until this pull request gets merged is to update the salt installation with the file from this pull request: wget -q https://raw.githubusercontent.com/saltstack/salt/8a8fc0814264364de2928aeb1207226d18b6f2f8/salt/modules/linux_shadow.py -O /usr/lib/python3.13/site-packages/salt/modules/linux_shadow.py

By the way, the fix worked for me without installing python-passlib, so not sure the passlib in the requirements/base.txt is necessary.

@twangboy twangboy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a changelog and some tests. This also needs to be rebased and conflicts addressed.

@twangboy

twangboy commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Also failing pre-commit

@twangboy

twangboy commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

What is the added passlib requirement for? I don't see it being used.

@twangboy twangboy added needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases needs-changelog test:full Run the full test suite labels Jul 2, 2025
@Vaelatern

Vaelatern commented Jul 2, 2025 •

Copy link
Copy Markdown
Contributor Author
try:
    import passlib.context

So I guess not in this PR but rather #67789

@tacerus

tacerus commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Completed this in #68402.

@twangboy

Copy link
Copy Markdown
Contributor

Closing this in favor of #68402

@twangboy twangboy closed this Oct 31, 2025

This branch was previously deployed

1 inactive deployment
ci — 8a8fc081 Deployed Mar 6, 2025 by Vaelatern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-changelog needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants