-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Revert back to having a default shell #68448
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
base: 3006.x
Are you sure you want to change the base?
Conversation
| from salt.utils.win_functions import shlex_split | ||
| from salt.utils.win_runas import runas as win_runas | ||
|
|
||
| HAS_WIN_RUNAS = True | ||
| else: | ||
| import shlex | ||
|
|
||
| _cmd_quote = shlex.quote |
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.
Maybe do the same thing for split as was done for _cmd_quote to avoid having to check salt.utils.platform.is_windows on every usage of shlex.split.
| @pytest.mark.skip_on_freebsd | ||
| def test_shell_enabled(self): | ||
| def test_shell_disabled(self): | ||
| """ | ||
| test shell enabled output for cmd.run | ||
| test shell disabled output for cmd.run | ||
| """ | ||
| enabled_ret = "3\nsaltines" # the result of running self.cmd in a shell | ||
| ret = self.run_function("cmd.run", [self.cmd], python_shell=True) | ||
| self.assertEqual(ret.strip(), enabled_ret) |
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.
Seems like it would be good to also have test_shell_enabled test in addition to test_shell_disabled instead of replacing it with test_shell_disabled
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.
The original test was for disabled... I can add a test for enabled as well
| @pytest.mark.skip_on_windows(reason="Skip on Windows OS") | ||
| @pytest.mark.skip_on_freebsd | ||
| def test_shell_enabled(self): | ||
| def test_shell_disabled(self): |
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.
Would good be good to have a test for windows to ensure the expected behavior occurs when python_shell=False is passed on windows.
|
Is this a fix to #68298 ? If yes, thanks, as this regression has broken some code of mine. |
| elif __opts__.get("cmd_safe", True) is False and python_shell is None: | ||
| # Override-switch for python_shell | ||
| return True |
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.
Are there any tests for cmd_safe? I did a quick search and did not notice any.
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.
There were none before it was removed in #68156
140dcca to
7c54899
Compare
What does this PR do?
Reverts part of #68156 that changed the default behavior for
python_shellandshell. Also fixes a bug in the PR mentioned above, where you couldn't pass non-list parameters to a script.What issues does this PR fix or reference?
Fixes #68156
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes