-
Hi, how to disable a bit of context # group_data/local.py
_sudo = True
_preserve_sudo_env = True # deploy.py
from pyinfra.operations.server import shell, packages
packages(["direnv"]) # run as root
# I want to write the output to /home/$USER/... ; not /root/...
shell(["direnv hook fish > ~/.config/fish/conf.d/direnv.fish"]) after some inspection with
I notice it use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Just realized it's hardcoded here pyinfra/pyinfra/connectors/util.py Lines 345 to 347 in 2fb4fb0 I'm going to convert this to github issue and create PR to add Footnotes
|
Beta Was this translation helpful? Give feedback.
-
my current solution from os import getenv
_sudo = True
_env = {"HOME": f"/home/{getenv("USER")}"} but dunno, this feel awkward. |
Beta Was this translation helpful? Give feedback.
my current solution
but dunno, this feel awkward.
I think
_sudo_always_set_home=False
+_preserve_sudo_env=True
is better 🤔