ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
828 stars 1.53k forks source link

Can't use CreateBiosConfigJob command from idrac_redfish_command module #2090

Closed pyfontan closed 1 year ago

pyfontan commented 3 years ago

Summary

I'm trying to create a job for BIOS configuration.

In the documentation example, specified resource_id is System.Embedded.1 https://github.com/ansible-collections/community.general/blob/926c0a71d03a447580b6a034432608c632477059/plugins/modules/remote_management/redfish/idrac_redfish_command.py#L68

When i use this resource, i have an error message :

Manager resource System.Embedded.1 not found

explained by: https://github.com/ansible-collections/community.general/blob/926c0a71d03a447580b6a034432608c632477059/plugins/modules/remote_management/redfish/idrac_redfish_command.py#L201

And of course, if I use iDRAC.embedded.1 which is the actual manager resource ID, task fails with :

System resource iDRAC.Embedded.1 not found

explained by : https://github.com/ansible-collections/community.general/blob/926c0a71d03a447580b6a034432608c632477059/plugins/modules/remote_management/redfish/idrac_redfish_command.py#L194

Issue Type

Bug Report

Component Name

idrac_redfish_command

Ansible Version

$ ansible --version
ansible 2.10.5
  config file = /home/pyfontan/.ansible.cfg
  configured module search path = ['/home/pyfontan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pyfontan/virtualenv/ansible/lib/python3.8/site-packages/ansible
  executable location = /home/pyfontan/virtualenv/ansible/bin/ansible
  python version = 3.8.6 (default, Jan 27 2021, 15:42:20) [GCC 10.2.0]

Configuration

$ ansible-config dump --only-changed

OS / Environment

iDRAC 4.32.20.00 on PowerEdge C6525 or iDRAC 3.21.26.22 on PowerEdge R740xd

Steps to Reproduce

- name: Create BIOS configuration job (schedule BIOS setting update)
  community.general.idrac_redfish_command:
    category: Systems
    command: CreateBiosConfigJob
    #resource_id: "{{asset_system_resource_name}}"
    #resource_id: "System.Embedded.1"
    resource_id: "iDRAC.Embedded.1"
    baseuri: "{{ asset.manager.ip }}"
    username: "{{ asset.manager.user }}"
    password: "{{ asset.manager.password }}"

Expected Results

I expect to have a BIOS Job configuration created.

Actual Results

Code of Conduct

ansibullbot commented 3 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 3 years ago

cc @billdodd @mraineri @renxulei @tomasg2012 @xmadsen click here for bot help

billdodd commented 3 years ago

Thanks for opening this issue.

The logic in CreateBiosConfigJob was created before the resource_id property was added and the requirement that the resource_id must be specified for data modification requests where there is more than one resource in the collection category (Systems/Managers/Chassis). So now there is a conflict in that command where both _find_managers_resource() and _find_systems_resource() are both trying to use the resource_id property.

To fix this, I think the correct approach is to:

  1. Remove the call to rf_utils._find_managers_resource() on line 201.
  2. Create a new helper method called managed_by(resource_uri) in RedfishUtils that will use the ManagedBy property within Links to look up the Manager for the given resource.
  3. In create_bios_config_job(), call the new rf_utils.managed_by(resource_uri) method to get the Manager URI (instead of using self.manager_uri on line 118).
bluikko commented 2 years ago

@pyfontan is your server a modular chassis/blades? I thought resource_ids are needed only on modular systems i.e. M/MX series etc. On community.general version 4.1.0 I got it working by not passing any resource_id at all. This on r730xd.

pyfontan commented 2 years ago

@bluikko : As said in the description i had this problem with :

iDRAC 4.32.20.00 on PowerEdge C6525 or iDRAC 3.21.26.22 on PowerEdge R740xd

bluikko commented 2 years ago

iDRAC 4.32.20.00 on PowerEdge C6525 or iDRAC 3.21.26.22 on PowerEdge R740xd

On my previous generation systems it works when resource_id is not specified.

ansibullbot commented 2 years ago

cc @bhavya06 @rajeevkallur click here for bot help

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @jyundt click here for bot help