Bug 531059 - Kickstart Profile Creation/Update results Internal Server Error (invalid character) due to cobbler
Summary: Kickstart Profile Creation/Update results Internal Server Error (invalid char...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Justin Sherrill
QA Contact: Garik Khachikyan
URL:
Whiteboard:
: 520055 (view as bug list)
Depends On:
Blocks: sat531-blockers
TreeView+ depends on / blocked
 
Reported: 2009-10-26 18:14 UTC by Xixi
Modified: 2018-10-27 15:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-11-10 14:26:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1566 0 normal SHIPPED_LIVE Red Hat Network Satellite bug fix update 2009-11-10 14:26:13 UTC

Description Xixi 2009-10-26 18:14:58 UTC
Description of problem:
Customer is receiving an ISE on any kickstart profile they attempt to create in Satellite 5.3.  When viewing the traceback, it claims "Caused by: redstone.xmlrpc.XmlRpcFault: cobbler.cexceptions.CX:'invalid characters in name'", however they are using names such as "testing1" and "testks".  In fact, if they indeed use an invalid character, the Satellite throws and on-screen exception warning them of the mistake.  It's only when they use proper characters does it fail as such. 

This turns out to be due to cobbler.Profile using the org's name (if not null) when saving cobbler ks profile (creation or modification), and it filters out spaces by replacing them with underscores, however it needs to do the same for other non-alphanumeric characters.

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

System architecture(s):
RHEL 5.3 32-bit

How reproducible:
Always.

Steps to Reproduce:
1. Have a satellite with either a base org or an additional org with some non-alphanumeric chars in its name (such as comma);
2. Attempt to create or modify a ks profile in that org.

Actual results:
Internal Server Error on UI and the following logs in tomcat and cobbler:

8...
2009-10-19 10:19:15,493 [TP-Processor1] WARN  org.apache.struts.action.RequestProcessor - Unhandled Exception thrown: class java.lang.reflect.InvocationTargetException
2009-10-19 10:19:15,497 [TP-Processor1] ERROR com.redhat.rhn.frontend.servlets.SessionFilter - Error during transaction. Rolling back
javax.servlet.ServletException
       at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237)
       at com.redhat.rhn.frontend.struts.RhnRequestProcessor.process(RhnRequestProcessor.java:82)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at com.redhat.rhn.frontend.servlets.AuthFilter.doFilter(AuthFilter.java:73)
...
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704)
       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
       at java.lang.Thread.run(Thread.java:735)
Caused by:
java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
       at java.lang.reflect.Method.invoke(Method.java:599)
       at com.redhat.rhn.frontend.struts.wizard.WizardStep.invoke(WizardStep.java:116)
       at com.redhat.rhn.frontend.struts.wizard.RhnWizardAction.dispatch(RhnWizardAction.java:103)
       at com.redhat.rhn.frontend.struts.wizard.RhnWizardAction.execute(RhnWizardAction.java:89)
       at com.redhat.rhn.frontend.action.kickstart.CreateProfileWizardAction.execute(CreateProfileWizardAction.java:104)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
       ... 40 more
Caused by:
org.cobbler.XmlRpcException: XmlRpcException calling cobbler.
       at org.cobbler.CobblerConnection.invokeMethod(CobblerConnection.java:120)
       at org.cobbler.CobblerConnection.invokeTokenMethod(CobblerConnection.java:150)
       at org.cobbler.Profile.invokeModify(Profile.java:158)
       at org.cobbler.CobblerObject.modify(CobblerObject.java:144)
       at org.cobbler.Profile.create(Profile.java:69)
       at com.redhat.rhn.manager.kickstart.cobbler.CobblerProfileCreateCommand.store(CobblerProfileCreateCommand.java:71)
       at com.redhat.rhn.manager.kickstart.KickstartWizardHelper.store(KickstartWizardHelper.java:193)
       at com.redhat.rhn.domain.kickstart.builder.KickstartBuilder.create(KickstartBuilder.java:538)
       at com.redhat.rhn.frontend.action.kickstart.CreateProfileWizardAction.runComplete(CreateProfileWizardAction.java:288)        ... 49 more
