python3/plugins/test_extauth_hook_AD.py: Fix logging in run_cmd()
#5812
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @psafont,
For logging the output of
/usr/bin/systemctl reload-or-restart sshdinpython3/plugins/extauth-hook-AD.py,mypyfound a minor regression:universal_newlines=Truethere to fix the formatting of the logged output.How this could be found:
mypyis good at spotting changes instr/bytesfrom moving to Python3mypywasn't fully usable yet, the config was not yet updated forpython3/*.python3/*having made good process, I fixed the config for it.In Python3,
subprocess.check_output(command)returnsbytesby default (unless it is switched to text mode).strby default.subprocess.check_output(command, universal_newlines=True)The
run_cmdfunction inpython3/plugins/extauth-hook-AD.pyhas only one call:Therefore, the unused default argument and returning the output can be removed (both are not used):
Commit 1:
python3/plugins/test_extauth_hook_AD.py:Commit 2:
python3/plugins/extauth-hook-AD.py: Fix logging inrun_cmd()log_cmd=True(cmd is always logged - only one call site)