Bug 824940 - rhui-installer adds proxy configuration only to pulp.conf
Summary: rhui-installer adds proxy configuration only to pulp.conf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA
Version: 2.1
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: ---
Assignee: mkovacik
QA Contact: Martin Kočí
URL:
Whiteboard:
: 722245 (view as bug list)
Depends On:
Blocks: 848885
TreeView+ depends on / blocked
 
Reported: 2012-05-24 16:39 UTC by wes hayutin
Modified: 2012-08-24 13:27 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
By running rhui-installer, proxy configuration is only added to pulp.conf but it should be added to both rhui-tools.conf and pulp.conf. With the proxy setting edited in the answers file, and installer/answers.py fixed, the proxy configuration is added into both rhui-tools.conf and pulp-conf files
Clone Of:
: 848885 (view as bug list)
Environment:
Last Closed: 2012-08-24 11:54:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Disproving screen log (58.91 KB, text/plain)
2012-08-12 13:32 UTC, mkovacik
no flags Details
Disproving screen log 1 (4.99 KB, text/plain)
2012-08-15 21:30 UTC, mkovacik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2012:1205 0 normal SHIPPED_LIVE RHUI 2.1 Enhancement Update 2012-08-24 15:52:31 UTC

Description wes hayutin 2012-05-24 16:39:05 UTC
Description of problem:

This may not be an issue we want to fix.
It would probably be better to just remove the proxy config from the rhui-tools.conf and *only* use the settings in pulp.conf


[root@ip-10-190-47-101 ~]# rpm -qa | grep rhui
rh-rhui-tools-2.0.64-1.el6_2.noarch
rh-amazon-rhui-client-2.2.38-1.el6.noarch

Comment 1 wes hayutin 2012-05-24 19:29:22 UTC
k.. take it back.. the installer should add proxy config to both rhui-tools.conf and pulp.conf

Comment 2 James Slagle 2012-06-12 12:31:25 UTC
This will be resolved when bug #803379 is committed, looks like Wes already made a change to commit proxy settings to /etc/rhui/rhui-tools.conf as well.

Comment 3 James Slagle 2012-06-12 12:32:13 UTC
QA:
Add proxy settings to the answers file, run rhui-installer against the answers file and install the generated rh-rhua-config rpm.  Verify proxy settings that you specified in the answers file were applied to /etc/rhui/rhui-tools.conf

Comment 4 wes hayutin 2012-08-02 15:33:08 UTC
So neither the pulp proxy or rhua proxy settings should have been working.  Milan the proxy config in /etc/pulp/pulp.conf were getting set by the install script.. 

I think the following commit should resolve the issue:
commit d022f08889df8af73c600dd87b2d0ada15634dad


diff --git a/rhui-2.0/tools/src/rhui/rpm/rhua.py b/rhui-2.0/tools/src/rhui/rpm/rhua.py
index aa9addd..3f65e42 100644
--- a/rhui-2.0/tools/src/rhui/rpm/rhua.py
+++ b/rhui-2.0/tools/src/rhui/rpm/rhua.py
@@ -126,17 +126,17 @@ def _create_spec_file(config_dir, answers):
             'security', 'ssl_ca_certificate', '/etc/pki/rhua/rhua-ssl-ca-cert.crt',
     ]
 
-    if 'proxy_hostname' in answers:
-        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_hostname']]
+    if 'proxy_server_host' in answers:
+        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
 
-    if 'proxy_port' in answers:
-        args += ['yum', 'proxy_port', answers['proxy_port']]
+    if 'proxy_server_port' in answers:
+        args += ['yum', 'proxy_port', answers['proxy_server_port']]
 
-    if 'proxy_username' in answers:
-        args += ['yum', 'proxy_user', answers['proxy_username']]
+    if 'proxy_server_username' in answers:
+        args += ['yum', 'proxy_user', answers[' proxy_server_username']]
 
-    if 'proxy_password' in answers:
-        args += ['yum', 'proxy_pass', answers['proxy_password']]
+    if 'proxy_server_password' in answers:
+        args += ['yum', 'proxy_pass', answers['proxy_server_password']]
 
     spec = spec.replace('!PULP_CONFIGURATOR!', ' '.join(args))

