Bug 492206

Summary: Cheetah template directives in kickstart files, such as #if, cause kickstart file generation to bomb ungracefully
Product: Red Hat Satellite 5 Reporter: Steve Salevan <ssalevan>
Component: ProvisioningAssignee: Partha Aji <paji>
Status: CLOSED CURRENTRELEASE QA Contact: Steve Salevan <ssalevan>
Severity: medium Docs Contact:
Priority: high    
Version: 530CC: bperkins, shughes
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 19:24:50 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: 457075    
Attachments:
Description Flags
Error produced by cheetah none

Description Steve Salevan 2009-03-25 21:19:52 UTC
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 18:43:39 UTC
Should be fixed in the next iso...

Comment 2 Partha Aji 2009-04-07 18:48:39 UTC
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 17:42:02 UTC
moving to On_QA

Comment 5 Partha Aji 2009-05-20 14:23:50 UTC
Moving to ON_QA

Comment 6 Steve Salevan 2009-06-01 14:38:11 UTC
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 17:19:02 UTC
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 17:19:27 UTC
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 17:20:09 UTC
Fwoops, make that the 6/5 ISO.  Coffee time!

Comment 10 Partha Aji 2009-06-11 01:53:46 UTC
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 20:15:24 UTC
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 17:13:47 UTC
VERIFIED on 6/25 ISO.

Comment 14 Shannon Hughes 2009-07-29 17:58:47 UTC
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 21:15:13 UTC
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 19:24:50 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/RHEA-2009-1434.html