Bug 666235 - Traceback when trying to use #silent
Summary: Traceback when trying to use #silent
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: cobbler
Version: el5
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Scott J Henson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-29 19:19 UTC by Orion Poplawski
Modified: 2010-12-31 05:40 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-31 05:40:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Orion Poplawski 2010-12-29 19:19:38 UTC
Description of problem:

Apparently #silent is not allowed, but cobbler crashes trying to tell me:

Wed Dec 29 12:16:17 2010 - INFO | Exception occured: exceptions.TypeError
Wed Dec 29 12:16:17 2010 - INFO | Exception value: not enough arguments for format string
Wed Dec 29 12:16:17 2010 - INFO | Exception Info:
  File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1759, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 920, in generate_kickstart
    return self.api.generate_kickstart(profile,system)
   File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 553, in generate_kickstart
    return self.kickgen.generate_kickstart_for_system(system)
   File "/usr/lib/python2.4/site-packages/cobbler/kickgen.py", line 198, in generate_kickstart_for_system
    return self.generate_kickstart(profile=p, system=s)
   File "/usr/lib/python2.4/site-packages/cobbler/kickgen.py", line 227, in generate_kickstart
    data = self.templar.render(raw_data, meta, None, obj)
   File "/usr/lib/python2.4/site-packages/cobbler/templar.py", line 134, in render
    t = Template(source=raw_data, errorCatcher="Echo", searchList=[search_table], compilerSettings={'useStackFrame':False})
   File "DynamicallyCompiledCheetahTemplate.py", line 59, in __init__
   File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 1192, in __init__
    self._compile(source, file, compilerSettings=compilerSettings)
   File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 1480, in _compile
    keepRefToGeneratedCode=True)
   File "/usr/lib/python2.4/site-packages/cobbler/template_api.py", line 289, in compile
    return Cheetah.Template.Template.compile(*args, **kwargs)
   File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 726, in compile
    compiler.compile()
   File "/usr/lib/python2.4/site-packages/Cheetah/Compiler.py", line 1678, in compile
    self._parser.parse()
   File "/usr/lib/python2.4/site-packages/Cheetah/Parser.py", line 1452, in parse
    self.eatDirective()
   File "/usr/lib/python2.4/site-packages/Cheetah/Parser.py", line 1593, in eatDirective
    handler(expr)
   File "/usr/lib/python2.4/site-packages/cobbler/template_api.py", line 51, in addSilent
    raise CX("Use of #silent is not allowed: %s"%expr)
   File "/usr/lib/python2.4/site-packages/cobbler/cexceptions.py", line 30, in __init__
    self.value = value % args

Version-Release number of selected component (if applicable):
cobbler-2.0.10-1.el5

BTW - why is #silent not allowed?

Comment 1 Scott J Henson 2010-12-31 05:00:12 UTC
First, is cobblerd actually crashing?  It should be an exception that is being pushed out to the kickstart display layer as an error message that shows as an invalid kickstart file.  Do you actually need to start cobblerd up again?

Second, #silent isn't allowed because you can use it to execute arbitrary python code.  If you have users accessing cobbler_web, editing templates, this can be a security risk.  If you don't have that issue, you can set 'safe_templating: false' in your settings file and all those checks will be turned off and you can use all of the power of Cheetah.  But, understand that this allows anyone editing templates or snippets the ability to run arbitrary python as root on your cobbler host.

Comment 2 Orion Poplawski 2010-12-31 05:10:01 UTC
Sorry, no, it isn't crashing.  Just emitting the traceback.  Thanks for the explanation.  I was searching for a method to debugging a cheetah failure and #silent seemed promising.  Is there a standard way of getting more debug info for a cheetah template failure?

Comment 3 Scott J Henson 2010-12-31 05:39:30 UTC
We have ErrorCatcher echo[0] set by default to help in debugging.  Unfortunately, debugging cheetah templates can be one of the more difficult portions of dealing with cobbler.  If you want to post your issue to cobbler.org we can help you out.  Also, stop by #cobbler on freenode.  I generally hang around there during normal business hours EST and should be there again starting on the Third of January.

Do remember, you can use #silent by setting safe templating to false.  Just understand the security implications it presents.

As for this bug, I'm going to close it as not a bug.  Thanks.

[0] - http://www.cheetahtemplate.org/docs/users_guide_html/#errorHandling.errorCatcher


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