ansible-junos-stdlib icon indicating copy to clipboard operation
ansible-junos-stdlib copied to clipboard

junos_install_config: apply timeout to initial device connection

Open AndyMan1 opened this issue 8 years ago • 2 comments

junos_install_config has a timeout parameter but it's not used when opening the initial connection to the device, here.

If the device is down or the host/port is incorrect, it can take upwards of 4 minutes to eventually timeout, depending on other defaults.

It would be great if timeout was applied to device.open() as well, so you could limit long timeouts.

This will require some coordination with Juniper/py-junos-eznc.It uses ncclient's manager which does have a timeout parameter, but device.open() doesn't seem to make use of it

AndyMan1 avatar Jul 09 '16 00:07 AndyMan1

I would say this issue does not need a fix in junos_install_config. If there is a concern that a device might not be reachable then use the wait_for task before calling the junos_install_config task The wait_for task checks that a TCP session can be established to the device on a given port and has a timeout option to control how long to give a device to respond.

jnpr-bowen avatar Jan 03 '18 19:01 jnpr-bowen

@AndyMan1 I think your request is valid. As you point out, this capability needs to first be added to PyEZ. Can you please open a corresponding issue against PyEZ?

I feel the workaround @jnpr-bowen suggests by first checking reachability to the device using the wait_for module is reasonable and best practice for Ansible. However, that doesn't address the native PyEZ need for a connection timeout parameter, and if we implement it in PyEZ we might as well expose it in the Ansible modules.

stacywsmith avatar Jan 12 '18 18:01 stacywsmith