On 11/26/2015 11:24 PM, Antonio Sallés wrote:
On 11/25/2015 04:29 PM, Nishanth Aravamudan wrote:
On 25.11.2015 [15:33:12 -0300], Antonio Sebastian Salles M. wrote:
Hi there,

I'm looking the way for call a list of SNIPPETs using an array of
ksmeta variables, but finally cheeta doesn't like it. Something like
this:

What does cheeta say?

cobbler ... --ksmeta="machinetype=kvm machineenv=db"
...

#set $machinetype = $getVar('$machinetype')
#set $machineenv = $getVar('$machineenv')
$SNIPPET('spacewalk/1/$machinetype')
$SNIPPET('spacewalk/1/$machineenv')

You *might* need to evaluate this outside of the $SNIPPET call. THat is,
try:

#set $machinetypesnippet = 'spacewalk/1/$getVar('$machinetype')'
#set $machineenvsnippet = 'spacewalk/1/$getVar('$machineenv')'

$SNIPPET($machinetypesnippet)
$SNIPPET($machineenvsnippet)

Does that make any difference?

-Nish



Hi,

Nop, it doesn't work neither.
This is the output:

8<-------------------

<class 'Cheetah.Parser.ParseError'>:

Error in the Python code which Cheetah generated for this template:
================================================================================


invalid syntax
(cheetah_DynamicallyCompiledCheetahTemplate_1448583729_4_36017.py, line
554)

Line|Python Code
----|-------------------------------------------------------------
552 |
553 |''')
554 |        machinetypesnippet =
'spacewalk/1/$getVar('VFSL([locals()]+SL+[globals(),
__builtin__],"machinetype",True)')'
                                                           ^
555 |        write(u'''
556 |''')
557 |        _v = self.__errorCatcher19(localsDict=locals()) #
u'$SNIPPET($machinetypesnippet)' on line 217, col 1

================================================================================


Here is the corresponding Cheetah code.
** I had to guess the line & column numbers, so they are probably
incorrect:

Line 217, column 1

Line|Cheetah Code
----|-------------------------------------------------------------
214 |#set $machinetypesnippet = 'spacewalk/1/$getVar('$machinetype')'
215 |#set $machineenvsnippet = 'spacewalk/1/$getVar('$machineenv')'
216 |
217 |$SNIPPET($machinetypesnippet)
      ^
218 |$SNIPPET($machineenvsnippet)
219 |
8<-------------------

Any idea?
Thanks so much.

Antonio.

Hi there,

I don't want to believe this is impossible!

Sending "... ksmeta=machinetype=machinetypesnippet" and with this code... :

#set machineenvsnippet = "\'" + "spacewalk/1/" + $getVar("$machinetype", "") + "\'"
echo "---------------- debug"
echo $machineenvsnippet
echo "---------------- calling snippet with variable"
$SNIPPET($machineenvsnippet)
echo "---------------- calling snippet directly"
$SNIPPET('spacewalk/1/machinetypesnippet')

I obtain this:

echo "---------------- debug"
echo 'spacewalk/1/machinetypesnippet'
echo "---------------- calling snippet with variable"
# Error: no snippet data for 'spacewalk/1/machinetypesnippet'
echo "---------------- calling snippet directly"
echo "This is machinetypesnippet"

What I'm doing wrong?
Thanks so much, again.

Antonio.
_______________________________________________
cobbler mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to