-
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
Provide flexibility when retrieving facts #46148
Conversation
Thanks, Jose. I reviewed the code changes, and they look good. I also tested the changes against an HPE iLO system. The results were better, but there were still some KeyError exceptions raised. I'll describe them in a separate comment. (It might take a while; that test system seems to be in a bad state now and I can't get it to respond to any Redfish APIs.) |
Here are the places where I still see KeyError exceptions when running against an HPE iLO system. 1. get_cpu_inventory(), line 766, KeyError on "@odata.id":
On the iLO, the "Processors" property does not have an "@odata.id". Instead of this:
it looks like this:
2. get_nic_inventory(), line 811, KeyError on "EthernetInterfaces":
No "EthernetInterfaces" property on this system (though it does have an EthernetInterfaces link nested in an Oem property). 3. get_psu_inventory(), line 855, KeyError on "Links":
No "Links" property on this system. It does have "links" property, but no "PoweredBy" property under "links". 4. get_bios_attributes(), line 533, KeyError on "@odata.id":
On this system, the "Bios" property does not have an "@odata.id". Instead of this:
it looks like this:
5. get_bios_boot_order(), line 560, KeyError on "@odata.id":
Same issue as # 4 above (just in a different method) So I guess the bottom line is that some or all of the other |
@billdodd Open to suggestions on how to generalize. |
At least for numbers 1, 4, and 5, those seem to be implementation issues. If the Processors or Bios property is supported on a service, it's supposed to be a JSON object containing an |
Thanks, Mike. Yes, it does look like 1, 4 and 5 are implementation issues. I checked a mockup from a newer release from the vendor and those items are corrected. I'm working on updating the firmware of our test system. |
Bill, For 2, the schema specifies either EthernetInterface (what I use), NetworkInterface and NetworkAdapter, do you agree? If so, I can change Not sure what to do for 3, I don't see anything about PSUs in the mockup you sent me, so maybe just add code to gracefully bypass it if the schema name is not found? |
Jose, For 2, the set of properties that would be found in "EthernetInterfaces", "NetworkInterfaces" and "NetworkAdapters" resources would all be different. So I'd say just stick with "EthernetInterfaces" for the "GetNicInventory" command. If any users in future have a need to get the inventory of those other resources, a new command or commands could be added. Note that I got the KeyError originally on the iLO system with an older firmware. After I updated the firmware to the latest, the "EthernetInterfaces" property was there so it did not get a KeyError. But it still makes sense to check for the presence of "EthernetInterfaces" and if missing return an empty inventory payload (a graceful bypass as you mentioned for 3). For 3, yes I agree with bypassing the inventory if "Links" or "PoweredBy" are not present. |
@billdodd check last commit, added checks in several functions |
Thanks. I'll check it out and report back. |
Numbers 2 and 3 from my Sept 26 comment above now pass on the iLO. Numbers 1, 4, and 5 still fail, but those are service issues as pointed out above by Mike R. |
shipit |
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.
Reviewed code. Looks good.
shipit
Patch is not merging (again), checked BOTMETA.yml, we're all still there. Will ask in IRC to see what's going on. |
bot_status |
Discussed in IRC. User Pilou mentioned that modules in module_utils do not get shipit labels. He made a reference to ansible/ansibullbot#1046. Added this PR to core team meeting agenda ansible/community#375 to have it merged, |
Componentslib/ansible/module_utils/redfish_utils.py Metadatawaiting_on: maintainer |
rebuild_merge |
* Provide flexibility when retrieving facts * Check if keys exist before trying to read (cherry picked from commit 81640a2)
* Provide flexibility when retrieving facts * Check if keys exist before trying to read (cherry picked from commit 81640a2)
* Provide flexibility when retrieving facts * Check if keys exist before trying to read
SUMMARY
Provides flexibility when retrieving facts by not assuming that certains keys exist. Checks first if key exists before attempting to read from it.
Fixes #45248
ISSUE TYPE
COMPONENT NAME
redfish_utils
ANSIBLE VERSION
ADDITIONAL INFORMATION
Cleaner code