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

redfish_utils: Add support for "nextLink" property tag pagination #7020

Merged
merged 4 commits into from
Jul 28, 2023
Merged

Conversation

sseekamp
Copy link
Contributor

SUMMARY

Add support for paginated responses in the _software_inventory method

Fixes #7011

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

redfish_utils

ADDITIONAL INFORMATION

Redfish supports a property in responses @odata.nextLink which indicates a partial set of data is returned (paginated response). The existing method would truncate the returned data with no indication items were missing from the response.

Running a normal firmware inventory task:

  - name: Collect Firmware Inventory
    community.general.redfish_info:
      category: Update
      command: GetFirmwareInventory
      baseuri: "{{ bmc_address }}"
      username: "{{ bmc_username }}"
      password: "{{ bmc_password }}"
    register: redfish_fw_inventory
    delegate_to: localhost

  - debug:
      msg: "{{ redfish_fw_inventory.redfish_facts.firmware.entries | length }}"

Would return:

TASK [debug] ****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/sseekamp/Github/ansible-test/fi.yaml:20
ok: [x.x.x.x] => {
    "msg": "50"
}

which corresponded with the first page of response from a raw curl request:

...
  "Members@odata.count": 65,
  "Members@odata.nextLink": "/redfish/v1/UpdateService/FirmwareInventory?$skip=50",
  "Name": "Firmware Inventory Collection"
...

After the change:

TASK [debug] ****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/sseekamp/Github/ansible-test/fi.yaml:20
ok: [x.x.x.x] => {
    "msg": "98"
}

which is the expected full collection of firmware inventory items.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module_utils module_utils plugins plugin (any type) labels Jul 27, 2023
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jul 27, 2023
@ansibullbot ansibullbot removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jul 27, 2023
@mraineri
Copy link
Contributor

Looks good to me!

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 labels Jul 28, 2023
@ansibullbot
Copy link
Collaborator

@sseekamp This PR contains @ mentions in at least one commit message. Those mentions can cause cascading notifications through GitHub and need to be removed. Please squash or amend your commits to remove the mentions.

click here for bot help

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jul 28, 2023
Co-authored-by: Felix Fontein <felix@fontein.de>
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jul 28, 2023
@felixfontein felixfontein merged commit b46d5d8 into ansible-collections:main Jul 28, 2023
@patchback
Copy link

patchback bot commented Jul 28, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/b46d5d81973561354461c521d35f0d8e07f9cbab/pr-7020

Backported as #7026

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jul 28, 2023
patchback bot pushed a commit that referenced this pull request Jul 28, 2023
)

* Add support for Redfish "nextLink" property tag pagination for
FirmwareInventory

* Add changelog fragment

* Fix indention

* Updated fragment per suggestion

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b46d5d8)
@felixfontein
Copy link
Collaborator

@sseekamp thanks for your contribution!
@mraineri thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Jul 28, 2023
… "nextLink" property tag pagination (#7026)

redfish_utils: Add support for "nextLink" property tag pagination (#7020)

* Add support for Redfish "nextLink" property tag pagination for
FirmwareInventory

* Add changelog fragment

* Fix indention

* Updated fragment per suggestion

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b46d5d8)

Co-authored-by: Scott Seekamp <sseekamp@coreweave.com>
felixfontein added a commit to felixfontein/community.general that referenced this pull request Jul 31, 2023
…fish_utils: Add support for "nextLink" property tag pagination (ansible-collections#7026)"

This reverts commit 1dad953.
felixfontein added a commit that referenced this pull request Jul 31, 2023
* Revert "[PR #7020/b46d5d81 backport][stable-7] redfish_utils: Add support for "nextLink" property tag pagination (#7026)"

This reverts commit 1dad953.

* Revert "[PR #6914/17b4219b backport][stable-7] proxmox_kvm: enable 'force' restart of vm (as documented) (#6997)"

This reverts commit 7d68af5.

* Revert "[PR #6976/d7c1a814 backport][stable-7] [proxmox_vm_info] Re-use cluster resources API to use module without requiring node param (#6993)"

This reverts commit fb3768a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module_utils module_utils plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetFirmwareInventory support for paginated results
4 participants