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

Add module redfish_config #43470

Merged
merged 8 commits into from
Aug 30, 2018
Merged

Add module redfish_config #43470

merged 8 commits into from
Aug 30, 2018

Conversation

jose-delarosa
Copy link
Contributor

SUMMARY

Communicates with Out-Of-Band Controller through Redfish APIs
Sends a configuration update to the Controller

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

redfish_config

ANSIBLE VERSION
ansible 2.7.0.dev0 (redfish_config 3d2e341c0c) last updated 2018/07/30 23:18:28 (GMT -500)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /share1/git/ansible/lib/ansible
  executable location = /share1/git/ansible/bin/ansible
  python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
ADDITIONAL INFORMATION

This PR is part of a group of modules. PR for first module is #41656 (merged).

Communicates with Out-Of-Band Controller through Redfish APIs
Sends a configuration update to the Controller
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. labels Jul 31, 2018
@jose-delarosa
Copy link
Contributor Author

ready_for_review

@ryansb ryansb removed the needs_triage Needs a first human triage before being processed. label Jul 31, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 8, 2018
@samdoran samdoran self-requested a review August 14, 2018 20:01
# 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'])
Copy link
Contributor

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

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Aug 14, 2018
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
Copy link
Contributor

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.

Copy link
Contributor

@samdoran samdoran left a 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?

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 15, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 15, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_config.py:230:1: E305 expected 2 blank lines after class or function definition, found 1

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Aug 15, 2018
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Aug 16, 2018
@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels Aug 24, 2018
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))
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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'],
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@ansibot ansibot removed the stale_review Updates were made after the last review and the last review is more than 7 days old. label Aug 24, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 30, 2018
@samdoran samdoran merged commit 7f43f49 into ansible:devel Aug 30, 2018
@jose-delarosa
Copy link
Contributor Author

Thanks for your review @samdoran

@jose-delarosa jose-delarosa deleted the redfish_config branch September 14, 2018 02:56
@jose-delarosa jose-delarosa restored the redfish_config branch September 14, 2018 02:56
@jose-delarosa jose-delarosa deleted the redfish_config branch September 14, 2018 03:52
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants