Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-18674 The "reclaim_space" API endpoint mentioned for external capsules are wrong in API doc.
  3. SAT-23898

[QE-auto] The "reclaim_space" API endpoint mentioned for external capsules are wrong in API doc.

XMLWordPrintable

    • Sprint 118, Sprint 125, Sprint 126, Sprint 127, Sprint 130, Sprint 131

      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)

      QE Tracker for https://issues.redhat.com/browse/SAT-18674
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2218179

              vsedmik@redhat.com Vladimír Sedmík
              satellite-focaccia-bot Focaccia Bot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: