Rainer Duffner wrote:
> Hi,
>
> I want to figure out (or rather: pass them to cobbler via ksmeta variables):
>
> I have:
>
> disk=cciss/c0d0,cciss/c0d1
>
> in the ksmeta-string.
>
> I've got a snippet, that is included in the template via
> $SNIPPET('disk_double_big_opt_neutral')
>
> It looks like this:
>
> #set $disks=getVar('$disk', None)
> #set $disk1=$disks.split(',')[0]
> #set $disk2=$disks.split(',')[1]
>
> clearpart --all --drives=$disks
> part /boot --fstype ext3 --size=100 --ondisk=$disk1
> part pv.2 --size=0 --grow --ondisk=$disk1
> volgroup VolGroup00 --pesize=32768 pv.2
> logvol swap --fstype swap --name=swapvol --vgname=VolGroup00 --size=512
> --grow --maxsize=$ksmaxswap
> logvol / --fstype ext3 --name=rootvol --vgname=VolGroup00
> --size=$ksmaxslash --grow
> logvol /tmp --fstype ext3 --name=tmpvol --vgname=VolGroup00 --size=$ksmaxtmp
> part pv.3 --size=0 --grow --ondisk=$disk2
> volgroup VolGroup01 --pesize=32768 pv.3
> logvol $bigpart --fstype ext3 --name=bigvol --vgname=VolGroup01
> --size=$ksmaxbig --grow
>   

All the Cobbler 1.4 default templates are switched to just use 
"autopart" now, for complexity reasons. We're still leaving the old disk 
partitioning snippets in /var/lib/cobbler/snippets for folks that are 
using it.
>
> But all I get is a big error when I want to view the rendered result:
>
> # *** ERROR ***
> #
> # There is a templating error preventing this file from rendering correctly. 
> #
> # This is most likely not due to a bug in Cobbler and is something you can 
> fix.
> #
> # Look at the message below to see what things are causing problems.  
> #
> # (1) Does the template file reference a $variable that is not defined?
> # (2) is there a formatting error in a Cheetah directive?
> # (3) Should dollar signs ($) be escaped that are not being escaped?
> #
> # Try fixing the problem and then investigate to see if this message goes
> # away or changes.
> #
> # 
> # global name 'getVar' is not defined
> #   File "/usr/lib/python2.4/site-packages/cobbler/templar.py", line 114, in 
> render
> #     data_out = str(t)
> # 
> #   File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 994, in 
> __str__
> #     def __str__(self): return getattr(self, mainMethName)()
> # 
> #   File "cheetah_DynamicallyCompiledCheetahTemplate_1233079651_86_79472.py", 
> line 290, in respond
> # 
> #   File "cheetah_DynamicallyCompiledCheetahTemplate_1233079651_86_79472.py", 
> line 127, in __errorCatcher9
> # 
> #   File "<string>", line 0, in ?
> # 
> #   File "/usr/lib/python2.4/site-packages/cobbler/template_api.py", line 
> 156, in SNIPPET
> #     result = BuiltinTemplate.SNIPPET(self, file)
> # 
> #   File "DynamicallyCompiledCheetahTemplate.py", line 89, in SNIPPET
> # 
> #   File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 1536, 
> in _handleCheetahInclude
> #     self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
> # 
> #   File 
> "cheetah__var_lib_cobbler_snippets_disk_double_big_opt_neutral_1233079619_04_60080.py",
>  line 148, in respond
> # 
>
> <pre>
> Mod_python error: "PythonHandler services"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in 
> HandlerDispatch
>     result = object(req)
>
>   File "/var/www/cobbler/svc/services.py", line 98, in handler
>     return apache.HTTP_ERROR
>
> AttributeError: 'module' object has no attribute 'HTTP_ERROR'
>
> </pre>
>   

The very last bit about HTTP_ERROR is spurius, but irrelevant. (What OS 
are you running? I think apache.HTTP_ERROR is valid code, which slightly 
confuses me).

The text above it though, it correct.
It is saying getVar does not exist, because you need to be using 
$getVar(...) instead.

$foo dereferences a variable in Cheetah, or calls a function. In this 
case, $getVar(...) is a function.

--Michael


_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to