Bug 248319

Summary: rhn-custom-info broken on Satellite 5.0.0
Product: Red Hat Satellite 5 Reporter: Colin Coe <colin.coe>
Component: Configuration ManagementAssignee: Clifford Perry <cperry>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: medium Docs Contact:
Priority: medium    
Version: 500CC: cperry, rhn-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat501 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-29 15:35:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Contents of exception email (sanitized) none

Description Colin Coe 2007-07-16 00:30:45 UTC
Description of problem:
Since upgrading to Satellite 5.0.0 from 4.2.1 rhn-custom-info is broken on the
clients

Version-Release number of selected component (if applicable):
5.0.0

How reproducible:
On a registered client, running 'rhn-custom-info -l -u user -p PassWord' results
in an exception email.

Steps to Reproduce:
1. Logon to client
2. with root privileges, run 'rhn-custom-info -l -u user -p PassWord'
  
Actual results:
Error code:  -1
Unhandled exception

Expected results:
It should update the systems custom info

Additional info:

Comment 1 Colin Coe 2007-07-16 00:30:45 UTC
Created attachment 159285 [details]
Contents of exception email (sanitized)

Comment 2 Clifford Perry 2007-07-16 14:29:14 UTC
[root@rlx-1-14 conf]# cd /var/www/html/
[root@rlx-1-14 conf]# grep -ir WEBRPC *
rhnweb.conf:Alias /WEBRPC "/var/www/html/rpc"
[root@rlx-1-14 conf]# cd /var/www/html/rpc/
[root@rlx-1-14 rpc]# ls
api  api-defs  manzier.pxt  recent-errata.pxt
[root@rlx-1-14 rpc]# more api
<pxt-passthrough>
  <pxt-use class="Sniglets::API" />
  <pxt-use class="Grail::Frame" />

  <grail-canvas-template base="/templates/c.pxt" mode="main_canvas">
    <h1><a href="/rpc/api">API Overview</a></h1>

    <rhn-interface-tree />
  </grail-canvas-template>
</pxt-passthrough>
[root@rlx-1-14 rpc]#
[root@rlx-1-14 rpc]# cd /usr/lib/perl5/site_perl/5.8.5/Sniglets/API
[root@rlx-1-14 API]# ls
API.pm  Auth.pm  Channel  Channel.pm  Errata.pm  Package.pm  Proxy.pm 
Satellite.pm  System.pm  Test.pm  User.pm
[root@rlx-1-14 API]#

Everything is the same for a 4.2.1 and 5.0 Satellite, except for the missing
Sniglets::API code - we removed the old perl API code out of Satellite 5.0,
since the API was re-written into Java during the 4.1 Satellite stage. It seems
we missed a step in our validation of usage prior to removing the code. Will
hopefully have something further for you soon.


Comment 3 Clifford Perry 2007-07-16 14:37:03 UTC
    try:
        session = s.auth.login(options.username, options.password)

        if options.list_values:
            ret = s.system.get_custom_values(session, sid)
        else:
            ret = s.system.set_custom_values(session, sid, values)


Review of rhn-customer-info package and the API calls it uses, they seem to be
converted into Java, its API has auth.login, system.get_custom_values,
system.set_custom_values. 

So it should work... just set the apache alias to point to the main API location
maybe... will test and give feedback

Comment 4 Clifford Perry 2007-07-16 15:07:09 UTC
[root@rlx-1-12 conf]# diff -u rhnweb.conf-orig rhnweb.conf
--- rhnweb.conf-orig    2007-07-16 10:41:47.869958776 -0400
+++ rhnweb.conf 2007-07-16 10:50:45.160278232 -0400
@@ -1,5 +1,3 @@
-Alias /WEBRPC "/var/www/html/rpc"
-
 PerlTaintCheck Off

 PerlFixupHandler Apache::SizeLimit
@@ -50,3 +48,6 @@
 # slightly more Struts friendly.
 RewriteRule ^/kickstart/ks([a-zA-Z0-9/_-\%\ ]*)$
/rhn/kickstart/DownloadFile.do?ksurl=$1 [PT]
 RewriteRule ^/rpc/api /rhn/rpc/api [PT]
+# For rhn-custom-info
+RewriteRule ^/WEBRPC /rhn/rpc/api [PT]
+
[root@rlx-1-12 conf]#

This almost works, but I am getting an error message from the Java API when
trying to use the rhn-custom-info command:

Could not find translator for class java.lang.String to class java.lang.Integer


Seen within tomcat log file:

 7/16/07 10:51 AM  TP-Processor6  Error:
