-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
No way to specify remote environment variables #1826
Comments
One workaround is to use
|
Think this needs to roll into #1744, please follow along there for comments. |
Sorry, #1752. Ugh. So many tickets. No wonder I never get anything done, I'm spending all my time closing duplicates 😢 |
Still suffering ticket confusion. Insofar as this issue is about "most servers only have Offhand, while I don't like the "turn the requested Main question is thus how to add this to the API; the released-as-2.0 behavior is to use "proper" env manipulation, so we cannot simply change it, or we'll break for anyone who's happily trucking along with a more permissive I'm thinking most obvious is to add a configuration setting (maybe also a keyword argument, but this feels a lot like it really wants to be config-only; it's effectively a property of the remote host or connection) like, say, |
Have this working, as
|
And a skipped one around escaping. ugh.
Enough of the Travis run is green that I am declaring this Done For Now. It'll be out in 2.3. |
Grump, just realized that this isn't the absolute best way to do this; it breaks down for nontrivial shell commands, eg Going to VERY quickly address this as if it were a bug and pop out another release. |
2.3.1 now out with that fix. Hopefully that's the only big embarrassing mistake with this 😝 I skimmed the rest of v1's |
Thanks! Confirm that it works for me, but only with replace_env=True. With False it fails with bash syntax error (the list of my environment variables is reduced for clarity):
|
Also, with replace_env=True it fails to find my local python executable from virtualenv because PATH is not inherited. |
That is probably because you have lots of nontrivial data in your local shell env and it needs escaping on the remote end (because it's being shoehorned into the command line string instead of set via the server's "real" env setting functionality, as outlined above). To be fair, using Is there a reason not to put PATH updates into either the remote e.g. (Yes, these concerns should have been raised earlier as they are technically orthogonal to the actual functionality fix... apologies for not doing so 🙃 ) |
Keeping PATH intact is important for me, because the task is designed to be invoked both remotely and locally (i.e.
|
To clarify, all I meant was that it might make more sense to limit your specification for the remote env to some whitelisted set of variables such as Not only is that more secure when hitting remote targets but it will avoid the escaping issues I think you're hitting (as PATH is less likely to have shell meta-chars in it than other things like This will become partly moot when we fix the local-vs-remote config issue, after which point |
First task prints
None
because the default sshd install hasAcceptEnv LANG LC_*
and nothing else (see #1744 (comment)):Second one fails due to
&&
(although it probably used to work, see #1744 (comment)):The value of
replace_env
flag does not matter.The text was updated successfully, but these errors were encountered: