[et-mgmt-tools] Adding a distribution - where do I put the files?

Michael DeHaan mdehaan at redhat.com
Thu Feb 22 15:57:03 UTC 2007


Msquared wrote:
> I'm having some trouble understanding where everything goes under cobbler.
>
> If I use 'cobbler import' or 'cobbler distro add', do I put the files
> somewhere in /var/www/cobbler first?
>   

Cobbler will do this for you. The purpose of cobbler distro add is to 
register the locations of the files you are interested provisioning. 
Cobbler will automagically copy them to the right locations needed to 
enable provisioning (which reside in /tftpboot and /var/www/cobbler, 
respectively). If you want to force cobbler to "re-do" this, just run 
"cobbler sync".

If you are passing in an rsync mirror to "cobbler import", cobbler 
_does_ copy files for the rest of the tree (not just the kernel/initrd), 
and this is actually a pretty powerful way to start off. What happens 
then is you create a local mirror of whatever distribution, including 
the entire kickstart tree. This makes local provisioning very very fast. 
However, if you already have the operating system tree locally, that's 
not as important.

You really don't want to be copying files by hand into the 
/var/www/cobbler directory, as cobbler will want to manage the contents 
of this directory itself. If you have a kickstart tree you just want to 
make available, (and you don't want to do the rsync:// import, which is 
really a great way to do this), it's easy enough to just copy that tree 
into your apache root /var/www/html or even cobbler's 
reserved-for-random-uses-of-people-who-know-what-they-are-doing 
directory /var/www/cobbler/local_mirror. In general though, I don't 
expect people to have to do that -- they either are using a http://, 
ftp://, or nfs:// kickstart tree someone else has already set up, or 
they'll be doing an import from a rync mirror to establish a new 
kickstart tree themselves that they can use for provisioning.
> It seems that 'cobbler import' doesn't actually copy files for me, so I'm
> not really sure what it does.
>
>
> The walkthrough at http://wiki.xdroop.com/space/RedHat/kickstart/Cobbler
> doesn't seem to help me, as it doesn't tell me what I need to put where.
>
> I've tried to copy the contents of my Fedora 6 DVD to
> /var/www/cobbler/kickstarts/Fedora6 and run 'cobbler import
> --path=/var/www/cobbler/kickstarts/Fedora6', and then run 'cobbler list',
> but the output looks nothing like the output presented on
> http://wiki.xdroop.com/space/RedHat/kickstart/Cobbler, instead it looks
> like this:
>   
First off, I do have to thank Dave a lot for making Cobbler posts on his 
site. Cobbler has changed just a little bit those original articles are 
written, and you should probably be looking at the latest manpage -- 
http://cobbler.et.redhat.com/cobbler.html

The long-output command that generates what's on Dave's site is now 
"cobbler report", and "cobbler list" has been abbreviated to make it 
more usable. That's why the output looks different.
> Distros:
>   var_www_cobbler_kickstarts_Fedora6_images_pxeboot
>   var_www_cobbler_kickstarts_Fedora6_images_xen
> Repos:
> Profiles:
>   var_www_cobbler_kickstarts_Fedora6_images_pxeboot
>   var_www_cobbler_kickstarts_Fedora6_images_xen
> Systems:
>   
This actually looks fine, as it shows cobbler has imported 2 distros and 
made a profile for each of them. That's good.
>
> I can't seem to get 'cobbler distro add' to work either, not that I'm
> entirely sure what it does.  Where does it get the repository files from?
> Do I need to do some preparation of the files from the DVD, or download a
> mirror first?
>   
Cobbler has a tiered concepts of Distributions, Profiles, and Systems. 
Distributions contain kernel and initrd information. Profiles
take Distributions and add kickstarts to them. Systems contain Profile 
information and potentially some system specific information. Whenever 
you run these commands, it updates the cobbler "database" in 
/var/lib/cobbler/* -- and will copy files needed around to locations in 
/tftpboot and /var/www/cobbler. So these commands are doing something :)

If you want to download from a mirror, the best way to do that is to 
skip "distro add" altogether and just do:

cobbler import --mirror=rsync://blah --mirror-name=blah

as mentioned in the manpage. That sets you up with a local mirror of 
everything you need, with the kickstart files configured appropriately 
to point into that tree over http:// -- fully automatic installs that 
you can customize later as needed. More advanced use cases will require 
running distro add commands manually, but if you just want a small lab 
setup for PXE booting Fedora and a few other distros, doing an rsync:// 
import isn't a bad way to go and will pretty much fill out "reasonably 
sane" kickstarts for you automatically.

> I tried to run cobbler distro add but ended up with a very strange error:
>
>   cobbler distro add --name=myxendistro
> --kernel=/var/www/cobbler/kickstarts/Fedora6/images/xen/vmlinuz
> --initrd=/var/www/cobbler/kickstarts/Fedora6/images/xen/initrd.img
>
> The result is:
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 505, in main
>     BootCLI(sys.argv).run()
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 102, in run
>     self.curry_args(self.args[1:], self.commands['toplevel'])
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 421, in curry_args
>     commands[args[0]](args[1:])
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 469, in distro
>     return self.curry_args(args, self.commands['distro'])
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 421, in curry_args
>     commands[args[0]](args[1:])
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 386, in distro_edit
>     return self.apply_args(args,commands,on_ok)
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 409, in apply_args
>     on_ok()
>   File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 385, in <lambda>
>     on_ok = lambda: self.api.distros().add(distro, with_copy=self.api.sync_flag)
>   File "/usr/lib/python2.4/site-packages/cobbler/collection.py", line 97, in add
>     lite_sync.add_single_distro(ref.name)
>   File "/usr/lib/python2.4/site-packages/cobbler/action_litesync.py", line 60, in add_single_distro
>     self.sync.write_distro_file(distro)
>   File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 733, in write_distro_file
>     clone.kernel_options = self.hash_to_string(clone.kernel_options)
>   File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 885, in hash_to_string
>     buffer = buffer + key + "=" + value + " "
> TypeError: cannot concatenate 'str' and 'int' objects
>   

Hmm, this worked fine for me but what I imagine is happening is that 
somewhere in the configuration files, some of the parameters are being 
stored as integers instead of strings. Not being able to reproduce this, 
but just looking at the code, this looks like a fix:

diff -r fbdb0203b3ee41519942c705ec800333b70c3365 cobbler/action_sync.py
--- a/cobbler/action_sync.py Wed Feb 21 10:30:33 2007 -0500
+++ b/cobbler/action_sync.py Thu Feb 22 10:44:21 2007 -0500
@@ -874,8 +874,8 @@ class BootSync:
for key in hash:
value = hash[key]
if value is None:
- buffer = buffer + key + " "
+ buffer = buffer + str(key) + " "
else:
- buffer = buffer + key + "=" + value + " "
+ buffer = buffer + str(key) + "=" + str(value) + " "
return buffer

The question is how did they get this way? I don't know, as unless the 
files in /var/lib/cobbler were edited directly, I would expect that file 
to contain strings as opposed to integers -- if you want to email me 
your /var/lib/cobbler/distros file, that would be useful in tracking 
down the problem.

>
> Any ideas?
>
> Regards, Msquared...
>
> _______________________________________________
> et-mgmt-tools mailing list
> et-mgmt-tools at redhat.com
> https://www.redhat.com/mailman/listinfo/et-mgmt-tools
>   




More information about the et-mgmt-tools mailing list