Caused by:
redstone.xmlrpc.XmlRpcFault: cobbler.cexceptions.CX:'invalid characters in name'
       at redstone.xmlrpc.XmlRpcClient.handleResponse(XmlRpcClient.java:443)
       at redstone.xmlrpc.XmlRpcClient.endCall(XmlRpcClient.java:376)
       at redstone.xmlrpc.XmlRpcClient.invoke(XmlRpcClient.java:165)
       at org.cobbler.CobblerConnection.invokeMethod(CobblerConnection.java:117)
       ... 57 more
...

From cobberd.log:
...
2009-10-20 13:40:45,270 - api - Exception occured: cobbler.cexceptions.CX
2009-10-20 13:40:45,271 - api - Exception value: 'invalid characters in name'
2009-10-20 13:40:45,271 - api - Exception Info:
 File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1567, in _dispatch
   return method_handle(*params)
  File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1392, in modify_profile
   return self.__call_method(obj, attribute, arg)
  File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1374, in __call_method
   return method(arg)
  File "/usr/lib/python2.4/site-packages/cobbler/item.py", line 129, in set_name
   raise CX(_("invalid characters in name"))
... 

Expected results:
Kickstart profile creation/update works regardless of org name.  

Additional info:
For additional (non-base) orgs, a quick workaround would be to remove the offending chars via UI so the org name only includes alphanumeric chars and spaces.  But for base orgs one can't just change the name in the UI plus would need new satellite cert.  So we need the true fix here, which is to replace all non-alphanumeric chars with underscore in cobbler.profile during profile creation/update time.

Comment 1 Xixi 2009-10-26 18:43:59 UTC
Looks like the fix should be in rhn.manager.kickstart.cobbler.CobblerCommand.makeCobblerName(). Relevant code snippets below.

src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileCreateCommand.java:
...
 71         Profile prof = Profile.create(con, CobblerCommand.makeCobblerName(this.ksData),

 72                 distro);
...

src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileEditCommand.java:
...
  55         if (prof != null) {

  56             if (!cobName.equals(prof.getName())) {

  57                 prof.setName(makeCobblerName(ksData));

  58             }

  59             updateCobblerFields(prof);

  60         }
...


src/com/redhat/rhn/manager/kickstart/cobbler/CobblerCommand.java
...
125     public static String makeCobblerName(String label, Org org) {

126         if (org == null) {

127             return label.replace(' ', '-');

128         }

129         String format = "%s:%s:%s";

130         return String.format(format, label.replace(' ', '-'), org.getId(),

131                 org.getName().replace(' ', '-'));        

132     }
...
165     /**

166      * Make a cobbler name for a kickstart profile

167      * @param data the profile

168      * @return the name

169      */

170     public static String makeCobblerName(KickstartData data) {

171         return makeCobblerName(data.getLabel(), data.getOrg());

172     }
...

Comment 3 Justin Sherrill 2009-10-27 16:33:31 UTC
fixed in spacewalk master: de23b16f7ca113515c691ab285053c3a86aebdd0

Comment 8 Garik Khachikyan 2009-11-05 14:08:51 UTC
# VERIFIED

checked in both rhel4 and rhel5 satellites - it's working with a commited versions of:
spacewalk-taskomatic-0.5.44-49.el[4][5]sat.noarch.rpm
spacewalk-java-lib-0.5.44-49.el[4][5]sat.noarch.rpm
spacewalk-java-0.5.44-49.el[4][5]sat.noarch.rpm
spacewalk-java-config-0.5.44-49.el[4][5]sat.noarch.rpm

For the following org: "New 100$ org, hello! & bye*" preparation of ks profile does not lead to ISE.
the url string for ks profile looks like:
--
"http://<sat_url>/cblr/svc/op/ks/profile/testksfailingorg1:2:New100orghellobye" -O /root/cobbler.ks

Comment 11 errata-xmlrpc 2009-11-10 14:26:23 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1566.html

Comment 14 Justin Sherrill 2010-01-14 16:45:31 UTC
*** Bug 520055 has been marked as a duplicate of this bug. ***


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