-Adjusted CIMC proxy module to properly handle HTTP error codes and#48095
-Adjusted CIMC proxy module to properly handle HTTP error codes and#48095rallytime merged 5 commits intosaltstack:developfrom spenceation:cimc-proxy-http-patch
Conversation
salt/proxy/cimc.py
Outdated
| log.debug("Received error HTTP status code: {0}" .format(str(r['status']))) | ||
| logout(cookie) | ||
| raise salt.exceptions.CommandExecutionError( | ||
| "Did not receive a valid response from host.") |
There was a problem hiding this comment.
Maybe log what the error code we received was?
There was a problem hiding this comment.
It should be logging the error code on line 157.
salt/proxy/cimc.py
Outdated
| status=True, | ||
| headers=DETAILS['headers']) | ||
|
|
||
| if str(r['status']) not in ['200', '201', '202', '204']: |
There was a problem hiding this comment.
This is identical to L156. Refactor for DRY?
There was a problem hiding this comment.
I'll change this to be included in a single function.
salt/proxy/cimc.py
Outdated
| status=True, | ||
| headers=DETAILS['headers']) | ||
|
|
||
| if str(r['status']) not in ['200', '201', '202', '204']: |
There was a problem hiding this comment.
Same comment as above for refactoring for DRY.
|
Hey @spenceation! I'm checking in here - did you get a chance to implement the feedback above? |
|
Hey @rallytime. I've added the requested changes. |
mirceaulinic
left a comment
There was a problem hiding this comment.
Just a small suggestion, otherwise looks good to me.
salt/proxy/cimc.py
Outdated
| if formatted_response_code not in ['200', '201', '202', '204']: | ||
| if cookie_to_logout: | ||
| logout(cookie_to_logout) | ||
| log.debug("Received error HTTP status code: {0}" .format(formatted_response_code)) |
There was a problem hiding this comment.
Perhaps log.error would be more appropriate?
There was a problem hiding this comment.
@spenceation What do you think about this comment here?
What does this PR do?
Adjusted CIMC proxy module to properly handle HTTP errors and timeouts.
What issues does this PR fix or reference?
Currently CIMC modules will display error messages when the CIMC proxy timeouts or receives a HTTP error code. This patch will apply the appropriate exception code during proxy module calls.
Previous Behavior
Error messages are displayed instead of device is not reachable.
New Behavior
Devices will now properly display not reachable messages when timeouts or HTTP error codes occur.
Tests written?
No
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.