Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-29198

Packages API ignores content_view* and environment_* options

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • 0
    • Moderate
    • None

      Description of problem:

      API endpoint "GET /katello/api/packages" offers (by mistake?) a way to limit the search by content_view_id and/or environment_id. BUT this does not work at all, the parameters are ignored.
       

      How reproducible:
      100%
       

      Is this issue a regression from an earlier version:
      nope
       

      Steps to Reproduce:

      1. Have a few bigger repos synced, and a tiny CV promoted to a LE

      2. Try package searches like:

      ```
      curl -k -u admin:$PASSWORD "https://localhost/katello/api/packages?organization_id=1&page=1&per_page=1&environment_id=2"

      curl -k -u admin:$PASSWORD "https://localhost/katello/api/packages?organization_id=1&page=1&per_page=1&content_view_id=5"

      curl -k -u admin:$PASSWORD "https://localhost/katello/api/packages?organization_id=1&page=1&per_page=1&content_view_id=5&environment_id=2"

      curl -k -u admin:$PASSWORD "https://localhost/katello/api/packages?organization_id=1&page=1&per_page=1&repository_id=1234"
      ```

      (use proper IDs of CV / LE / repository)

      Actual behavior:
      The first three queries return "here is 1st package from all packages in all repos/CVs within the organization" (cf `total`/`selectable` values). The last query returns (the first package out of) packages in a given repository only.

      Expected behavior:
      Either all four queries return packages from given CV/LE/repo, or the options are not available for the package search.

      Anyway, currently `hammer package list` does use this API, so removing the options must be aligned with changes in hammer (or is it aligned automatically..?)

      Business Impact / Additional info:
      `hammer package list` providing very confusing results when listing newest package from a given CV. Example:

      ```
      hammer package list --search "name = java-17-openjdk" --content-view CV_TEST --lifecycle-environment LCE_TEST --packages-restrict-latest 1
       ```

      does not print latest JDK17 package in the CV/LE, but latest JDK17 package on whole Satellite - this is hard to identify as wrong output!

              Unassigned Unassigned
              rhn-support-pmoravec Pavel Moravec
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: