Bug 1004956 - The yum distributor assumes that a distributor config has a "relative_url" setting
Summary: The yum distributor assumes that a distributor config has a "relative_url" se...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: rpm-support
Version: Master
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: 2.4.0
Assignee: Mike McCune
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-05 20:35 UTC by Randy Barlow
Modified: 2014-08-09 06:55 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-09 06:55:20 UTC
Embargoed:


Attachments (Terms of Use)

Description Randy Barlow 2013-09-05 20:35:46 UTC
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 20:01:54 UTC
This has been fixed as part of the new yum distributor

Comment 3 Jeff Ortel 2014-04-03 13:36:21 UTC
build: 2.4.0-0.7.beta

Comment 4 Preethi Thomas 2014-04-16 13:36:02 UTC
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 06:55:20 UTC
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.