/s/When cheetah naturally/When I don't escape the ${var} cheetah/g :) On 6/11/07, Aaron Lippold <lippold@xxxxxxxxx> wrote:
Hi, Sorry I had to leave the desk for a bit. Ya it is supposed to be Bash. Which I am sure is the issue but a lot of my developers are bash folks not python. I posted the section that seems to be giving python / cheetah fits. When I escape the ${var} it says end line expected. When cheetah naturally complains because it does like the var defn. hmmmm. thoughts? Thanks, Aaron On 6/11/07, Michael DeHaan <mdehaan@xxxxxxxxxx> wrote: > IRC log... > > <aaronlippold> I found that if I just copy the file to the web sever and > reference it with kickstart=http://server/file then it doesn't parse the > ks file. This is a workaround but I would still like to know how to do > this correctly :) > * rharrison (i=rharriso@nat/cisco/x-a6ceb7953d81c5fc) has joined #cobbler > <aaronlippold> google doesn't seem to have an answer for why a X=bla and > then ref X with \${X} would make the cheetah parser is throwing a , > 'Line ending expected', exception. > <aaronlippold> throw an error ... sorry > * timverhoeven (i=timverho@nat/ibm/x-78684106c698f2d3) has left #cobbler > <mpdehaan> aaronlippold, hi > <mpdehaan> aaronlippold, yes, http:// kickstarts do not parse, there is > a reason for this > <mpdehaan> suppose you want to use a kickstart file straight out of RHN, > for instance, via URL... > <mpdehaan> or if the kickstart is a file another admin maintains > <mpdehaan> so they evaluate only when they are stored on the filesystem > as templates, not whole kickstart files > <mpdehaan> aaronlippold, hmm, perhaps you could post an example to the > Cheetah list > <mpdehaan> ah, > <mpdehaan> so is \${X} supposed to reference a Cheetah var? With > escaping the "X" you won't > <mpdehaan> I mean, the $ > <mpdehaan> The reason you escape \$ is to make sure they pass through to > the kickstart file as $ > <mpdehaan> Unless that's supposed to be bash code > <mpdehaan> aaronlippold, ping? > > > > > > ---------- Forwarded message ---------- > From: "Aaron Lippold" <lippold@xxxxxxxxx> > To: "Fedora/Linux Management Tools" <et-mgmt-tools@xxxxxxxxxx> > Date: Mon, 11 Jun 2007 15:30:41 +0200 > Subject: Re: [et-mgmt-tools] Cobbler, Cheetah and scripts in KS files > Actually, the error is 'Line ending expected' > > Aaron > > On 6/11/07, Aaron Lippold <lippold@xxxxxxxxx> wrote: > > Hi, > > > > When I tried that I got an 'end of line expected' now. > > > > Here is the code that I am trying to use in my ks file. > > > > FSTAB=/etc/fstab > > SED=/bin/sed > > # nosuid on /home > > if [ $(grep " \/home " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then > > MNT_OPTS=$(grep " \/home " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/home.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB} > > fi > > > > # nosuid on /sys > > if [ $(grep " \/sys " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then > > MNT_OPTS=$(grep " \/sys " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/sys.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB} > > fi > > > > # nosuid on /boot > > if [ $(grep " \/boot " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then > > MNT_OPTS=$(grep " \/boot " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/boot.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB} > > fi > > > > # nodev on /usr > > if [ $(grep " \/usr " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/usr " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/usr.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > #nodev on /home > > if [ $(grep " \/home " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/home " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/home.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > # nodev on /usr > > if [ $(grep " \/usr " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/usr " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/usr.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > # nodev on /usr/local > > if [ $(grep " \/usr\/local " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/usr\/local " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/usr\/local.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > # nodev on /tmp > > if [ $(grep " \/tmp " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/tmp " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/tmp.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > # nodev on /var > > if [ $(grep " \/var " ${FSTAB} | grep -c "nodev") -eq 0 ]; then > > MNT_OPTS=$(grep " \/var " ${FSTAB} | awk '{print $4}') > > ${SED} -i "s/\( \/var.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB} > > fi > > > > Thanks, > > > > Aaron > > > > On 6/8/07, Michael DeHaan <mdehaan@xxxxxxxxxx> wrote: > > > Aaron Lippold wrote: > > > > Hi All, > > > > > > > > I am having issues with cobbler and importing a ks file of mine. All > > > > is well with the simple parts of the %post section, but when I get to > > > > a bit of scripting, the Cheetah parser complains at '" \/home " > > > > ${FSTAB} ' etc. > > > > > > > > How can I escape this section or something? > > > > > > > > Thanks, > > > > > > > > Aaron > > > > > > Dollar signs need to be escaped with \$ since Cheetah is viewing the > > > shell invocations as Cheetah code. > > > > > > This is not true of something like $foosball, where it will just say as > > > "$foosball" if there is no key, but for something like ${foosball}, then > > > yes, it must be escaped. > > > > > > Unfortunate, I agree. If anyone has any suggestions on better > > > templating libraries that don't require something heinous like Kid's > > > XML, I'm all ears. Templating systems > > > all appear to have their ups and downs, which is apparently why everyone > > > seems to write their own. That's an option too, but I'm trying to not > > > go there :) > > > > > > --Michael > > > > > > > > > _______________________________________________ > > > et-mgmt-tools mailing list > > > et-mgmt-tools@xxxxxxxxxx > > > https://www.redhat.com/mailman/listinfo/et-mgmt-tools > > > > > > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/et-mgmt-tools > >