pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

Allow passing of arguments to sudo

Open mplanchard opened this issue 7 years ago • 1 comments

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.

mplanchard avatar Jun 13 '18 21:06 mplanchard

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

marcjay avatar Apr 27 '19 12:04 marcjay