Comment 5 Martin Kočí 2012-08-03 10:21:32 UTC
Now I see the bug is modified, so just FYI at this moment: It doesn't work for me as desired, because the /etc/pulp/pulp.conf have been set by install script, but the /etc/rhui/rhui-tools.conf is not set..

file answers:
....
proxy_server_host: koca.example.com
# proxy_server_port: 443
...

file /etc/rhui/rhui-tools.conf:
...
# Uncomment and set the following attributes to use a proxy to connect to Red Hat.
# proxy_url:
# proxy_port:
...

file /etc/pulp/pulp.conf:
..
proxy_url = http://koca.example.com
...



/root/RHEL-6.3-RHUI-2.1-20120801.0-Server-x86_64-DVD1.iso

Comment 6 wes hayutin 2012-08-07 15:27:53 UTC
*** Bug 722245 has been marked as a duplicate of this bug. ***

Comment 8 mkovacik 2012-08-12 13:32:36 UTC
Created attachment 603774 [details]
Disproving screen log

The status in build RHEL-6.3-RHUI-2.1-20120810.1-Server-x86_64-DVD1.iso is that the rhua proxy configuration isn't propagated at all. See the screen log attached.
I tried with all-, URL+port- and URL-proxy attributes increasing the config rpm version with negative result in each case...

Comment 9 wes hayutin 2012-08-13 16:18:57 UTC
This is very odd...

Here is a copy of my answers file...
Note the key name of the proxy parameters.. Then notice what the proxy parameter name is in the debug statement.. they don't match

[root@ip-10-191-15-154 ~]# cat answers21x.txt 
[general]
version: 2.0
dest_dir: /tmp/rhui
qpid_ca: /etc/rhui/qpid/ca.crt
qpid_client: /etc/rhui/qpid/client.crt
qpid_nss_db: /etc/rhui/qpid/nss
[rhua]
rpm_name: rh-rhua-config
hostname: ip-10-191-15-154.ec2.internal
ssl_cert: /root/pem/ip-10-191-15-154.ec2.internal.crt
ssl_key: /root/pem/server.key
ca_cert: /root/pem/ca.crt
proxy_server_host: test01.example.com
proxy_server_port: 443
proxy_server_username: admin
proxy_server_password: password
[cds-1]
rpm_name: rh-cds1-config
hostname: ip-10-8-26-148.ec2.internal
ssl_cert: /root/pem/ip-10-8-26-148.ec2.internal.crt
ssl_key: /root/pem/server.key
[cds-2]
rpm_name: rh-cds2-config
hostname: ip-10-191-157-226.ec2.internal
ssl_cert: /root/pem/ip-10-191-157-226.ec2.internal.crt
ssl_key: /root/pem/server.key
[cds-3]
rpm_name: rh-cds3-config
hostname: ip-10-6-5-92.ec2.internal
ssl_cert: /root/pem/ip-10-6-5-92.ec2.internal.crt
ssl_key: /root/pem/server.key


[root@ip-10-191-15-154 ~]# rhui-installer --debug answers21x.txt 
Generating RHUA configuration RPM
> /usr/lib/python2.6/site-packages/rhui/rpm/rhua.py(130)_create_spec_file()
-> if 'proxy_server_host' in answers:
(Pdb) l
125  	            'security', 'cacert', '/etc/pki/rhua/user-ca-cert.crt',
126  	            'security', 'cakey', '/etc/pki/rhua/user-ca-key.pem',
127  	            'security', 'ssl_ca_certificate', '/etc/pki/rhua/rhua-ssl-ca-cert.crt',
128  	    ]
129  	    pdb.set_trace()
130  ->	    if 'proxy_server_host' in answers:
131  	        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
132  	
133  	    if 'proxy_server_port' in answers:
134  	        args += ['yum', 'proxy_port', answers['proxy_server_port']]
135  	
(Pdb) n
> /usr/lib/python2.6/site-packages/rhui/rpm/rhua.py(133)_create_spec_file()
-> if 'proxy_server_port' in answers:
(Pdb) l
128  	    ]
129  	    pdb.set_trace()
130  	    if 'proxy_server_host' in answers:
131  	        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
132  	
133  ->	    if 'proxy_server_port' in answers:
134  	        args += ['yum', 'proxy_port', answers['proxy_server_port']]
135  	
136  	    if 'proxy_server_username' in answers:
137  	        args += ['yum', 'proxy_user', answers[' proxy_server_username']]
138  	
(Pdb) pp answers
{'ca_cert': '/root/pem/ca.crt',
 'dest_dir': '/tmp/rhui',
 'hostname': 'ip-10-191-15-154.ec2.internal',
 'proxy_hostname': 'test01.example.com',
 'proxy_password': 'password',
 'proxy_port': '443',
 'proxy_username': 'admin',
 'qpid_ca': '/etc/rhui/qpid/ca.crt',
 'qpid_client': '/etc/rhui/qpid/client.crt',
 'qpid_nss_db': '/etc/rhui/qpid/nss',
 'rpm_name': 'rh-rhua-config',
 'rpm_version': '2.0',
 'ssl_cert': '/root/pem/ip-10-191-15-154.ec2.internal.crt',
 'ssl_key': '/root/pem/server.key'}
