Bug 1004956 - The yum distributor assumes that a distributor config has a "relative_url" setting
The yum distributor assumes that a distributor config has a "relative_url" se...
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: rpm-support (Show other bugs)
Master
All All
medium Severity medium
: ---
: 2.4.0
Assigned To: Mike McCune
Preethi Thomas
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-05 16:35 EDT by Randy Barlow
Modified: 2014-08-09 02:55 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-09 02:55:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Randy Barlow 2013-09-05 16:35:46 EDT
I mistakenly attempted to create a repo with the same feed path as another repo without setting either repo's relative_url, and the client was unhappy about it:

$ pulp-admin rpm repo create --repo-id test-epoch --feed=https://grapefruit.rdu.redhat.com/pulp/repos/content/dist/rhel/server/6/6Server/x86_64/os/
The server indicated one or more values were incorrect. The server provided the
following error message:

   Pulp exception occurred: PulpDataException

More information can be found in the client log file ~/.pulp/admin.log.

Skipping that admin.log and going straight for the kill in the server pulp.log, I found the culprit:

2013-09-05 16:29:23,750 pulp.server.managers.repo.distributor:ERROR: Exception received from distributor [yum_distributor] while validating config
Traceback (most recent call last):
  File "/home/rbarlow/devel/pulp/server/pulp/server/managers/repo/distributor.py", line 169, in add_distributor
    result = distributor_instance.validate_config(transfer_repo, call_config, config_conduit)
  File "/usr/lib/pulp/plugins/distributors/yum_distributor/distributor.py", line 220, in validate_config
    if item['config']["relative_url"] is not None:
KeyError: 'relative_url'

There are two problems here:

1a) We shouldn't use "relative_url" by name, but rather by the constant that represents it.
1b) I'm not sure about this one, but there may be a constant for "config" as well.

2) Not all configs are guaranteed to have a relative url, so we should check for its existence first.
Comment 1 Jason Connor 2013-11-13 15:01:54 EST
This has been fixed as part of the new yum distributor
Comment 3 Jeff Ortel 2014-04-03 09:36:21 EDT
build: 2.4.0-0.7.beta
Comment 4 Preethi Thomas 2014-04-16 09:36:02 EDT
verified
[root@pulp-24-server ~]# rpm -qa pulp-server
pulp-server-2.4.0-0.9.beta.el6.noarch
[root@pulp-24-server ~]# 

[root@pulp-24-server ~]# pulp-admin rpm repo create --repo-id rel-url --feed http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
The server indicated one or more values were incorrect. The server provided the
following error message:

   Relative URL [repos/pulp/pulp/demo_repos/zoo/] for repository [rel-url]
conflicts with existing relative URL [/repos/pulp/pulp/demo_repos/zoo/] for
repository [zoo]

More information can be found in the client log file ~/.pulp/admin.log.

[root@pulp-24-server ~]#
Comment 5 Randy Barlow 2014-08-09 02:55:20 EDT
This has been fixed in Pulp 2.4.0-1.

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