Project

Profile

Help

Story #6570

as a plugin writer, my custom content handler can handle requests for CONTENT_PATH_PREFIX

Added by dkliban@redhat.com 4 months ago. Updated 3 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:

Description

Motivation

Plugins that need to have some custom logic for serving content can provide a custom content Handler. Up till now, each plugin that needed a custom handler, did so because it needed to provide an API that was rooted somewhere other than CONTENT_PATH_PREFIX[0].

The RPM plugin wants to provide a repo.config file that is dynamically generated based on the distribution's 'base_path' and 'base_url'[1] . It does not need to serve an API rooted at a different path.

Implemenation

  1. Add a hook method to BaseDistribution named content_handler() which would provide a no-op as it's base functionality and return None by default. It would take subpath as the single param and that would be the url portion after the distribution's base_path (the remaining part).
  2. In the content app just after the Distribution is matched and permit() is called we have the content app call this new content_handler. That would roughly be here.
  3. If the content_handler(subpath) returns a subclass of aiohttp.web.Response(...) then return that and don't continue to call the rest of the code in the content app.

[0] https://docs.pulpproject.org/settings.html#content-path-prefix [1] https://pulp.plan.io/issues/5356


Related issues

Related to RPM Support - Story #5356: As a user, I can download a configuration for yum/dnf from an RpmDistributionCLOSED - CURRENTRELEASE

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 70559c92 View on GitHub
Added by Pieter Lexis 3 months ago

Implement content_handler for BaseDistribution

This allows Plugin writers to serve non-Artifact content.

ref #6570

Revision a0fce1f1 View on GitHub
Added by Pieter Lexis 3 months ago

Add content_handler_directory_listing in Dist

This allows plugin writers to add files served by content_handler to show up in the directory listings.

ref #6570

Revision 6563722b View on GitHub
Added by Pieter Lexis 3 months ago

Add documentation for content_handler

closes #6570

History

#1 Updated by dkliban@redhat.com 4 months ago

  • Tracker changed from Issue to Story
  • % Done set to 0

#2 Updated by dkliban@redhat.com 4 months ago

  • Related to Story #5356: As a user, I can download a configuration for yum/dnf from an RpmDistribution added

#3 Updated by Anonymous 3 months ago

  • Status changed from NEW to MODIFIED
  • % Done changed from 0 to 100

#4 Updated by dkliban@redhat.com 3 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
  • Sprint/Milestone set to 3.4.0

Please register to edit this issue

Also available in: Atom PDF