(Pdb) q


Looking into this... seems odd to me that the param name has changed after we read it in

Comment 10 wes hayutin 2012-08-13 16:22:21 UTC
The issue is in installer/answers.py
starting at line 72

    # RPM version override
    if parser.has_option('rhua', 'version'):
        bundle['rpm_version'] = parser.get('rhua', 'version')

    # Proxy information
    if parser.has_option('rhua', 'proxy_server_host'):
        bundle['proxy_hostname'] = parser.get('rhua', 'proxy_server_host')

    if parser.has_option('rhua', 'proxy_server_port'):
        bundle['proxy_port'] = parser.get('rhua', 'proxy_server_port')

    if parser.has_option('rhua', 'proxy_server_username'):
        bundle['proxy_username'] = parser.get('rhua', 'proxy_server_username')

    if parser.has_option('rhua', 'proxy_server_password'):
        bundle['proxy_password'] = parser.get('rhua', 'proxy_server_password')

    return bundle

Comment 11 wes hayutin 2012-08-13 17:03:02 UTC
commit d9f31aa2e03756bb75230070356258ebd956befd
commit 9263b5fd14852f428cf57989cb83abea70e77b9d (forgot to save file)

diff --git a/rhui-2.0/tools/src/rhui/rpm/rhua.py b/rhui-2.0/tools/src/rhui/rpm/rhua.py
index eb66734..1dc2f87 100644
--- a/rhui-2.0/tools/src/rhui/rpm/rhua.py
+++ b/rhui-2.0/tools/src/rhui/rpm/rhua.py
@@ -126,39 +126,15 @@ def _create_spec_file(config_dir, answers):
             'security', 'cakey', '/etc/pki/rhua/user-ca-key.pem',
             'security', 'ssl_ca_certificate', '/etc/pki/rhua/rhua-ssl-ca-cert.crt',
     ]
-
-    if 'proxy_server_host' in answers:
-        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
-
-    if 'proxy_server_port' in answers:
-        args += ['yum', 'proxy_port', answers['proxy_server_port']]
-
-    if 'proxy_server_username' in answers:
-        args += ['yum', 'proxy_user', answers['proxy_server_username']]
-
-    if 'proxy_server_password' in answers:
-        args += ['yum', 'proxy_pass', answers['proxy_server_password']]
-
+    args = _proxy_config(args, answers)
     spec = spec.replace('!PULP_CONFIGURATOR!', ' '.join(args))
     # PULP.CONF 
+    
     # RHUI-TOOLS.CONF
     args = [ 
             'rhua', 'hostname', answers['hostname'],
     ]
-    
-    if 'proxy_server_host' in answers:
-        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
-
-    if 'proxy_server_port' in answers:
-        args += ['yum', 'proxy_port', answers['proxy_server_port']]
-
-    if 'proxy_server_username' in answers:
-        args += ['yum', 'proxy_user', answers['proxy_server_username']]
-
-    if 'proxy_server_password' in answers:
-        args += ['yum', 'proxy_pass', answers['proxy_server_password']]
-
-    
+    args = _proxy_config(args, answers)
     spec = spec.replace('!RHUI_CONFIGURATOR!', ' '.join(args))
     # RHUI-TOOLS.CONF
 
@@ -173,6 +149,21 @@ def _create_spec_file(config_dir, answers):
 
     return dest_spec_filename
 
