support for 'user' argument to su to another user when executing git and R10K #141
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.
I've taken on-board the suggestions from https://github.com/acidprime/r10k/issues/135 and developed this PR to address it.
The patch works by checking for the presence of a
user
argument. If this is present and matches the regexp^\w+$
, we will try to invokegit
orr10k
by doingsu - $user -c 'COMMAND'
.I've modified the agent to support
user
on all operations and verified that I still receive output and errors, as you can see from the following console captures:r10k status
r10k deploy_module
r10k sync
As you can see, there is a strange error here caused by a partial failure and this gets captured too. I got the same error running
r10k
on the command line so its legitThanks Eli, Brett and Zack for your help figuring this one out.