Open themanifold opened 2 years ago
The config variable here should be USE_SUDO_PASSWORD
, that should work as expected!
OK, so I think what I used to do was create a global variable in the config object call USE_REMOTE_PASSWORD
and that I passed to use_sudo_password
. Now what I'm doing is just setting config.USE_SUDO_PASSWORD
and config.SUDO
at the top of the code and everything now works apart from the nested operation which just seems to ignore the config settings and not embed the shell snippet within the usual env SUDO_ASKPASS=pyinfra-sudo-askpass *** sh -c '<shell snippet'>
like I would expect.
Very slow getting back on this, apologies. So the reason this fails is because the config object is unique per host and also per stage (first fact gathering then execution) - but the config for one host is not shared between each stage. This the function call here uses the original config without the extra attribute:
Quick workaround would be adding the attribute in config.py
(or whatever --config X.py
filename). Long term I think the original example you provide should work as expected, so config may need to be scoped by host rather than state to achieve that.
Describe the bug
Trying to use nested operations which require programmatic sudo access throws
AttributeError
UPDATE: perhaps this should just be that nested operations do not support custom config attributes(?)
To Reproduce
Expected behavior
I would expect a nested operation to support programmtic sudo access
Meta
pyinfra --support
.