cmdmod: New group option for command execution & MacOS shell arg fix#43901
Conversation
|
Indecisive on the issue name. 😄 Here are some test runs on my local dev box: This command should fail on other shells that are not fishy enough. 😉 Bash wasn't fishy enough. If the This shows a few more runs mixing Files created whilst running under a different group inherit the group ownership, which can be particularly useful in some situations. This demonstrates the new |
|
Is that my bad? It's not obvious to me what the problem is (if it's something I did). |
|
re-run py3 |
|
@boltronics I'm not sure, so I've restarted the py3 test to see if we get the same result. Offhand, it looks to me like the sub_minion test daemon didn't start, so let's see how the second run goes. :) |
|
There was a small merge conflict that I fixed by hand. |
thatch45
left a comment
There was a problem hiding this comment.
looks good, did not miss any of the entry points and covers multi OS issues correctly. Nicely done @boltronics
|
Thanks all. I note this PR has a conflict at this point. Looks trivial to fix though since it's just a matter of relocating the changes in Normally I would just rebase against develop and force-push, but since everything has been approved at this point, I don't want to invalidate that. 😄 So should someone else be making that adjustment? |
|
To clarify, I'm happy to make the changes myself if preferred. Whatever works. Please let me know how you wish to proceed. |
|
Hi @boltronics - If you could handle the rebasing, that would be great. If you have any questions, please let us know. Thank you! |
terminalmage
left a comment
There was a problem hiding this comment.
Needs a rebase and a few changes.
There was a problem hiding this comment.
Please import this as a private function (i.e. from distutils.spawn import find_executable as _find_executable). Importing a function into the global namespace of the module will both a) cause it to be picked up by the loader (and thus end up in the __salt__ dunder dictionary), and b) add it to the docs when they are built using Sphinx.
There was a problem hiding this comment.
Is there a reason we shouldn't just use salt.utils.path.which_bin?
There was a problem hiding this comment.
Thanks for the tip. I hadn't noticed it.
There was a problem hiding this comment.
As with the comment on the import above, let's make sure this is a private function (i.e. _find_executable).
There was a problem hiding this comment.
Good catch! But I'll try to switch this over to which_bin since that's already imported.
There was a problem hiding this comment.
It looks like these functions were added separately in a different PR and already exist in develop. However, they have been moved to salt/utils/user.py. Please check the functions you are adding here against their counterparts in that file and make any changes there. We should not be adding new functions to salt/utils/__init__.py.
There was a problem hiding this comment.
Actually, they already existed when I originally submitted the PR but have since been moved. That was the original reason for needing to rebase after the initial approval, so will be sure to fix that up.
|
@boltronics I asked @terminalmage to swing past here again today but we also do need a rebase here, please. There are a couple of merge conflicts. Thanks. |
|
@boltronics I'll re-review once you get that rebase in. I do like the idea of using |
|
Hi @boltronics - Any chance you were able to come back to this? |
0b99ae2 to
a78b082
Compare
|
@rallytime @terminalmage I think that's sorted now. Sorry it took so long. |
terminalmage
left a comment
There was a problem hiding this comment.
There's one minor thing here but it's not important enough to stand in the way of merging.
There was a problem hiding this comment.
The u is unnecessary here since we're going to be using unicode_literals.
There was a problem hiding this comment.
I should have noticed it wasn't in the original string (or rather, not the one there after rebasing). Sorry I didn't pick up on that. Fixed it anyway.
a78b082 to
f867eff
Compare
This has the side effect of having cmdmod support a custom shell on MacOS.
f867eff to
c574bff
Compare
|
re-run py |
What does this PR do?
Adds the
groupargument to various functions incmdmodfor non-Windows hosts. Also enables theshelloption on OS X, which looked to have been silently ignored previously (although I don't have a Mac to test with).What issues does this PR fix or reference?
#43900
Previous Behavior
The
groupoption did not exist. Theshelloption was ignored on OS X.New Behavior
The
groupoption exists. Theshelloption should be honoured on OS X.Tests written?
No
Please review Salt's Contributing Guide for best practices.