Bug 672652
| Summary: | Kickstart "Kernel Options" and "Post Kernel Options" reject valid options | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Community] Spacewalk | Reporter: | Roy Keene <roy.keene> | ||||
| Component: | WebUI | Assignee: | Jan Pazdziora (Red Hat) <jpazdziora> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Red Hat Satellite QA List <satqe-list> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 1.6 | CC: | jpazdziora, mmello, tlestach | ||||
| Target Milestone: | --- | Keywords: | Patch | ||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | spacewalk-java-1.6.83-1 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2011-12-22 16:49:17 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: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 723481 | ||||||
| Attachments: |
|
||||||
We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5. We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5. Aligning under space16. Taking.. Issue reproduced into Spacewalk 1.6 nightly build. When using double quotes, the text is included but does not include it correctly. %post# Start post install kernel options update /sbin/grubby --update-kernel=`/sbin/grubby --default-kernel` --args="console=ttyS0,115200" "console=tty0 " # End post install kernel options update Working on it..
java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartDetailsEditAction.java
============================================
278 /**
279 * Proccess Cobbler form values, pulling in the form
280 * and pushing the values to cobbler
281 * @param ksdata the kickstart data
282 * @param form the form
283 * @param user the user
284 */
285 public static void processCobblerFormValues(KickstartData ksdata,
286 DynaActionForm form, User user) {
287 CobblerProfileEditCommand cmd = new CobblerProfileEditCommand(ksdata, user);
288
289 cmd.setKernelOptions(StringUtils.defaultString(form.getString(KERNEL_OPTIONS)));
290 cmd.setPostKernelOptions(StringUtils.defaultString(
291 form.getString(POST_KERNEL_OPTIONS)));
292 cmd.store();
293
294 CobblerXMLRPCHelper helper = new CobblerXMLRPCHelper();
295 Profile prof = Profile.lookupById(helper.getConnection(user),
296 ksdata.getCobblerId());
297 if (prof == null) {
298 return;
299 }
-----
137 /**
138 * Setup cobbler form values These include, kernel options and virt options
139 * @param ctx the RequestContext
140 * @param form The form
141 * @param data the kickstart data
142 */
143 public static void setupCobblerFormValues(RequestContext ctx,
144 DynaActionForm form, KickstartData data) {
145 CobblerXMLRPCHelper helper = new CobblerXMLRPCHelper();
146 Profile prof = Profile.lookupById(helper.getConnection(ctx.getLoggedInUser()),
147 data.getCobblerId());
148 if (prof != null) {
149 form.set(KERNEL_OPTIONS, prof.getKernelOptionsString());
150 form.set(POST_KERNEL_OPTIONS, prof.getKernelPostOptionsString());
151 }
152 KickstartVirtualizationType type = data.getKickstartDefaults().
153 getVirtualizationType();
# cobbler system report
...
Name : system-a-test.redhat.com:3
Comment :
Gateway :
Hostname :
Image :
Kernel Options : {'console': 'ttyS0,9600n8'}
Kernel Options (Post Install) : {'console': 'ttyS0,9600n8'}
code/src/org/cobbler/CobblerObject.java
328 /**
329 * gets the kernel post options in string form
330 * @return the string
331 */
332 public String getKernelPostOptionsString() {
333 return convertOptionsMap(getKernelPostOptions());
334 }
335
336 private String convertOptionsMap(Map<String, Object> map) {
337 StringBuilder string = new StringBuilder();
338 for (Object key : map.keySet()) {
339 if (StringUtils.isEmpty((String)map.get(key))) {
340 string.append(key + " ");
341 }
342 else {
343 string.append(key + "=" + map.get(key) + " ");
344 }
345 }
346 return string.toString();
347 }
The function above overwrite the values keeping always the second parameter with '=' signal
Doing the test at webUI:
Kernel Options: console=tty0 console=ttyS0,115200
Post Kernel Options: console=ttyS0,115200 console=tty0
Result:
Kernel Options: console=ttyS0,115200
Post Kernel Options: console=tty0
336 private String convertOptionsMap(Map<String, Object> map) {
337 StringBuilder string = new StringBuilder();
338 for (Object key : map.keySet()) {
339 if (StringUtils.isEmpty((String)map.get(key))) {
340 string.append(key + " ");
341 }
342 else {
343 string.append(key + "=" + map.get(key) + " ");
344 }
345 }
346 return string.toString();
347 }
fuction convertOptionsMap() is using Map object which cannot allow have duplicate keys
at webUI:
Kernel Options: console console=ttyS0,115200
Result:
Kernel Options: console=ttyS0,115200
OR
at webUI:
Kernel Options: console=ttyS0,115200 console
Result:
Kernel Options: console
When using different cases, it is included into the Map
at webUI:
Kernel Options: Console=tty0 console=ttyS0,115200
Result:
Kernel Options: Console=tty0 console=ttyS0,115200
Created attachment 520451 [details] Patch proposed Hello, Follow attached a patch which allow multiple keys when setting kernel_options and kernel_post_options at kickstart profile. Patch already sent to approval at spacewalk-devel mail list. Mail Thread: https://www.redhat.com/archives/spacewalk-devel/2011-August/msg00085.html Cheers, Marcelo Moreira de Mello (In reply to comment #9) > Created attachment 520451 [details] > Patch proposed > > Hello, > > Follow attached a patch which allow multiple keys when setting kernel_options > and kernel_post_options at kickstart profile. > > Patch already sent to approval at spacewalk-devel mail list. > > Mail Thread: > https://www.redhat.com/archives/spacewalk-devel/2011-August/msg00085.html > > Cheers, > Marcelo Moreira de Mello Marcelo, do you have a new patch ready which would address the concerns Tomáš raised in the mailing list thread? I've applied the patch as proposed in commit 9 to Spacewalk master, 4c24029b5166df603ac3550b661094ef6888889d. fixing checkstyle issues: cd6114a6363e54c537d2df56d4802befc51e43f9 fixing behaviour, when entering values like: justkey keyisequal= keyemptystring="" + some cosmetic issues spacewalk.git: 7a2edb175d67963ccba6c7f2cac3806c21dabc5e kernel options stored before update might be stored as strings => 'upgrade issue' spacewalk.git: 73c0e06e29163e0d68a196e1f7c3488f2d0982a7 Spacewalk 1.6 has been released. |
Description of problem: A kickstart profile supports passing kernel options to the Anaconda kernel ("Kernel Options") and the installed OS kernel ("Post Kernel Options"), however they reject the valid options: console=tty0 console=ttyS0,9600n8 The interface replaces it with: console=ttyS0,9600n8 Which does something entirely different and is not want I want. How reproducible: Completely. Steps to Reproduce: 1. Login to Spacewalk 2. Click "Systems" 3. Click "Kickstart" 4. Click "Profiles" 5. Click a profile label 6. Type "console=tty0 console=ttyS0,9600n8" in the text box next to "Kernel Options" 7. Click "Update Kickstart" Actual results: Textbox next to "Kernel Options" contains "console=ttyS0,9600n8 " Expected results: Textbox next to "Kernel Options" should contain "console=tty0 console=ttyS0,9600n8" Additional info: This bug seems like a mis-guided attempt to remove redundant kernel options. The kernel command line is not parsed as a key-value pair.