-
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_config #43470
Add module redfish_config #43470
Conversation
Communicates with Out-Of-Band Controller through Redfish APIs Sends a configuration update to the Controller
ready_for_review |
# execute only if we find a System resource | ||
result = rf_utils._find_systems_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.
The value in msg
should be wrapped in to_native()
to ensure it is the correct string type based on the Python version. from ansible.module_utils._text import to_native
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.
Add a description of what this module actually does beyond building commands and sending them to an API.
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.
Similar to the other module, I don't see where this module checks whether or not changes were made. Is that correct?
The test
|
for cmd in command_list: | ||
# Fail if even one command given is invalid | ||
if cmd not in CATEGORY_COMMANDS_ALL[category]: | ||
module.fail_json(msg=to_native("Invalid Command: %s" % cmd)) |
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.
It would be helpful to display valid values here.
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.
Yup no problem
result: | ||
description: different results depending on task | ||
returned: always | ||
type: dict |
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.
Maybe consider changing the type to complex
and documenting a few different examples of data returned by the commands. Since there are only three, this should be feasible unless it's just an enormous amount of data that is returned. See docs for examples.
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.
Need to update this, this was true before I split my original module into 3 modules. In this module, (redfish_config) the return value is either OK (success) or an error message/code.
'pswd': module.params['password']} | ||
|
||
# Manager attributes to update | ||
mgr_attributes = {'mgr_attr_name': module.params['mgr_attr_name'], |
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 parameters mgr_attr_value
and bios_attr_name
are not marked as required nor do they have a default value in the argument spec. This means they will be None
if not passed into the module. Is that ok?
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.
Good catch. Need to set to a bogus default value, as setting to a valid default value can have unintended consequences. With an 'invalid' value, it will catch the error and exit.
mgr_attr_name=dict(default='invalid'),
mgr_attr_value=dict(default='invalid'),
bios_attr_name=dict(default='invalid'),
bios_attr_value=dict(default='invalid'),
Without a default value, and if not specified, error message is ugly.
Thanks for your review @samdoran |
SUMMARY
Communicates with Out-Of-Band Controller through Redfish APIs
Sends a configuration update to the Controller
ISSUE TYPE
COMPONENT NAME
redfish_config
ANSIBLE VERSION
ADDITIONAL INFORMATION
This PR is part of a group of modules. PR for first module is #41656 (merged).