pyaoscx icon indicating copy to clipboard operation
pyaoscx copied to clipboard

API call functions don't have timeouts

Open cs-1 opened this issue 2 years ago • 3 comments

...

EDIT: I located the problem, see next post.

cs-1 avatar Oct 10 '23 13:10 cs-1

The problem seems to occur in all functions that do API calls to the switch. I have located the problem in

https://github.com/aruba/pyaoscx/blob/aa91f087304859124f8a2fd91b7cbe1981c306a0/pyaoscx/session.py#L356-L362

There's no connection or read timeout set here. Changing this to

        return operations[operation](
            self._build_uri(path),
            verify=verify,
            params=params,
            data=data,
            proxies=self.proxy,
            timeout=(5,30)
        )

seems to fix the problem (the timeout is set to 5, the read timeout to 30 seconds).

cs-1 avatar Oct 11 '23 07:10 cs-1

Can you change this so it can be changed from an ansible variable in playbook maybe ? I've hade issues with timeouts when set to 5 sec on some jobs.

federstedt avatar Nov 06 '23 14:11 federstedt

We do not use pyaoscx within Ansible, we're using it in our own python tools. 5s was just a suggestion. This could be set to any other reasonable value as long as there is a timeout at all. You could implement this to have a default timeout which can be overridden by software that uses pyaoscx like Ansible.

cs-1 avatar Nov 06 '23 14:11 cs-1