Project

Profile

Help

Issue #3449

closed

Requesting content from nested distribution path results in 500 error

Added by daviddavis over 6 years ago. Updated over 5 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

In #3448, we agreed to add documentation as a stopgap solution for the distribution basepath overlap problem. However, it looks like if you do proceed to overlap basepaths, you get an error:

Mar 09 18:04:04 pulp3.dev pulp[19680]: django.request:ERROR: Internal Server Error: /content/foo/bar/test.iso
Traceback (most recent call last):
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/vagrant/devel/pulp/pulpcore/pulpcore/app/views/content.py", line 210, in get
    storage_path = self._match(path)
  File "/home/vagrant/devel/pulp/pulpcore/pulpcore/app/views/content.py", line 97, in _match
    distribution = self._match_distribution(path)
  File "/home/vagrant/devel/pulp/pulpcore/pulpcore/app/views/content.py", line 73, in _match_distribution
    return Distribution.objects.get(base_path__in=base_paths)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/vagrant/.virtualenvs/pulp/lib64/python3.5/site-packages/django/db/models/query.py", line 384, in get
    (self.model._meta.object_name, num)
pulpcore.app.models.publication.MultipleObjectsReturned: get() returned more than one Distribution -- it returned 2!

Relevant bit of code:

https://github.com/pulp/pulp/blob/3.0-dev/pulpcore/pulpcore/app/views/content.py#L73

A few possible solutions:

1. Solve #3051
2. Change get() on line 73 to first()
3. Do nothing except update the documentation with a warning (#3448) and tell users "I told you so"


Related issues

Related to Pulp - Task #3448: Warn users that distributor base paths should not overlapCLOSED - CURRENTRELEASEdaviddavis

Actions
Related to Pulp - Task #3051: Prevent Distribution base_path overlap in the data modelCLOSED - DUPLICATE

Actions

Also available in: Atom PDF