I spent some time reading Fabric's documentation and I found that, by default (?) the channel object won't have all the environment variables as a logged-in shell (see http://www.fabfile.org/faq.html#faq-bash )
I have the following code:
from fabric2 import Connection
self.ssh = Connection(
host=kwargs["host"],
user="admin",
connect_kwargs=conn,
)
self.ssh.run("env", hide=False)
which indeed confirms that the ssh session doesn't have all environment variables that I need.
How can I make Fabric run my commands inside a shell with my user's environment variables? (actual code example)
Note: I don't want to modify anything on the server side. I just want to be able to run commands from Fabric in the same environment I'd get if I'd use a normal terminal (iTerm2, Yakuake, PuTTY, whatever).