-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Add module redfish_command #43469
Add module redfish_command #43469
Conversation
Communicates with Out-Of-Band Controller through Redfish APIs Sends a command to execute an action
ready_for_review |
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.
I don't see anywhere this module reports a change. If this is just sending arbitrary commands without a way to validate state, it should probably always report changed=True
.
# execute only if we find an Account service resource | ||
result = rf_utils._find_accountservice_resource(rf_uri) | ||
if result['ret'] is False: | ||
module.fail_json(msg=result['msg']) |
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.
Wrap all instances of result['msg']
within fail_json()
in to_native()
.
# execute only if we find a Manager service resource | ||
result = rf_utils._find_managers_resource(rf_uri) | ||
if result['ret'] is False: | ||
module.fail_json(msg=result['msg']) |
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.
I'm assuming the output in result['msg']
is fairly descriptive of the specific type of error so that the user could tell what went wrong and how to fix it.
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.
The output of result['msg'] varies in case of error, it returns an HTTPError or URLError code based on different scenarios (in older OOB controllers some APIs are not available --> 404).
version_added: "2.7" | ||
short_description: Manages Out-Of-Band controllers using Redfish APIs | ||
description: | ||
- Builds Redfish URIs locally and sends them to remote OOB controllers to |
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.
This should be a bit more descriptive of what this module specifically does. Most modules build some sort of command or URI, so this doesn't really describe what this module actually does without inferring it from reading the documentation.
The test
The test
The test
The test
The test
The test
The test
The test
|
Wow that was ugly, learned not to add colons where they don't belong in the DOCUMENTATION section. @samdoran please let me know if there is anything else. When a URI is sent there is some upfront checking (Is URI valid? Does Redfish API exist?). If one of the HTTP methods fails, that is also captured and sent back. However, if for example I send a command to create a user, and everything succeeds ( result['ret'] = True) there is no way to verify if the user was actually created, not unless I send a separate ListUsers command to verify. It is assumed that if all checks pass, the action (command or config) was executed successfully. |
I would recommend the module reports |
Thanks for your review @samdoran |
SUMMARY
Communicates with Out-Of-Band Controller through Redfish APIs
Sends a command to execute an action
ISSUE TYPE
COMPONENT NAME
redfish_command
ANSIBLE VERSION
ADDITIONAL INFORMATION
This PR is part of a group of modules. PR for first module is #41656 (merged).