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 2218179 - The "reclaim_space" API endpoint mentioned for external capsules are wrong in API doc.
Summary: The "reclaim_space" API endpoint mentioned for external capsules are wrong in...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Capsule - Content
Version: 6.13.1
Hardware: All
OS: All
high
medium
Target Milestone: 6.15.0
Assignee: satellite6-bugs
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-28 11:16 UTC by Sayan Das
Modified: 2024-04-23 17:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-04-23 17:11:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36545 0 Normal Closed The "POST /katello/api/capsules/:id/reclaim_space" endpoint is wrong 2023-09-08 11:05:41 UTC
Red Hat Issue Tracker SAT-18674 0 None None None 2023-06-28 13:04:21 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:11:34 UTC

Description Sayan Das 2023-06-28 11:16:49 UTC
Description of problem:

Accessing https://<satellite or katello URL>/apidoc/v2/capsule_content/reclaim_space.en.html

Lands me on the API

POST /katello/api/capsules/:id/reclaim_space

But this is the wrong endpoint and execution of the same leads to an "ActionController::RoutingError (No route matches" error. 


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

Satellite 6.13 ( 6.11\6.12\6.14 as well )


How reproducible:

Easily 


Steps to Reproduce:
1. Install a pair of satellite and capsule ( any of the versions mentioned above )

   Let the ID of satellite is 1 and external capsule is 2

2. Sync some data on capsule
3. Access the APIDOC to see the reclaim_space end point 

   https://<satellite URL?/apidoc/v2/capsule_content/reclaim_space.en.html

4. Try to use the API on satellite i.e. 

curl -ku admin:password -X POST -H "Content-Type:application/json" https://`hostname -f`/katello/api/capsules/2/reclaim_space


Actual results:

curl error:
~~
<!DOCTYPE html>
<html>
<head>
  <title>The page you were looking for doesn't exist (404)</title>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <style>
  body {
    background-color: #EFEFEF;
    color: #2E2F30;
    text-align: center;
    font-family: arial, sans-serif;
    margin: 0;
  }
~~


Production.log error:

~~
2023-06-28T16:42:23 [I|app|b95e340e] Started POST "/katello/api/capsules/2/reclaim_space" for X.X.Y.Z at 2023-06-28 16:42:23 +0530
2023-06-28T16:42:26 [F|app|b95e340e]   
 b95e340e | ActionController::RoutingError (No route matches [POST] "/katello/api/capsules/2/reclaim_space"):
 b95e340e |   
 b95e340e | lib/foreman/middleware/logging_context_request.rb:11:in `call'
 b95e340e | katello (4.7.0.25) lib/katello/prevent_json_parsing.rb:12:in `call'
~~


Expected results:

The endpoint should be 

POST /katello/api/capsules/:id/content/reclaim_space


Additional info:

Following fixes the issue i.e. 

diff --git a/app/controllers/katello/api/v2/capsule_content_controller.rb b/app/controllers/katello/api/v2/capsule_content_controller.rb
index f9a1516..4ab6426 100644
--- a/app/controllers/katello/api/v2/capsule_content_controller.rb
+++ b/app/controllers/katello/api/v2/capsule_content_controller.rb
@@ -87,7 +87,7 @@ module Katello
       end
     end
 
-    api :POST, '/capsules/:id/reclaim_space', N_('Reclaim space from all On Demand repositories on a smart proxy')
+    api :POST, '/capsules/:id/content/reclaim_space', N_('Reclaim space from all On Demand repositories on a smart proxy')
     param :id, :number, :required => true, :desc => N_('Id of the smart proxy')
     def reclaim_space
       find_capsule(true)

Comment 1 Sayan Das 2023-06-28 11:42:42 UTC
Created redmine https://projects.theforeman.org/issues/36545

Comment 2 Bryan Kearney 2023-06-28 20:03:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36545 has been resolved.

Comment 3 Vladimír Sedmík 2024-01-22 08:22:15 UTC
Verified in 6.15.0 snap 7.0. The APIDOC now points to the correct endpoint (POST /katello/api/capsules/:id/content/reclaim_space) and the endpoint works:

[root@sat ~]# curl -ku admin:changeme -X POST -H "Content-Type:application/json" https://`hostname -f`/katello/api/capsules/2/content/reclaim_space
  {"id":"c9031c06-c959-4908-b807-c975f5d54e5e","label":"Actions::Pulp3::CapsuleContent::ReclaimSpace","pending":true,"action":"Reclaim space","username":"admin","started_at":"2024-01-22 08:14:07 UTC","ended_at":null, ...

Reclaim space task was triggered.

Comment 6 errata-xmlrpc 2024-04-23 17:11:33 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.15.0 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-2024:2010


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