[Spacewalk-list] Kickstart Snippets in Post Scripts (solved)

David Rock david at graniteweb.com
Sun Aug 8 04:54:44 UTC 2010


Ok,  I have managed to find the particular bit that fixes what I am
trying to do, so I thought it appropriate to share here.  I think it's
especially necessary to share because the current documentation is
woefully lacking in details about how snippets and templating work
within the confines of Satellite (and presumably spacewalk).

So, here is what I found:

Basically, what I was trying to do is use kickstart snippets in a %post
script, and was having issues because it wasn't working.  The short
answer is:  check the "Template" checkbox.  What that does is turns OFF
#raw/#end raw wrappers around the contents of the %post script contents.
By default, #raw/#end raw exists, and any $SNIPPET() calls that are made
in a %post script will not get parsed, and subsequently expanded, which
means the final kickstart file will not have the snippet contents.

Ok, so here's the real beef.  Finding this information is essentially
IMPOSSIBLE.  The template checkbox is not discussed at all in the Scripts
portion of the Satellite Reference Guide; 7.4.9.3.15.  It IS mentioned
in the Deployment Guide under 5.7.3.2 near the bottom, but only as a
note stated as:

   "All %pre and %post scripts created using the wizard style kickstarts
   are wrapped with #raw...#endraw by default. This can be toggled using
   the Template checkbox available when editing a %post or %pre script."

The exact implications of this are unclear, at best, and I only really
found it (and understood what it was saying) AFTER I stumbled across the
solution and had a better idea what to search for.  One of the important
implications is that when you turn off #raw so that your $SNIPPET()
calls work, there is a very real chance that other items in your script
will now not work because they are not properly escaped anymore.

There is a Tip on the interface next to this checkbox that says:

   "Enable this to enable templating on this script using cobbler"

This is also not entirely clear without the proper context of knowing
what you are looking for.  At a minimum, the basic Reference Guide
should acknowledge the existence of the template checkbox, either in the
kickstart section, or the template section, or the snippets section.  A
simple "this is what it is and what is does and why you care" would
suffice (i.e, if you want to use snippets in your %pre/%post scripts,
check this box; a much more obvious Tip, IMHO).

Even WITH all the bits I was able to find, I was still essentially
guessing how to use all of this.  The entire templating section in the
Deployment guide is completely useless. It only states in generalities
that templating is possible (which is not actually true, within the
context of using Satellite).  True templating can only be managed from
cobbler.  There is NO interface to manage templates from Satellite.
Most of the templating section describes the fact that you can create a
snippet, but does not tell you AT ALL how to use them.  

The links to the Template and Snippet information in the Cobbler wiki,
while reasonably descriptive, only describe how to use templating within
Cobbler and don't help at all in understanding how to use it in
Satellite.  It also just reaffirmed that snippets work ONLY in
templates, which is not clear in ANY of the Satellite documentation.

Bottom line: Since you MUST put a snippet in a template, the only
template that can be managed from the Satellite GUI is only for the %pre
and %post scripts, and only if you check the template checkbox.  It is
limited functionality, but at least it's something.  Don't get me wrong;
the way this works IS sufficient for what I need, but it was a LOT more
effort to dig out how it works than it should have been.  Just two or
three sentences in the templating or snippets section saying "to USE a
snippet, check this box and place the code here" would have saved me a
LOT of grief.

-- 
David Rock
david at graniteweb.com




More information about the Spacewalk-list mailing list