Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 549897

Summary: [Satellite 5.3] Escape characters removed from kickstart scripts
Product: Red Hat Satellite 5 Reporter: Xixi <xdmoon>
Component: ServerAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Garik Khachikyan <gkhachik>
Severity: high Docs Contact:
Priority: urgent    
Version: 530CC: cperry, gkhachik, mkoci, stanislav.polasek, tao, xdmoon
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-04-23 07:01:59 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: 518256    
Attachments:
Description Flags
combined/ported patch for 5.3.0 satellite none

Description Xixi 2009-12-22 22:37:50 UTC
Description of problem:
hen you use escape '\' characters in the pre/post scripts section (kickstart file management), the editor does not put these into the resulting kickstart file. Editor should put text in verbatim, similar to what it in Satellite 5.2.

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

System architecture(s):
RHEL 5.4 x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Create a new kickstart profile
2. Go to the scripts tab for the new profile and add a new %pre or %post script with the contents:
echo "\\$zoom \$zoom $zoom"
3. Select the "Kickstart File" tab and scroll down 

Actual results:
echo "\$zoom $zoom $zoom"
Notice that a single escape character has been removed before each dollar-sign. 

Expected results:
echo "\\$zoom \$zoom $zoom"

Additional info from customer:
[snip]
Since these scripts do not use templating, Satellite is wrapping them in Cheetah #raw directives.  The Cheetah User Guide says that text inside a #raw .. #end raw tag pair will be printed verbatim.  I've narrowed this down to a bug in the way Cheetah handles its #raw directives, as can be seen here:

Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> t = """#raw
... This escape should be preserved: \\$unexpanded
... So should this one: \\#blah
... The string "\\012" should not disappear.  #end raw"""
>>> print t
#raw
This escape should be preserved: \$unexpanded
So should this one: \#blah
The string "\012" should not disappear.  #end raw
>>> import Cheetah.Template
>>> print Cheetah.Template.Template ( t, [ { "unexpanded" : "EXPANDED" } ]  )
This escape should be preserved: $unexpanded
So should this one: #blah
The string "" should not disappear.
>>>

I have proposed the attached patches (0001-Move-escaped-vars-to-parser.patch and 0002-split-multiline-at-repr-breaks.patch) upstream to resolve the issue.  If accepted, they will need to be back-ported.
[snip]

Impact to the customer:
high - all the kickstart profiles the client currently has are rolling out incorrect ks files, which is doing bad things

Comment 3 Xixi 2009-12-22 22:41:13 UTC
Per confirmation with Justin, the content within #raw...#endraw should not be escaped.

Comment 4 Xixi 2009-12-22 22:42:52 UTC
Created attachment 379937 [details]
combined/ported patch for 5.3.0 satellite

Comment 5 Justin Sherrill 2010-01-08 16:44:55 UTC
Looks like this was accepted upstream.  Going ahead and patching the version we ship for Satellite 5.3

http://sourceforge.net/mailarchive/message.php?msg_name=1260840969-3603-1-git-send-email-karmix0@gmail.com

Comment 6 Justin Sherrill 2010-01-08 19:58:29 UTC
K, I updated our internal build of cheetah to use the patch.

Comment 7 Justin Sherrill 2010-03-11 15:41:19 UTC
commit in thirdparty git:  2e9a1091d18d507864cfe108a31bf8824b3d0390

Comment 8 Justin Sherrill 2010-03-11 15:42:16 UTC
commit in third party git (ignore that last one):

264961c4d056cd364812255714424e9b7ddf6e0d

Comment 12 Garik Khachikyan 2010-04-06 07:42:52 UTC
# VERIFIED

Checked against archs: i386, x86_64, s390x

the pre/post script containing escape characters are not getting removed now.

Packages fixing the issue:
---
python-cheetah-2.0.1-1
cobbler-1.6.6-5
spacewalk-web-0.5.23-34
spacewalk-java-0.5.44-74
spacewalk-backend-0.5.28-40.x.2
---

Comment 14 errata-xmlrpc 2010-04-23 07:01:59 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-2010-0369.html