Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2154512 - Katello API activation_key/:id/product_content does not expose per_page
Summary: Katello API activation_key/:id/product_content does not expose per_page
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.12.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: 6.13.0
Assignee: Evgeni Golov
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-17 10:51 UTC by Beat Rubischon
Modified: 2023-05-10 12:28 UTC (History)
4 users (show)

Fixed In Version: rubygem-katello-4.7.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2158575 (view as bug list)
Environment:
Last Closed: 2023-05-03 13:23:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35633 0 Normal Closed Activation Keys "product_content" API doesn't expose the "per_page" parameter 2022-12-18 15:10:50 UTC
Foreman Issue Tracker 35879 0 Normal New Katello API activation_key/:id/product_content does not expose per_page 2022-12-17 10:51:38 UTC
Red Hat Issue Tracker SAT-14659 0 None None None 2023-01-04 23:09:40 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:23:53 UTC

Description Beat Rubischon 2022-12-17 10:51:38 UTC
Description of problem:

Katello's API documentation doesn't expose paging in /katello/api/activation_keys/:id/product_content [1]. This limits the theforeman.foreman.activation_key Ansible module [2] to a maximum of 20 products - in case you have more, the module doesn't know about all products and is no longer idempotent. The same is true for hammer, it shows about additional pages, but doesn't accept to page or increase the page size. This becomes painful when creating keys for Library, Organization View on a Red Hat Satellite with Simple Content Access enabled.

[1] https://theforeman.org/plugins/katello/3.17/api/apidoc/v2/activation_keys/product_content.html
[2] https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/activation_key_module.html

From my understanding it's sufficient to announce the per_page and page parameters in the API documentation to make apypie aware of the parameters. I'm not sure if hammer needs special treating.

Version-Release number of selected component (if applicable):

Red Hat Satellite >= 6.12

How reproducible:

always

Steps to Reproduce:
1. Make sure the Satellite has more then 20 active Red Hat repositories
2. Create an ActivationKey following the example in https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/activation_key_module.html
3. Rerun the Ansible play

Actual results:

The module isn't idempotent since it is not capable of fetching more then 20 product entries from the existing ActivationKey

Expected results:

The module fetches all product entries and is idempotent

Additional info:

The same issue exists in hammer:

# hammer -d activation-key product-content --id=1 --organization=Default --content-access-mode-all true --content-access-mode-env false

-----|-----------------------------------------------------------------------|------------------------------------------|------------------|----------
ID   | NAME                                                                  | LABEL                                    | DEFAULT ENABLED? | OVERRIDE 
-----|-----------------------------------------------------------------------|------------------------------------------|------------------|----------
4822 | Red Hat Enterprise Linux 7 Server (Kickstart)                         | rhel-7-server-kickstart                  | no               |          
4848 | Red Hat Enterprise Linux 7 Server (RPMs)                              | rhel-7-server-rpms                       | yes              | enabled:0
3015 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart)         | rhel-8-for-x86_64-appstream-kickstart    | no               |          
-----|-----------------------------------------------------------------------|------------------------------------------|------------------|----------
Page 1 of 2 (use --page and --per-page for navigation).

Comment 2 Lukáš Hellebrandt 2023-02-02 16:20:30 UTC
1) Tried listing product content in AK using API and Hammer. In both cases, a full list was returned with proper pagination.
2) APIdoc correctly contains information about per_page: and page: attributes.
3) The playbook is de-facto idempotent since it only creates the AK once, and with proper overrides. However, the task is still marked as "changed" when run repeatedly.

=> VERIFYING this BZ since it's about API and docs, point 3) should be fixed in snap 8.0 and is tracked in bug 2134605.

Comment 5 errata-xmlrpc 2023-05-03 13:23:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097


Note You need to log in before you can comment on or make changes to this bug.