Skip to content

Loading…

String substitution for user parameter #1

Closed
wants to merge 1 commit into from

1 participant

@jbrownbridge

I thought this may be useful as sometimes you don't want to hardcode the user parameter for sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 2 additions and 0 deletions.
  1. +2 −0 fabric/operations.py
View
2 fabric/operations.py
@@ -658,6 +658,8 @@ def _run_command(
format = env.format
if format:
command = command.format(**env)
+ if sudo and user:
+ user = user.format(**env)
# Set up new var so original argument can be displayed verbatim later.
given_command = command
# Handle context manager modifications, and shell wrapping
Something went wrong with that request. Please try again.