Python Fabric: Skip logins needing passwords

后端 未结 2 1691
[愿得一人]
[愿得一人] 2021-01-22 16:07

I have a similar issue to this: How can I skip Fabric connections that ask for a password? which has no answer. I\'m looking for a way to get Fabric to consider bad any host ask

2条回答
  •  终归单人心
    2021-01-22 16:29

    I believe env.abort_on_prompts will achieve what you need, i.e. fail if there is a need for any kind of user interaction, while working when public key authentication is possible.

    According to the documentation, this option calls abort() which in turn make use of sys.exit, which raises SystemExit making it possible to detect and recover from inner calls to abort by using except SystemExit or similar.

提交回复
热议问题