com.redhat.rhn.common.translation.TranslationException: Could not find
translator for class java.lang.String to class java.lang.Integer     at
com.redhat.rhn.common.translation.Translations.convert(Translations.java:65)
        at com.redhat.rhn.common.translation.Translator.convert(Translator.java:39)
        at com.redhat.rhn.frontend.xmlrpc.BaseHandler.invoke(BaseHandler.java:85)
        at marquee.xmlrpc.XmlRpcDispatcher.dispatch(XmlRpcDispatcher.java:171)
        at
com.redhat.rhn.frontend.xmlrpc.RhnXmlRpcServer.execute(RhnXmlRpcServer.java:43)
        at
com.redhat.rhn.frontend.xmlrpc.XmlRpcServlet.doPost(XmlRpcServlet.java:136)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:142)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58)


Comment 5 Clifford Perry 2007-07-16 15:18:47 UTC
Python's lose typing comes back again :)

Seems that the old perl API code was fine, but the new Java API code expects an
integer to be passed to it for API login's for system id (sid). Following change
to the client side rhn-custom-info command resolved the previous error message

[root@dhcp231-182 ~]# diff -u /usr/bin/rhn-custom-info /usr/bin/rhn-custom-info-new
--- /usr/bin/rhn-custom-info    2007-07-16 11:16:49.000000000 -0400
+++ /usr/bin/rhn-custom-info-new        2007-07-16 11:16:32.000000000 -0400
@@ -215,9 +215,9 @@
         session = s.auth.login(options.username, options.password)

         if options.list_values:
-            ret = s.system.get_custom_values(session, sid)
+            ret = s.system.get_custom_values(session, int(sid))
         else:
-            ret = s.system.set_custom_values(session, sid, values)
+            ret = s.system.set_custom_values(session, int(sid), values)

     except rpclib.Fault, e:
         system_exit(1, "Error code:  %s\n%s\n" % (e.faultCode, e.faultString))
[root@dhcp231-182 ~]#


Comment 6 Clifford Perry 2007-07-16 15:36:58 UTC
Testing the above change with a 4.2.1 Satellite, it worked without errors. I
will look to get the changes within comment #5 and #4 done with the next maint
release of Satellite 5.0, devel work for which has just started. 

Cliff. 

Comment 10 Colin Coe 2007-07-23 11:35:11 UTC
I changed rhnweb.conf as per comment 4 and also /usr/bin/rhn-custom-info as per 
comment 3.  All seems OK on RHEL5 but I got python errors in RHEL3.  The EL3 
box didn't even get to talk to the Sat server before dying.  I'll post the 
errors when I get to work in a few hours.

Comment 11 Clifford Perry 2007-07-27 15:31:17 UTC
I have not seen the errors mentioned in comment #10 posted. 

Testing a RHEL 3 client, with built package - for myself, it seems to be working
fine. 

[root@rlx-1-10 rhn]# rpm -q redhat-release python rhn-custom-info
redhat-release-3AS-7.3
python-2.2.3-5
rhn-custom-info-5.0.0-3.el3
[root@rlx-1-10 rhn]# grep int /usr/bin/rhn-custom-info 
            ret = s.system.get_custom_values(session, int(sid))
            ret = s.system.set_custom_values(session, int(sid), values)
            print "%s\t%s" % (key, ret[key])
[root@rlx-1-10 rhn]# 
[root@rlx-1-10 rhn]# rhn-custom-info -l -uadmin
Password: 
test1   Hello world!
[root@rlx-1-10 rhn]# rhn-custom-info test1 "foobar meep"
Red Hat Network username: admin
Password: 
[root@rlx-1-10 rhn]# rhn-custom-info -l -uadmin
Password: 
test1   foobar meep
[root@rlx-1-10 rhn]#

Comment 12 Clifford Perry 2007-07-27 15:55:55 UTC
Docs - for Release Notes - can we have a none saying that to have the fix to get
rhn-custom-info working correctly within Satellite 5.0.1 - they will want the
new rhn-custom-info client side packages, plus the new rhn-satellite-config
package. To make the config setting take effect the customer will need to run
the following commands:

# cp /etc/sysconfig/rhn-satellite-prep/etc/httpd/conf/rhnweb.conf
/etc/httpd/conf/rhnweb.conf
# service httpd restart

This will require some downtime while the Apache service restarts


New installs/upgrades (to Satellite 5.0) of 5.0.1 ISO will have the right config
file within the right place on installation. 

Customers currently running 5.0.0 Satellite who 'up2date -u' the package will
have to perform above to deploy config file in right place. 

Cliff

