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

Can't find any way to forward env variables in Fabric 2 #1869

Closed
nicolas-van opened this Issue Sep 7, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@nicolas-van

nicolas-van commented Sep 7, 2018

The title speaks for itself. I just can't find any possibility to send env vars to a remote computer. Example:

from fabric import task

@task
def test(c):
   c.run('echo hello $WORLD', env={'WORLD': 'world'})
fab -H myserver test
# hello

Please, just give me a hint because I can't find anything in the doc about that.

Fabric version: 2.3.1

@mengjuleu

This comment has been minimized.

Show comment
Hide comment
@mengjuleu

mengjuleu Sep 9, 2018

A workaround solution: you might create use a command to set env var of the remote server.

from fabric import task

@task
def test(c):
    c.run('WORLD='world'')
    c.run('echo hello $WORLD')

mengjuleu commented Sep 9, 2018

A workaround solution: you might create use a command to set env var of the remote server.

from fabric import task

@task
def test(c):
    c.run('WORLD='world'')
    c.run('echo hello $WORLD')
@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Sep 12, 2018

Member

This is a known bug, see #1752.

Member

bitprophet commented Sep 12, 2018

This is a known bug, see #1752.

@bitprophet bitprophet closed this Sep 12, 2018

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Sep 12, 2018

Member

Also, version 2.3 offers an additional workaround, inline_ssh_env, see http://docs.fabfile.org/en/2.3/api/connection.html#fabric.connection.Connection.__init__

Member

bitprophet commented Sep 12, 2018

Also, version 2.3 offers an additional workaround, inline_ssh_env, see http://docs.fabfile.org/en/2.3/api/connection.html#fabric.connection.Connection.__init__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment