Open
Description
Describe the bug
I have a situation my hosts have multiple IPs, but only one is accessible. Pyinfra seems to only try to connect to the first ip resolved. For instance:
myserver has address 172.16.0.4
myserver has address 10.100.48.54
If (by any chance) the order is reversed, pyinfra manages to connect. SSH also manages to connect: it will timeout for the first ip, but will try the second after that. I have also decreased ConnectTimeout
in my ssh config to speed up the first timeout.
To Reproduce
Make one host have multiple ips, one being invalid or inacessible.
Expected behavior
pyinfra should try to connect to the second ip after the first timeout.
Meta
- Include output of
pyinfra --support
.
System: Linux
Platform: Linux-5.4.0-48-generic-x86_64-with-glibc2.29
Release: 5.4.0-48-generic
Machine: x86_64
pyinfra: v1.6.3
Executable: /home/stoq_pdv_user/.local/bin/pyinfra
Python: 3.8.5 (CPython, GCC 9.3.0)
- How was pyinfra installed (source/pip)?
pip
- Consider including output with
-vv
and--debug
.
$ pyinfra wlx138pdv070 fact facts.InstalledVersion -vvv --debug
[pyinfra_cli.main] Deploy directory remains as cwd
--> Loading config...
--> Loading inventory...
[pyinfra_cli.inventory] Creating fake inventory...
--> Connecting to hosts...
[pyinfra.api.connectors.ssh] Connecting to: wlx138pdv070 ({'allow_agent': True, 'look_for_keys': True, 'hostname': 'wlx138pdv070', '_pyinfra_force_forward_agent': None, '_pyinfra_ssh_config_file': None, 'timeout': 10})
[wlx138pdv070] Could not connect (timed out)
[pyinfra.api.state] Failing hosts: wlx138pdv070
--> pyinfra error: No hosts remaining!