Bug 1337010 - /katello/api/organizations/:organization_id/environments/:id/repositories returns 404 error
Summary: /katello/api/organizations/:organization_id/environments/:id/repositories ret...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.2.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: Unspecified
Assignee: Zach Huntington-Meath
QA Contact: Lukas Pramuk
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-18 02:49 UTC by Geoff Gatward
Modified: 2019-09-26 14:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 15159 0 None None None 2016-07-18 22:05:37 UTC

Description Geoff Gatward 2016-05-18 02:49:08 UTC
Description of problem:
/apidoc details method to return a list of all repositories within an environment:
GET /katello/api/organizations/:organization_id/environments/:id/repositories

When trying to use this call a page not found error is displayed
(organization_id:1  id:1

https://sat62.example.org/katello/api/organizations/1/environments/1/repositories

Leaving 'repositories' off the end returns the SUMMARY of the environment:
https://sat62.example.org/katello/api/organizations/1/environments/1
{
  "library": true,
  "id": 1,
  "name": "Library",
  "label": "Library",
  "description": null,
  "organization": {
    "name": "Default Organization",
    "label": "Default Organization",
    "id": 1
  },
  "created_at": "2016-05-02 05:25:32 UTC",
  "updated_at": "2016-05-02 05:25:32 UTC",
  "prior": null,
  "successor": null,
  "counts": {
    "content_hosts": 0,
    "content_views": 0,
    "packages": 94200,
    "puppet_modules": 4235,
    "errata": {
      "security": 2667,
      "bugfix": 7582,
      "enhancement": 2674,
      "total": 15737
    },
    "yum_repositories": 38,
    "docker_repositories": 0,
    "ostree_repositories": 1,
    "products": 16
  },
  "permissions": {
    "view_lifecycle_environments": true,
    "edit_lifecycle_environments": true,
    "destroy_lifecycle_environments": false,
    "promote_or_remove_content_views_to_environments": true
  }
}

Tried /yum_repositories with same result (404 error).

Need to be able to list the repos in an environment as per the docs.

Comment 2 Zach Huntington-Meath 2016-07-18 21:04:26 UTC
Connecting redmine issue http://projects.theforeman.org/issues/15159 from this bug

Comment 4 Lukas Pramuk 2017-08-30 20:36:18 UTC
VERIFIED.

@satellite-6.3.0-16.0.beta.el7sat.noarch
foreman-1.15.3-2.el7sat.noarch
katello-3.4.4-2.el7sat.noarch


# curl -sku admin:changeme https://SAT/katello/api/organizations/1/environments/1/repositories | jq .
{
  "total": 8,
  "subtotal": 8,
  "page": 1,
  "per_page": 20,
  "error": null,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "content_type": "yum",
      "url": "http://SERVER/pulp/repos/Sat6-CI/QA/Capsule_6_3_RHEL7/custom/Satellite_Capsule_6_3_Composes/Satellite_Capsule_6_3_RHEL7/",
      "relative_path": "Default_Organization/Library/custom/Internal_RHEL7/Capsule_6_3_RHEL7_x86_64",
      "backend_identifier": "aa6f9796-8436-477a-a5bd-d180eb912388",
      "id": 2,
      "name": "Capsule 6.3 RHEL7 x86_64",
      "label": "Capsule_6_3_RHEL7_x86_64",
      "product": {
        "id": 1,
        "cp_id": "873853518190",
        "name": "Internal_RHEL7",
        "sync_plan": [
          "name",
          "description",
          "sync_date",
          "interval",
          "next_sync"
        ]
      },
      "last_sync": {
        "id": "21b855a5-0336-432e-bd3d-0090c3a79477",
        "username": "admin",
        "started_at": "2017-08-29 11:43:31 UTC",
        "ended_at": "2017-08-29 11:43:43 UTC",
        "state": "stopped",
        "result": "success",
        "progress": 1
      },
      "content_counts": {
        "ostree_branch": 0,
        "docker_manifest": 0,
        "docker_tag": 0,
        "rpm": 186,
        "package": 186,
        "package_group": 1,
        "erratum": 0,
        "puppet_module": 0,
        "file": 0
      },
      "last_sync_words": "1 day"
    },
...

>>> the api call no longer returns 404

Comment 5 Daniel Lobato Garcia 2018-01-20 13:07:10 UTC
For 6.2.z users, notice you can call the API at 'katello/api/v2/repositories?environment_id=6&organization_id=32' (substitute by the right numbers) and get the results you expected at /api/orgnaizations/:organization_id/environments/:id/repositories

All the bugfix is doing is redirect one API call to the other, so they're equivalent.

Comment 6 Satellite Program 2018-02-21 16:54:37 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, 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-2018:0336


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