+def _proxy_config(args, answers):
+
+    if 'proxy_server_host' in answers:
+        args += ['yum', 'proxy_url', 'http://%s' % answers['proxy_server_host']]
+
+    if 'proxy_server_port' in answers:
+        args += ['yum', 'proxy_port', answers['proxy_server_port']]
+
+    if 'proxy_server_username' in answers:
+        args += ['yum', 'proxy_user', answers['proxy_server_username']]
+
+    if 'proxy_server_password' in answers:
+        args += ['yum', 'proxy_pass', answers['proxy_server_password']]
+    return args
+
 def _do_configurator(rpm_builder, config_dir):


diff --git a/rhui-2.0/tools/src/rhui/installer/answers.py b/rhui-2.0/tools/src/rhui/installer/answers.py
index 25f4a60..75426e3 100644
--- a/rhui-2.0/tools/src/rhui/installer/answers.py
+++ b/rhui-2.0/tools/src/rhui/installer/answers.py
@@ -75,16 +75,16 @@ def _parse_rhua(parser):
 
     # Proxy information
     if parser.has_option('rhua', 'proxy_server_host'):
-        bundle['proxy_hostname'] = parser.get('rhua', 'proxy_server_host')
+        bundle['proxy_server_host'] = parser.get('rhua', 'proxy_server_host')
 
     if parser.has_option('rhua', 'proxy_server_port'):
-        bundle['proxy_port'] = parser.get('rhua', 'proxy_server_port')
+        bundle['proxy_server_port'] = parser.get('rhua', 'proxy_server_port')
 
     if parser.has_option('rhua', 'proxy_server_username'):
-        bundle['proxy_username'] = parser.get('rhua', 'proxy_server_username')
+        bundle['proxy_server_username'] = parser.get('rhua', 'proxy_server_username')
 
     if parser.has_option('rhua', 'proxy_server_password'):
-        bundle['proxy_password'] = parser.get('rhua', 'proxy_server_password')
+        bundle['proxy_server_password'] = parser.get('rhua', 'proxy_server_password')
 
     return bundle

Comment 12 mkovacik 2012-08-15 21:30:43 UTC
Created attachment 604697 [details]
Disproving screen log 1

Unfortunately, the patch doesn't work well for following scenario:
- in rhui-installer config file set:
 - proxy_url
 - proxy_port
 - proxy_user
 - proxy_name
- generate & install rh-rhua-config rpm
- in rhui-installer config file set
 - increased version nr.
 - proxy_url
 - proxy_port
- generate & install rh-rhua-config rpm
- the proxy user and password options are still present in both the /etc/rhui/rhui-tools.conf and /etc/pulp/pulp.conf files.

Version: rh-rhui-tools: 2.1.10
Build: RHEL-6.3-RHUI-2.1-20120815.0-Server-x86_64-DVD1.iso

Comment 13 wes hayutin 2012-08-15 22:04:06 UTC
Milan you are demonstrating an issue/bug that is preexisting w/ any of the config values. 

In the case that options are removed.. the user will have to update the config files themselves.  The proxy config options work the same as any other config option.

The spec file does not create a clean version of the config files.  It's a valid bug, but a new bug.. not  specific to the proxy configuration.  IMHO a new bug should be entered against 2.1.1

Comment 14 Julie 2012-08-16 06:21:00 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
By running rhui-installer, proxy configuration is only added to pulp.conf but it should be added to both rhui-tools.conf and pulp.conf. With the proxy setting edited in the answers file, and  installer/answers.py fixed, the proxy configuration is added into both rhui-tools.conf and pulp-conf files

Comment 15 mkovacik 2012-08-16 17:27:35 UTC
(In reply to comment #13)
> Milan you are demonstrating an issue/bug that is preexisting w/ any of the
> config values. 
> 
> In the case that options are removed.. the user will have to update the
> config files themselves.  The proxy config options work the same as any
> other config option.
> 
> The spec file does not create a clean version of the config files.  It's a
> valid bug, but a new bug.. not  specific to the proxy configuration.  IMHO a
> new bug should be entered against 2.1.1

Very well. Based on your comment and mine (comment 12 and attachment 604697 [details]) we may consider this one verified.

Comment 17 errata-xmlrpc 2012-08-24 11:54:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2012-1205.html


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