pyinfra-dev / pyinfra

pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
https://pyinfra.com
MIT License
3.91k stars 383 forks source link

Error: could not load fact: deb_packages #587

Closed 4bo closed 2 years ago

4bo commented 3 years ago

trying to run a simple command on a debian 10 target by pyinfra 1.4:

pyinfra myserver apt.packages iotop sudo=True

i get:

--> Loading config...
--> Loading inventory...

--> Connecting to hosts...
    [myserver] Connected

--> Preparing operation...
    [myserver] sudo: a password is required
    [myserver] Error: could not load fact: deb_packages 
--> pyinfra error: No hosts remaining!

the problem is with sudo part, non sudo commands is ok

Fizzadar commented 3 years ago

@4bo if you add use_sudo_password=true it should prompt for the password so this will work!

Currently there is no automatic detection of when a sudo password is required; there's an issue tracking this here.