Bug 679846 - api kickstart.profile.addScript()/removeScript() don't add/remove script from kickstart file
Summary: api kickstart.profile.addScript()/removeScript() don't add/remove script from...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 540
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Šimon Lukašík
URL:
Whiteboard:
Depends On:
Blocks: sat54-blockers
TreeView+ depends on / blocked
 
Reported: 2011-02-23 17:25 UTC by Martin Osvald 🛹
Modified: 2019-11-14 06:18 UTC (History)
4 users (show)

Fixed In Version: spacewalk-java-1.2.39-101
Doc Type: Bug Fix
Doc Text:
Consequence: When changing kickstart scripts via API, kickstart file doesn't get regenerated with respect to the new script content. Result: Kickstart file will be regenerated, whn changing kickstart scripts using API.
Clone Of:
Environment:
Last Closed: 2011-10-20 08:21:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
temporary patch which fixes the problem (1.04 KB, patch)
2011-02-23 17:25 UTC, Martin Osvald 🛹
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1388 0 normal SHIPPED_LIVE Red Hat Network Satellite server spacewalk-java bug fix and enhancement update 2011-10-20 08:21:14 UTC

Description Martin Osvald 🛹 2011-02-23 17:25:22 UTC
Created attachment 480536 [details]
temporary patch which fixes the problem

Description of problem:

If you call kickstart.profile.addScript()/removeScript() to add/remove script from kickstart profile, the related db entries get updated, but profile's kickstart template file doesn't so that generated kickstart file (through WebUI or during kickstart process) doesn't reflect the changes.


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

spacewalk-java-1.2.39-29.el5sat (Sat 5.4, but the same problem is in Sat 5.3 too)


How reproducible:

Always


Steps to Reproduce:

1. Create a kickstart profile through WebUI

2. Run the following to add a post script into the kickstart profile (change server, user, pass and kslabel):

=== <snip> ===
#!/usr/bin/python

from xmlrpclib import Server
import xmlrpclib

satServer     = "server"
satUser       = "user"
satPasswd     = "pass"
ksLabel       = "kslabel"

satClient = Server('https://'+satServer+'/rpc/api')
satAuth = satClient.auth.login(satUser, satPasswd)

print satClient.kickstart.profile.addScript(satAuth, ksLabel, 'echo bla', '', 'post', True)
#print satClient.kickstart.profile.removeScript(satAuth, ksLabel, 26)
=== </snip> ===

3. Go to:

Systems -> Kickstart -> Profiles -> [profile] -> Kickstart File

or fire the following in your browser:

http://<sat_hostname>/cblr/svc/op/ks/profile/<ks_label>

and you can see that there isn't the post script we just added through the api.

  
Actual results:

calling both apis doesn't lead to kickstart change


Expected results:

it should change the kickstart appropriately


Additional info:

It seems that someone only forgot to add a routine which would re-generate the profile's kickstart template file as everything other works correctly - kickstart gets properly added into db so that it can be accessed and changed through Systems -> Kickstart -> Profiles -> [profile] -> Scripts. I can see in the source code that every other apis do that.

The current behaviour is that somebody creates a ks profile through WebUI, which is then written into template file in /var/lib/rhn/kickstarts/wizard/ with a lot of SNIPPET statements and when somebody wants to print the kickstart file, the related java code connects over http to cobbler, which then replace SNIPPETs and generates the kickstart file into its output, which is then printed by the java code.

The attached temporary patch fixes the probem.


Workaround:

If you call another api, which alters kickstart profile, after calling addScript()/removeScript(), it will lead to profile's kickstart template file re-generation so that changes made by addScript()/removeScript() get reflected. One of such apis is e.g. kickstart.profile.system.enableRemoteCommands()

Comment 1 Tomas Lestach 2011-08-03 11:42:01 UTC
Martin, thanks for the patch!

spacewalk.git: f4958c357d1f98782422812e21c887d7c17ba20d

Comment 4 Tomas Lestach 2011-09-27 15:44:30 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:
Consequence:
When changing kickstart scripts via API, kickstart file doesn't get regenerated with respect to the new script content.
Result:
Kickstart file will be regenerated, whn changing kickstart scripts using API.

Comment 6 Šimon Lukašík 2011-10-06 08:32:46 UTC
Moving to Verified:

Testing procedure:
 - automated test

Verified against:
spacewalk-java-1.2.39-101

Comment 7 errata-xmlrpc 2011-10-20 08:21:48 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/RHBA-2011-1388.html


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