[BUG] pdbedit.list verbose=True fails when Samba has verbose logging enabled and users are present in pdb
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
pdbedit.list verbose=True fails with:
[ERROR ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'unix username'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
load_entry_point('salt==3001.1', 'console_scripts', 'salt-call')()
File "/usr/lib/python3/dist-packages/salt/scripts.py", line 445, in salt_call
client.run()
File "/usr/lib/python3/dist-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 121, in run
ret = self.call()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 228, in call
ret["return"] = self.minion.executors[fname](
File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/pdbedit.py", line 122, in list_users
users[user_data["unix username"]] = user_data
KeyError: 'unix username'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
load_entry_point('salt==3001.1', 'console_scripts', 'salt-call')()
File "/usr/lib/python3/dist-packages/salt/scripts.py", line 445, in salt_call
client.run()
File "/usr/lib/python3/dist-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 121, in run
ret = self.call()
File "/usr/lib/python3/dist-packages/salt/cli/caller.py", line 228, in call
ret["return"] = self.minion.executors[fname](
File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/pdbedit.py", line 122, in list_users
users[user_data["unix username"]] = user_data
KeyError: 'unix username'
# pdbedit --list --verbose
tdbsam_open: successfully opened /var/lib/samba/private/passdb.tdb
pdbedit module is matching lines with ':' symbol:
{'tdbsam_open': 'successfully opened /var/lib/samba/private/passdb.tdb'}
Setup
ii samba 2:4.11.6+dfsg-0ubuntu1.4 amd64 SMB/CIFS file, print, and login server for Unix
Steps to Reproduce the behavior
- Add to smb.conf the following line:
log level = passdb:4
(level 4 or anything higher will break it) - salt-call pdbedit.list verbose=True
Expected behavior
Clean exit with no users listed.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3001.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: 1.4.4
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.5 (default, Jul 28 2020, 12:59:40)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-42-lowlatency
system: Linux
version: Ubuntu 20.04 focal
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 with salt/modules/pdbedit.py, especially the list_users entry point shown in the traceback, and reproduce the failure with salt-call pdbedit.list verbose=True after enabling Samba passdb logging. Trace how verbose output lines are parsed; done means logging-only output no longer causes a KeyError and the command exits cleanly with no users listed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100