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

Read paginated response for gallery image versions #1073

Merged
merged 2 commits into from
Feb 8, 2023

Conversation

Autom3
Copy link
Contributor

@Autom3 Autom3 commented Feb 3, 2023

SUMMARY

The query returns a pagineated response with a "nextLink" key in the response object. If the response has such a key, we launch another request to collect the next batch, etc.

I based my code on this code (azure_rm_resource_info.py)

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

n/a

ADDITIONAL INFORMATION

Ansible playbook to reproduce the bug:

Requires you to have more than 50 versions in one azure gallery image

---
- name: List images in gallery
  hosts: localhost
  connection: local
  vars:
    gallery_resource_group: IMAGE-GALLERY
    gallery_name: ImageGallery
    gallery_image_name: gallery

  tasks:
    - name: List gallery image versions in our gallery images.
      azure_rm_galleryimageversion_info:
        resource_group: "{{ gallery_resource_group }}"
        gallery_name: "{{ gallery_name }}"
        gallery_image_name: "{{ gallery_image_name }}"
      register: tmp
      
    - debug:
        msg: "{{tmp.versions|length}}"

Before the bugfix this will ouput 50, after it will output the correct amount.

The query returns a pagineated response with a "nextLink" key in the response object. If the response has such a key, we launch another request to collect the next batch, etc.
@Fred-sun Fred-sun added medium_priority Medium priority ready_for_review The PR has been modified and can be reviewed and merged labels Feb 7, 2023
@xuzhang3 xuzhang3 merged commit 48c2c25 into ansible-collections:dev Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants