Bug 878548 - Proxy information for the yum importer needs to be able to be defaulted in plugin conf file
Proxy information for the yum importer needs to be able to be defaulted in pl...
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: rpm-support (Show other bugs)
2.0.6
Unspecified Unspecified
unspecified Severity unspecified
: ---
: Sprint 42
Assigned To: Jay Dobies
Preethi Thomas
:
: 866621 (view as bug list)
Depends On:
Blocks: katello-v2-pulp
  Show dependency treegraph
 
Reported: 2012-11-20 11:48 EST by Jay Dobies
Modified: 2013-01-07 09:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-07 09:12:07 EST
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 Jay Dobies 2012-11-20 11:48:23 EST
Each plugin can have a .conf file that applies to the plugin as a whole. There isn't one for the yum importer, but if there was the proxy information could be set there instead of on a per repo basis.

This bug is to add that file and have it included in the RPM.
Comment 1 Jay Dobies 2012-11-20 12:13:49 EST
Added empty conf files for the plugins in case we need to tell users to edit them in the future. I'd have liked to add comments about possible values, but comments aren't supported in JSON. If the proxy_* properties are in the file, they will be used by the plugin automatically.
Comment 2 Jeff Ortel 2012-11-20 17:20:03 EST
build: 2.0.6-0.3.beta
Comment 3 Jay Dobies 2012-11-27 09:00:44 EST
The conf file is in /usr/lib/pulp/plugins/importers/yum_importer, it's called yum_importer.conf. It's intentionally empty, which is an unfortunate side effect of JSON. Also be careful with the syntax since JSON is kinda fragile. If that's invalid, I'm not sure exactly where in pulp.log it will blow up, but it won't be too pretty.

The field names you'll care about are:
 proxy_url
 proxy_port
 proxy_user
 proxy_pass

Realistically, you don't have to worry about an authenticated proxy. If any one of these fields is accessed, they all can be. Here's an example for the contents of that file:

{
  "proxy_url" : "http://localhost/",
  "proxy_port" : "12345"
}

A few quick notes:
- I forget in JSON if you can omit the quotes on the port to make it an integer. Try both if you're seeing oddities.
- Not sure if this will be an issue for you, but in Python you can have a trailing comma on the last item in a dict like this (after the "12345"). This isn't allowed in JSON and always bites me, so I figured I'd mention it.

If you really want to go crazy, you can set a value in here and a different value for the repo in the CLI. The repo-level config should override, just for that repo, the values in this file.
Comment 4 Preethi Thomas 2012-11-27 11:46:14 EST
verified
[root@preethi-el6-pulp ~]# rpm -q pulp-server
pulp-server-2.0.6-0.9.beta.noarch
[root@preethi-el6-pulp ~]# 

[root@preethi-el6-pulp ~]# cat /usr/lib/pulp/plugins/importers/yum_importer/yum_importer.conf 
{
 "proxy_url" : "http://localhost/",
 "proxy_port" : "12345"
}
[root@preethi-el6-pulp ~]# pulp-admin rpm repo sync run --repo-id testerrata
+----------------------------------------------------------------------+
                 Synchronizing Repository [testerrata]
+----------------------------------------------------------------------+

This command may be exited by pressing ctrl+c without affecting the actual
operation on the server.

Downloading metadata...
[\]
... failed

[root@preethi-el6-pulp ~]vi /usr/lib/pulp/plugins/importers/yum_importer/yum_importer.conf 
[root@preethi-el6-pulp ~]# service httpd restartStopping httpd:                                            [  OK  ]
Starting httpd: [Tue Nov 27 08:45:00 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
                                                           [  OK  ]
[root@preethi-el6-pulp ~]# cat /usr/lib/pulp/plugins/importers/yum_importer/yum_importer.conf 
{
}
[root@preethi-el6-pulp ~]# pulp-admin rpm repo sync run --repo-id testerrata+----------------------------------------------------------------------+
                 Synchronizing Repository [testerrata]
+----------------------------------------------------------------------+

This command may be exited by pressing ctrl+c without affecting the actual
operation on the server.

Downloading metadata...
[-]
... completed

Downloading repository content...
[==================================================] 100%
RPMs:       0/0 items
Delta RPMs: 0/0 items
Tree Files: 0/0 items
Files:      0/0 items
... completed

Importing errata...
[-]
... completed

Importing package groups/categories...
[-]
... completed

Publishing packages...
[==================================================] 100%
Packages: 0/0 items
... completed

Publishing distributions...
[==================================================] 100%
Distributions: 3/3 items
... completed

Generating metadata
[\]
... completed

Publishing repository over HTTPS
[-]
... completed

Publishing repository over HTTP
[-]
... skipped
Comment 5 Jay Dobies 2012-11-27 15:39:58 EST
*** Bug 866621 has been marked as a duplicate of this bug. ***
Comment 6 Preethi Thomas 2013-01-07 09:12:07 EST
Pulp 2.0 released.

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