pytest-testinfra
pytest-testinfra copied to clipboard
Allow passing of arguments to sudo
It would be nice to be able to pass arguments to host.sudo().
My use-case for this is needing to have the $HOME environment variable set in the target user's environment. This can be accomplished by passing the -H argument to sudo, e.g. host.run('sudo -H -u myuser some_cmd').
However, there doesn't seem to be anyway to use this argument with the context manager. Something like host.sudo(user=None, *args) would be great.
Would also like to see this, in my case, so that a command can be run inside an interactive or login shell of a user