Bug 492206 - Cheetah template directives in kickstart files, such as #if, cause kickstart file generation to bomb ungracefully
Cheetah template directives in kickstart files, such as #if, cause kickstart ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Provisioning (Show other bugs)
530
All Linux
high Severity medium
: ---
: ---
Assigned To: Partha Aji
Steve Salevan
:
Depends On:
Blocks: 457075
  Show dependency treegraph
 
Reported: 2009-03-25 17:19 EDT by Steve Salevan
Modified: 2009-09-10 15:24 EDT (History)
2 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-10 15:24:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Error produced by cheetah (1.33 KB, text/plain)
2009-03-25 17:19 EDT, Steve Salevan
no flags Details

  None (edit)
Description Steve Salevan 2009-03-25 17:19:52 EDT
Created attachment 336706 [details]
Error produced by cheetah

Description of problem:
Upon talking with mdehaan, he suggested that if you upload a kickstart file that inadvertently contains Cheetah directives, such as #if, the generation of the kickstart file will fail, as the process looks something like this:

User uploads kickstart file ->
Satellite stores uploaded kickstart file as a Cheetah template ->
User requests kickstart file ->
Satellite sends kickstart template through Cheetah, which renders it ->
Rendered file sent to user

At the moment, if a user has some of these errors in their file, the WebUI doesn't make it evident that they do, so, upon retrieval, the munged file goes through Cheetah, which produces a bit of a cryptic Python traceback.

Version-Release number of selected component (if applicable):
530-re20090323.0

How reproducible:
Always

Steps to Reproduce:
1. Upload a kickstart file
2. Insert a Cheetah directive into this file, like '#if'
3. Attempt to download this kickstart file from its cobbler URL or view it from the WebUI
  
Actual results:
Cheetah parse error similar to attached traceback

Expected results:

At least one of these:
WebUI notifies user of issues in kickstart file prior to retrieval, contains tooltips pointing users to these potential pitfalls, or a more intelligible error page is produced

Additional info:
Comment 1 Partha Aji 2009-04-07 14:43:39 EDT
Should be fixed in the next iso...
Comment 2 Partha Aji 2009-04-07 14:48:39 EDT
Forgot to add the behavior sorry ... 
So when you create/edit  a Kickstart Profile (raw/otherwise), and you enter an unparseable text you should get a Red Colored error saying your profile is busted and a link pointing you to the stack trace and the actual cheetah error.. Note the kickstart is already done, there is no roll back happening here, its just more of a notification saying your template is busted, fix it if you want it to work. This notification is done every time you go to the details page of the kickstart. So in theory the admin will get notified appropriately...
Comment 3 Partha Aji 2009-04-22 13:42:02 EDT
moving to On_QA
Comment 5 Partha Aji 2009-05-20 10:23:50 EDT
Moving to ON_QA
Comment 6 Steve Salevan 2009-06-01 10:38:11 EDT
If a user adds a kickstart file with busted directives or edits busted directives into the file, no red text appears and behavior as reported persists.  Moving to FAILS_QA, tested on 5/29 ISO.
Comment 7 Partha Aji 2009-06-01 13:19:02 EDT
This error occured because of an interesting modification to the cobbler error reporting between cobbler versiond 1.6.3-2 and 1.6.3-3 . In 1.6.3.2 compile errors raised a 500, while in 1.6.3.3 it raises a 200 Ok. The code has now been fixed to make sure error gets raised for either of these cases... it just parses for the string "Traceback (most recent call last):" to report the error if a 200 OK is returned by cobbler..
http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=bf7f6b39880cc4e91051b3e6c904b69bd22deaa3
Comment 8 Steve Salevan 2009-06-10 13:19:27 EDT
So we now get the red text appropriately, which is good, but the resulting traceback looks something like this:

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
    result = object(req)

  File "/var/www/cobbler/svc/services.py", line 89, in handler
    content = func( **form )

  File "/usr/lib/python2.3/site-packages/cobbler/services.py", line 87, in ks
    data = self.remote.generate_kickstart(profile,system,REMOTE_ADDR,REMOTE_MAC)

  File "/usr/lib/python2.3/xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)

  File "/usr/lib/python2.3/xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose

  File "/usr/lib/python2.3/xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)

  File "/usr/lib/python2.3/xmlrpclib.py", line 1219, in _parse_response
    return u.close()

  File "/usr/lib/python2.3/xmlrpclib.py", line 742, in close
    raise Fault(**self._stack[0])

Fault: 

No Cheetah error seems to be present in the traceback, so a user might find themselves at a loss as to what's going on.  Moving to FAILS_QA, tested on 5/6 ISO.
Comment 9 Steve Salevan 2009-06-10 13:20:09 EDT
Fwoops, make that the 6/5 ISO.  Coffee time!
Comment 10 Partha Aji 2009-06-10 21:53:46 EDT
Should be fixed as of
http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=17242d7cdcd1f33a963dcd3b2931a0590e3ec66b

Basically redirected the error from a cobbler page to spacewalk's KickstartFileDownload Page..
Comment 11 Steve Salevan 2009-06-24 16:15:24 EDT
On 6/19 build, error still redirects to:

/cblr/svc/op/ks/profile/<profile>

Moving to FAILS_QA.
Comment 13 Steve Salevan 2009-07-02 13:13:47 EDT
VERIFIED on 6/25 ISO.
Comment 14 Shannon Hughes 2009-07-29 13:58:47 EDT
error redirects now to download page but rendering python errors in the kickstart download area. throwing this to failsqa to be reviewed.
Comment 15 Shannon Hughes 2009-07-29 17:15:13 EDT
did not realize the python stack trace embedded in the web text area was meant to help user debug. 

moving to release pending
Comment 16 Brandon Perkins 2009-09-10 15:24:50 EDT
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/RHEA-2009-1434.html

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