Comment 13 John Ha 2007-08-02 22:49:19 UTC
Thanks for the note, Cliff. Let me know if the following makes sense and if it
needs any changes:

 Users who upgrade to Red Hat Network Satellite 5.0.1 via the `update -u`
 command may encounter an issue that prevents rhn-custom-info from working
 correctly. To correct this issue, you must also install the rhn-custom-info
 client-side packages, as well as the new rhn-satellite-config package. After
 installing the packages, run the following commands:

  cp /etc/sysconfig/rhn-satellite-prep/etc/httpd/conf/rhnweb.conf
/etc/httpd/conf/rhnweb.conf
  service httpd restart

 Customers who use the ISO to perform installations of Red Hat Network
 5.0.1 or upgrades from 5.0.0 will have the rhnweb.conf file in the
 correct location upon installation. 

Comment 14 Clifford Perry 2007-08-03 15:00:35 UTC
Sounds good, except:

 Customers who use the ISO to perform installations of Red Hat Network
 5.0.1 or upgrades from 5.0.0 will have the rhnweb.conf file in the
 correct location upon installation. 

Change the 'from' to a 'to', and 5.0.0 to 5.0 - upgrades to 5.0. This is because
you upgrade from say 4.2 to 5.0 Satellite. 

So, suggest:

 Customers who use the ISO to perform installations of Red Hat Network
 5.0.1 or upgrades to 5.0 will have the rhnweb.conf file in the
 correct location upon installation. 

Cliff. 

Comment 15 wes hayutin 2007-08-03 17:37:03 UTC
fails qa on rhel4

[root@fjs-0-19 ~]#  rpm -q redhat-release python rhn-custom-info
redhat-release-4AS-6.1
python-2.3.4-14.4
rhn-custom-info-5.0.0-3.el4
[root@fjs-0-19 ~]# grep int /usr/bin/rhn-custom-info 
            ret = s.system.get_custom_values(session, int(sid))
            ret = s.system.set_custom_values(session, int(sid), values)
            print "%s\t%s" % (key, ret[key])
[root@fjs-0-19 ~]# rhn-custom-info -l -uadmin
/usr/lib/python2.3/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
Password: 
Error code:  -1
Unhandled exception



Comment 16 wes hayutin 2007-08-03 20:06:16 UTC
Last login: Fri Aug  3 13:14:39 2007 from whayutin.rdu.redhat.com

RHN kickstart on 2007-07-17

[root@fjs-0-19 ~]# rhn-custom-info -l
/usr/lib/python2.3/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
Red Hat Network username: admin
Password: 
Error code:  -1
Unhandled exception

[root@fjs-0-19 ~]# grep -i serverurl /etc/sysconfig/rhn/up2date
useNoSSLForPackages[comment]=Use the noSSLServerURL for package, package list,
and header fetching
noSSLServerURL[comment]=Remote server URL without SSL
noSSLServerURL=http://xmlrpc.rhn.redhat.com/XMLRPC
serverURL[comment]=Remote server URL
serverURL=http://rlx-3-06.rhndev.redhat.com/XMLRPC
disallowConfChanges=noReboot;sslCACert;useNoSSLForPackages;noSSLServerURL;serverURL;disallowConfChanges;
[root@fjs-0-19 ~]# rhn-custom-info -l
/usr/lib/python2.3/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
Red Hat Network username: admin
Password: 
No custom values set for this system.



This fix is to make sure that..
/etc/httpd/conf has the java api and not the perl api..

[root@rlx-3-06 ~]# grep -i webrpc /etc/httpd/conf/*
/etc/httpd/conf/rhnweb.conf:Alias /WEBRPC "/var/www/html/rpc"

SHOULD BE: 

[root@rlx-3-06 ~]# grep -i webrpc /etc/httpd/conf/*
/etc/httpd/conf/rhnweb.conf:RewriteRule ^/WEBRPC /rhn/rpc/api [PT]

AS described in comment #13


Comment 17 wes hayutin 2007-08-03 20:08:24 UTC
oops.. need to double check rhel3 and rhel5.. moving back to on_qa

Comment 18 wes hayutin 2007-08-06 17:04:58 UTC
Getting a deprecation warning.. just want to make sure its ok.
Cliff, is the python deprecation warning we are getting in rhel4 and rhel5
acceptable? 

[root@rlx-2-12 rhn]# rhn-custom-info -l -uadmin
/usr/lib/python2.4/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
Password: 
No custom values set for this system.


/usr/lib/python2.3/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
Password: 
No custom values set for this syste

Comment 20 wes hayutin 2007-08-06 17:49:16 UTC
verified

Comment 21 wes hayutin 2007-08-22 20:21:46 UTC
[root@rlx-3-18 ~]# rhn-custom-info -l -u admin -p dog8code
/usr/lib/python2.3/optik.py:8: DeprecationWarning: the optik interface is
deprecated; please use optparse instead
  DeprecationWarning)
No custom values set for this system.

release pending