-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix useradd hard-coded relative command names #62088
Fix useradd hard-coded relative command names #62088
Conversation
Hey Nick, Nice pr, looks like the tests will need to be skipped on a couple of operating systems. |
hmmm... looks like it's failing the old style tests because the |
Hey @nicholasmhughes so, my two cents on the mocking of which. I would rather know these fail on some operating systems that don't have useradd and the like. and have the tests account for that change. then to mock which and have it "work" when the module wouldn't actually work on an operating system. but that is just my two cents. @waynew what do you think? |
re-run pr-opensuse-15-x86_64-py3-pytest |
re-run pr-fedora-34-x86_64-py3-pytest |
re-run pr-centos-7-x86_64-py3-tcp-pytest |
@whytewolf when it comes to a unit test, mocking is preferable, but it wouldn't hurt at all to have a functional test that fails on Windows or other systems without useradd. Could do something like:
It might be worthwhile adding another test for successful platforms, but I think we actually do have some of those already? 🤔 |
re-run full all |
Woops totally didn't notice they were unit thought they were functional for some reason. You're right. unit should be mocked. the new test looks to cover my concern so approving. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 You rock!
re-run pr-arch-lts-x86_64-py3-pytest |
What does this PR do?
This PR adds support for searching for
useradd
,usermod
, anduserdel
binaries using thesalt.utils.path.which
function instead of solely relying on thePATH
environment variable to find them.What issues does this PR fix or reference?
Fixes: #62087
Previous Behavior
Binaries would not be found if some "sbin" locations were not in the
PATH
, despite being installed.New Behavior
The
salt.utils.path.which
function adds some standard paths into the search locations, so the binaries will still be found if in a "standard" location like/sbin/
even if that directory isn't in thePATH
.Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.