Project

Profile

Help

Story #6570

closed

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

Added by dkliban@redhat.com almost 4 years ago. Updated almost 4 years 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:
Quarter:

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

Actions

Also available in: Atom PDF