pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

Set context before calling use_sudo_password()

Open jaysoffian opened this issue 1 year ago • 1 comments

Set context before calling use_sudo_password() in case it wants access to host data. A use case is setting the sudo password in group data files, and then later providing it via config.USE_SUDO_PASSWORD. e.g.

config.USE_SUDO_PASSWORD = lambda: host.data.sudo_password

jaysoffian avatar Aug 08 '22 22:08 jaysoffian

Codecov Report

Merging #868 (62845e7) into 2.x (5fedec4) will decrease coverage by 0.00%. The diff coverage is 50.00%.

@@            Coverage Diff             @@
##              2.x     #868      +/-   ##
==========================================
- Coverage   91.68%   91.67%   -0.01%     
==========================================
  Files         122      122              
  Lines        7580     7583       +3     
==========================================
+ Hits         6950     6952       +2     
- Misses        630      631       +1     
Impacted Files Coverage Δ
pyinfra/connectors/util.py 89.54% <50.00%> (-1.13%) :arrow_down:
pyinfra/api/operations.py 84.81% <0.00%> (+0.52%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 08 '22 22:08 codecov[bot]

@jaysoffian I have just merged in https://github.com/Fizzadar/pyinfra/commit/591ea61e3b29210ccb5ac71665920f1374a51e18 which I believe solves this issue (and any other host state needs within operation execution context).

Fizzadar avatar Aug 13 '22 17:08 Fizzadar

@jaysoffian I have just merged in 591ea61 which I believe solves this issue (and any other host state needs within operation execution context).

Indeed. Thanks!

jaysoffian avatar Aug 18 '22 22:08 jaysoffian