-
Notifications
You must be signed in to change notification settings - Fork 9
Cluster shutdown module exception handling update #210
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
Conversation
justinc1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change is ok, but more such changes are needed.
plugins/module_utils/cluster.py
Outdated
| # raise errors.ScaleComputingError(f"Request timed out: {e}") | ||
| except ScaleComputingError as e: | ||
| # To avoid timeout when there are a lot of VMs to shutdown | ||
| if "Request timed out" in str(e): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we also detect exception root cause from string, not from type. Are the more places with this pattern?
We should have a dedicated exception, like ScaleRequestTimedOut. Then you refactor the RestClient, and you need to check if there is any other module that needs to know about your new exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this error will never cause a problem right? The string is generated inside the client, so the string comparison will never fail due to formatting (like it would when we compared the string directly from the http response - in case of "connection refused")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I implemented ScaleTimeoutError in rest_client
e988bae to
1f387ef
Compare
justinc1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok and thank you.
Use ConnectionRefusedError in cluster shutdown instead of error description comparison
Closes #137