prefered interface question...

Scott Henson shenson at redhat.com
Wed May 19 15:55:14 UTC 2010


Excerpts from Douglas Kilpatrick's message of Tue May 18 15:55:40 -0400 2010:
> I'm writing a smart tftp server to do on-the-fly file templating and 
> substitutions.
> 
> (This is to make it easier to support multiple versions of FreeBSD, 
> which needs to boot by their pxeboot loader, which doesn't do 
> pxelinux-like tricks to get per-host files)
> 
> 1. Should I use cobbler.api, or XMLRPC?
>     XMLRPC allows the tftp server to run on a different node than the
>     cobbler server, but adds authorization headaches. (bot-accounts, etc)

Use XMLRPC, if you look in cobbler.utils, there is a get_shared_secret
function that can let you authenticate as <DIRECT>.  The following
code should get you going.

"""
username = '<DIRECT>'
password = cobbler.utils.get_shared_secret()
remote = xmlrpclib.Server(url_cobbler_api, allow_none=True)
token = remote.login(username, password)
remote.update(token)
"""

In cobbler 2.2, I intend to make cobbler.api.BootAPI take care of all
this for you, but right now it directly accesses the config store and
can cause some very bad problems.  I would strongly suggest that
everyone avoid using BootAPI until cobbler 2.2.

> 2. Using cobbler.api causes something that feels a lot like caching.
>     Client connects to my tftp server and the servers looks it up via
>     cobbler.  I then use the web page to change something.  Subsequent
>     lookups from the server result in the old information, but restarting
>     the server causes it to get new information
> 
>     Is there a better solution that considering the cobbler-handle a per-
>     request resource?

This is the above problem with the BootAPI.  Cobblerd does extensive
caching and can cause these problems.  If you stop cobblerd before you
start operating, and then start it after you are done, it should be
relatively safe.

> 3. I'm not quite sure I understand how Item.template_files is used.  Is
>     this something I can use ("if the client asks for mfsroot.gz, give
>     then /var/www/cobbler/ks_mirror/$distro/boot/mfs-pxe.gz") or should I
>     add another similar attribute?

I think template_files relates to cobbler/koan's configuration
management operations.  I would look at how cobbler templates the
kickstart files (kickgen.py) and try to share code with that if
possible.  This should give you a good start.

-- 
Scott Henson
Red Hat CIS Operator
WVU Alum BSAE/BSME


More information about the cobbler-devel mailing list