Teffen Ellis
Teffen Ellis

Reputation: 113

How can I skip Fabric connections that ask for a password?

I'm iterating over a few hundred EC2 instances but only have access to about 80% of them. I would like to skip any instances that have declined my SSH key and asked for a password.

Upvotes: 3

Views: 880

Answers (1)

Senthil Kumaran
Senthil Kumaran

Reputation: 56941

If the host is unreachable, then you can use --skip-bad-hosts option, otherwise Looks like you can use the settings context manager and try the ssh within that context manager and if the failure happens it can skip to the next one. The docs for context_manager.settings have an example.

with settings(warn_only=True):
    ssh_attempt # can fail
ssh_attemp # cannot fail

Upvotes: 2

Related Questions