Bug 878548

Summary: Proxy information for the yum importer needs to be able to be defaulted in plugin conf file
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: rpm-supportAssignee: Jay Dobies <jason.dobies>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.0.6CC: jsherril
Target Milestone: ---   
Target Release: Sprint 42   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-07 14:12:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 854726    

Description Jay Dobies 2012-11-20 16:48:23 UTC
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 17:13:49 UTC
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 22:20:03 UTC
build: 2.0.6-0.3.beta

Comment 3 Jay Dobies 2012-11-27 14:00:44 UTC
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 16:46:14 UTC
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 20:39:58 UTC
*** Bug 866621 has been marked as a duplicate of this bug. ***

Comment 6 Preethi Thomas 2013-01-07 14:12:07 UTC
Pulp 2.0 released.