[BUG] Deleting Users and Groups under FreeBSD broken since 3007
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Deleting users and groups via user.absent / group.absent is not working anymore under FreeBSD with Salt 3007.
Setup
I'm running FreeBSD 13.4 with Salt 3007.1.
Since 3007, there was added a new local argument to the absent methods:
https://github.com/saltstack/salt/blob/029b96c9969e91b71be6f58aeea4da6ef0137915/salt/states/group.py#L312-L325
This argument is then passed to the pw_groups Module's delete() method:
https://github.com/saltstack/salt/blob/029b96c9969e91b71be6f58aeea4da6ef0137915/salt/modules/pw_group.py#L74
But the argument is not defined there. This leads to the error:
my-minion:
----------
ID: group_delete_test
Function: group.absent
Name: groupname
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/salt/state.py", line 2428, in call
ret = self.states[cdata["full"]](
File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 160, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.9/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/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 1284, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 1317, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/salt/states/group.py", line 347, in absent
ret["result"] = __salt__["group.delete"](name, **del_args)
File "/usr/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 160, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.9/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/local/lib/python3.9/site-packages/salt/loader/lazy.py", line 1284, in _run_as
return _func_or_method(*args, **kwargs)
TypeError: delete() got an unexpected keyword argument 'local'
Started: 11:38:16.462864
Duration: 16.677 ms
Changes:
Steps to Reproduce the behavior
group_delete_test:
group.absent:
- name: groupname
Expected behavior
Add local argument handling
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3007.1
Python Version:
Python: 3.9.21 (main, Jan 2 2025, 07:29:25)
Dependency Versions:
cffi: 1.17.1
cherrypy: unknown
dateutil: 2.9.0
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.1.0
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.2
pycparser: 2.22
pycrypto: 3.21.0
pycryptodome: 3.21.0
pygit2: Not Installed
python-gnupg: 0.5.1
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: Not Installed
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.4
ZMQ: 4.3.5
Salt Package Information:
Package Type: Not Installed
System Versions:
dist: freebsd 13.4
locale: utf-8
machine: amd64
release: 13.4-RELEASE-p2
system: FreeBSD
version: FreeBSD 13.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/states/group.py where group.absent passes arguments to group.delete, then inspect salt/modules/pw_group.py where delete() is defined. Reproduce the group.absent example on FreeBSD and verify that deleting users and groups no longer raises the unexpected local keyword argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100