Greg & List,
Thanks for the reply. I have finally got back to it. Not sure the error is reporting the right location in the script.
I am back to square one with this. When I have 1 $ I get an error and when I have 2 $ I get an error. Raw data and error below.
Here is the raw kickstart file
# Sample kickstart for ESXi 5.0
# William Lam
# www.virtuallyghetto.com
#########################################
accepteula
install --firstdisk --overwritevmfs
# RootPassword is taken from the default setting of cobbler
rootpw --iscrypted $default_password_crypted
reboot
%include /tmp/networkconfig
%pre --interpreter=busybox
# extract network info from bootup
VMK_INT="vmk0"
VMK_LINE=$$(localcli network ip interface ipv4 get | grep "${VMK_INT}")
IPADDR=$$(echo "${VMK_LINE}" | awk '{print $2}')
NETMASK=$$(echo "${VMK_LINE}" | awk '{print $3}')
GATEWAY=$$(esxcfg-route | awk '{print $5}')
Here is the error when I try to view the kickstart file for a Profile.
Tue May 8 20:46:35 2012 - INFO | REMOTE generate_kickstart; user(?)
Tue May 8 20:46:35 2012 - INFO | generate_kickstart
Tue May 8 20:46:35 2012 - INFO | Exception occured: <class 'Cheetah.Parser.ParseError'>
Tue May 8 20:46:35 2012 - INFO | Exception value:
Error in the Python code which Cheetah generated for this template:
================================================================================
EOL while scanning string literal (cheetah_DynamicallyCompiledCheetahTemplate_1336509995_67_63885.py, line 81)
Line|Python Code
----|-------------------------------------------------------------
79 |
80 | try:
81 | return eval('''VFFSL(SL,"echo",True) "${VMK_LINE}" | awk '{print $2}'''', globals(), localsDict)
^
82 | return self._CHEETAH__errorCatcher.warn(exc_val=e, code= u'VFFSL(SL,"echo",True) "${VMK_LINE}" | awk \'{print $2}\'' , rawCode= u'$(echo "${VMK_LINE}" | awk \'{print $2}\')' , lineCol=(22, 9))
83 |
84 | def __errorCatcher4(self, localsDict={}):
================================================================================
Here is the corresponding Cheetah code.
** I had to guess the line & column numbers, so they are probably incorrect:
Line 11, column 20
Line|Cheetah Code
----|-------------------------------------------------------------
8 |install --firstdisk --overwritevmfs
9 |
10 |# RootPassword is taken from the default setting of cobbler
11 |rootpw --iscrypted $default_password_crypted
^
12 |
13 |reboot
14 |
Tue May 8 20:46:35 2012 - INFO | Exception Info:
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 1944, in _dispatch
return method_handle(*params)
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 994, in generate_kickstart
return self.api.generate_kickstart(profile,system)
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 645, in generate_kickstart
return self.kickgen.generate_kickstart_for_profile(profile)
File "/usr/lib/python2.6/site-packages/cobbler/kickgen.py", line 297, in generate_kickstart_for_profile
return self.generate_kickstart(profile=g)
File "/usr/lib/python2.6/site-packages/cobbler/kickgen.py", line 275, in generate_kickstart
data = self.templar.render(raw_data, meta, None, obj)
File "/usr/lib/python2.6/site-packages/cobbler/templar.py", line 128, in render
t = Template(source=raw_data, errorCatcher="Echo", searchList=[search_table], compilerSettings={'useStackFrame':False})
File "DynamicallyCompiledCheetahTemplate.py", line 55, in __init__
File "_etc_cobbler_cheetah_macros.py", line 55, in __init__
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 1257, in __init__
self._compile(source, file, compilerSettings=compilerSettings)
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 1551, in _compile
keepRefToGeneratedCode=True)
File "/usr/lib/python2.6/site-packages/cobbler/template_api.py", line 127, in compile
return Cheetah.Template.Template.compile(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 795, in compile
raise parseError
john
From: cobbler-bounces@lists.fedorahosted.org [mailto:cobbler-bounces@lists.fedorahosted.org] On Behalf Of Greg Swift
Sent: 06 March 2012 23:51
To: cobbler mailing list
Subject: Re: [cobbler] KS generation error
Try doubling your $'s
VMK_LINE=$$(localcli network ip interface ipv4 get | grep "$${VMK_INT}")
cheetah is trying to populate those variables (i think) but you want them to exist as is for the client to run in its script.
-greg
On Tue, Mar 6, 2012 at 17:30, John Paget Bourke <john.bourke@mobileinternet.com> wrote:
Hello,
I have narrowed down the problem to this line
VMK_LINE=$(localcli network ip interface ipv4 get | grep "${VMK_INT}")
Here is the first section of kick start file. The offending line is the last line
# Sample kickstart for ESXi 5.0
# William Lam
# www.virtuallyghetto.com
#########################################
accepteula
install --firstdisk --overwritevmfs
# RootPassword is taken from the default setting of cobbler
rootpw --iscrypted $default_password_crypted
reboot
%include /tmp/networkconfig
%pre --interpreter=busybox
# extract network info from bootup
VMK_INT="vmk0"
VMK_LINE=$(localcli network ip interface ipv4 get | grep "${VMK_INT}")
If I remove this last line the kick start file renders correctly.
# Sample kickstart for ESXi 5.0
# William Lam
# www.virtuallyghetto.com
accepteula
install --firstdisk --overwritevmfs
# RootPassword is taken from the default setting of cobbler
rootpw --iscrypted $1$gdsgsdgfdEr235q8iv.EFmSAhWDLtw1
reboot
%include /tmp/networkconfig
%pre --interpreter=busybox
# extract network info from bootup
VMK_INT="vmk0"
Thanks
John
-----Original Message-----
From: cobbler-bounces@lists.fedorahosted.org [mailto:cobbler-bounces@lists.fedorahosted.org] On Behalf Of John Paget Bourke
Sent: 06 March 2012 11:05
To: 'cobbler mailing list'
Subject: [cobbler] KS generation error
Hi,
I have a esxi5 kick start file which is generating an error when I try to view it on the profile section of web GUI.
I have a RHEL profile with a kick start with displays fine.
Can anyone help ?
Thanks
John
Tue Mar 6 10:51:26 2012 - INFO | REMOTE version; user(cobbler) Tue Mar 6 10:51:28 2012 - INFO | REMOTE generate_kickstart; user(?) Tue Mar 6 10:51:28 2012 - INFO | generate_kickstart Tue Mar 6 10:51:28 2012 - INFO | Exception occured: <class 'Cheetah.Parser.ParseError'> Tue Mar 6 10:51:28 2012 - INFO | Exception value:
Error in the Python code which Cheetah generated for this template:
================================================================================
EOL while scanning string literal (cheetah_DynamicallyCompiledCheetahTemplate_1331031088_43_58507.py, line 81)
Line|Python Code
----|-------------------------------------------------------------
79 |
80 | try:
81 | return eval('''VFFSL(SL,"echo",True) "${VMK_LINE}" | awk '{print $2}'''', globals(), localsDict)
^
82 | return self._CHEETAH__errorCatcher.warn(exc_val=e, code= u'VFFSL(SL,"echo",True) "${VMK_LINE}" | awk \'{print $2}\'' , rawCode= u'$(echo "${VMK_LINE}" | awk \'{print $2}\')' , lineCol=(21, 8))
83 |
84 | def __errorCatcher4(self, localsDict={}):
================================================================================
Here is the corresponding Cheetah code.
** I had to guess the line & column numbers, so they are probably incorrect:
Line 11, column 20
Line|Cheetah Code
----|-------------------------------------------------------------
8 |install --firstdisk --overwritevmfs
9 |
10 |# RootPassword is taken from the default setting of cobbler
11 |rootpw --iscrypted $default_password_crypted
^
12 |reboot
13 |
14 |%include /tmp/networkconfig
Tue Mar 6 10:51:28 2012 - INFO | Exception Info:
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 1946, in _dispatch
return method_handle(*params)
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 996, in generate_kickstart
return self.api.generate_kickstart(profile,system)
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 645, in generate_kickstart
return self.kickgen.generate_kickstart_for_profile(profile)
File "/usr/lib/python2.6/site-packages/cobbler/kickgen.py", line 297, in generate_kickstart_for_profile
return self.generate_kickstart(profile=g)
File "/usr/lib/python2.6/site-packages/cobbler/kickgen.py", line 275, in generate_kickstart
data = self.templar.render(raw_data, meta, None, obj)
File "/usr/lib/python2.6/site-packages/cobbler/templar.py", line 113, in render
data_out = self.render_cheetah(raw_data, search_table, subject)
File "/usr/lib/python2.6/site-packages/cobbler/templar.py", line 199, in render_cheetah
t = Template(source=raw_data, errorCatcher="Echo", searchList=[search_table], compilerSettings={'useStackFrame':False})
File "DynamicallyCompiledCheetahTemplate.py", line 55, in __init__
File "_etc_cobbler_cheetah_macros.py", line 55, in __init__
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 1257, in __init__
self._compile(source, file, compilerSettings=compilerSettings)
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 1551, in _compile
keepRefToGeneratedCode=True)
File "/usr/lib/python2.6/site-packages/cobbler/template_api.py", line 127, in compile
return Cheetah.Template.Template.compile(*args, **kwargs)
File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 795, in compile
raise parseError
_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler
_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler