Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API call functions don't have timeouts #26

Open
cs-1 opened this issue Oct 10, 2023 · 3 comments
Open

API call functions don't have timeouts #26

cs-1 opened this issue Oct 10, 2023 · 3 comments

Comments

@cs-1
Copy link

cs-1 commented Oct 10, 2023

...

EDIT: I located the problem, see next post.

@cs-1
Copy link
Author

cs-1 commented Oct 11, 2023

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

pyaoscx/pyaoscx/session.py

Lines 356 to 362 in aa91f08

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

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 cs-1 changed the title Configuration.upload_switch_config_from_local() doesn't have a timeout API calls functions don't have timeouts Oct 11, 2023
@cs-1 cs-1 changed the title API calls functions don't have timeouts API call functions don't have timeouts Oct 11, 2023
@federstedt
Copy link

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.

@cs-1
Copy link
Author

cs-1 commented Nov 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants