Charles Duffy wrote:
Howdy, 'yall. I'm having some trouble using the new
templating support
in the devel branch (77f5e38b097e79d5d0de3e994dad54f381bb706f).
$ BASEURL=http://localhost/cblr/svc/op/template
$ cobbler profile edit \
> --name=CentOS-5.1-x86_64 \
> --template-files=/local/templates/racadm.ini=racadm.ini
Tip: The right hand side of the --template-files invocation should be a
full destination path on the filesystem (iwhere racadm.ini goes)
$ cobbler sync
$ cobbler system dumpvars --name=00:16:3e:67:2b:43 | grep template_files
'template_files': {'/local/templates/racadm.ini':
'racadm.ini'},
$ curl ${BASEURL}/system/00:16:3e:c9:95:47/path/racadm.ini
# template path not found for specified profile
$ curl ${BASEURL}/profile/CentOS-5.1-x86_64/path/racadm.ini
# template path not found for specified profile
This is not the URL that serves up the template form mod_python. If you
have the new sample.ks, you'll see the macro at the bottom is
$SNIPPET('download_config_files')
Which is a snippet in /var/lib/cobbler/snippets once installed. The
purpose of the snippet is to build all the magic URLs for the user, so
they don't have to figure out what they are themselves.
If you look inside that snippet, you will see the code that builds the
URLs contains the following line:
#set $turl =
"http://"+$http_server+"/cblr/svc/op/template/"+$ttype+"/"+$tname+"/path/"+$tpath
If you ever want to see how a kickstart file expands, the best way is to
look at it:
cobbler system getks --name=foo
That will print out the kickstat and you can see the wgets at the bottom
of it.
These URLs are also of the form the new koan uses when you use:
koan --server=cobbler.example.org --update-files --system=name
Basically koan will wget the above URLs from the template server from
the right file locations.
Since we're checking in cobbler.api for
template_results.has_key(path),
I made the error a bit more verbose, printing path.keys() as part of the
error message, and attempting other variants:
$ curl ${BASEURL}/system/00:16:3e:c9:95:47/path/racadm.ini
# template path not found for specified system (options: [])
$ curl ${BASEURL}/profile/CentOS-5.1-x86_64/path/racadm.ini
# template path not found for specified profile (options:
['/var/www/cobbler/rendered/racadm.ini'])
$ curl
${BASEURL}/profile/CentOS-5.1-x86_64/path//var/www/cobbler/rendered/racadm.ini
# template path not found for specified profile (options: [])
$ curl
${BASEURL}/profile/CentOS-5.1-x86_64/path/_var_www_cobbler_rendered_racadm.ini
# template path not found for specified profile (options: [])
Yes, all of the above URLs are wrong, was there somewhere in the docs
that pointed to those being the URL formats? If so, I want to correct them.
All the magic URLs are also documented here:
https://fedorahosted.org/cobbler/wiki/ModPythonDetails
Though the nice thing is cobbler never really makes the user understand
these URLs, as the above SNIPPET builds those for the user and koan also
knows what they are.
--Michael
_______________________________________