-
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
cwd option not working with cmd.run and runas #51008
Comments
Maybe a possible solution is the following change: Line 416 in 774ab94
by: cmd = 'su -l {0} -c "cd {1}; {2}"'.format(runas, cwd, cmd) |
When calling cmd.run with cwd in combination with runas the working directory was not set on macOS This commit also adds a test to check the expected behaviour
@cdalvaro Thanks for reporting and fixing this issue! :) |
@cdalvaro Thanks for the report. I am able to reproduce this, looking at your PR I'm not sure chaining multiple commands is the right fix. If it was working as expected in 2018.3.2, we should figure out what changed between releases. @saltstack/team-core Thoughts? |
FYI:
|
man su
DESCRIPTION
...
-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above. USER is set to the target
login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The invoked shell is the target login's, and su will change directory to
the target login's home directory.
... With option But, since I don't know a different solution rather than chaining the |
* upstream/develop: (156 commits) Set os and os_family in test_run_cwd_in_combination_with_runas Fix test_run_cwd_in_combination_with_runas Add multiple retries and timeout for getting vm resources in proxmox cloud. Fixes saltstack#49485 Fix issue saltstack#51008 Adding in Windows related core grain code that got removed in merge. Ensure the refresh_pillar is run against both the minion and sub_minion, otherwise minion_blackout pillar value is left behind for the sub_minion. Update codeauthor email Optionally include line number in caller_name Allow clone_from setting in proxmox salt-cloud to be an integer as per documentation Prevent valid return from virt-what creating unhandled exceptions Fix mocking Lint fix Stop using the deprecated `salt.transport.Channel.factory` Bugfix: setting empty 'webhook' option in test_no_webhook Bugfix: checking webhook is empty or None Bugfix: typo custom_grains Fix: __grains__ contents in test_generate_payload Fix PyLint: remove unused imports Add Visual Studio Code IDE to .gitignore Fix: test_generate_payload ...
I'm having the same problem on Windows with Salt 2018.3.3. |
Still seeing this behavior in 2019.2 (we just attempted to upgrade from 2017.7) Since the git execution module piggybacks on cmd.run for execution, this effectively means that the git module is completely unusable on macOS since the 2018.3.2 release. While a workaround exists for users of the cmd.run module itself, no such workaround exists for the git module. Seems like this should be 'High Severity' per https://docs.saltstack.com/en/latest/topics/development/labels.html |
Same issue noticed on Windows 2019 with Salt minion 2019.2.0. cmd.run does not "do the right thing" when combining |
I will close this issue in a couple of days as it has been already fixed, unless someone has an objection. |
Description of Issue
cwd
option fromcmd.run
state is not working in combination withrunas
option (on macOS at least)I have arrived to this problem through the
git.latest
andgit.cloned
states.These states are failing with the following comment:
(Possible related issues #43185 and #586)
Setup
SLS recipe
Output
Versions Report
(Provided by running
salt --versions-report
. Please also mention any differences in master/minion versions.)Update
The
git.latest
task was working before upgrading my saltstack minion from2018.3.2
to2018.3.3
(with salt-master in2018.3.3
)I have installed salt in my minion workstation with @Homebrew
The text was updated successfully, but these errors were encountered: