I noticed that the symlinks in the links dir for ESX hosts being
replicated were linking to /var/www/cobbler/ks_mirror instead of the
distro. The link_distro function in utils.py does this:
dirname = os.path.dirname(distro.kernel)
base = os.path.split(os.path.split(dirname)[0])[0]
dest_link = os.path.join(settings.webdir, "links", distro.name)
VMware Kernel : /var/www/cobbler/ks_mirror/esx-4.1-x86_64/isolinux/vmlinuz
RHEL Kernel : /var/www/cobbler/ks_mirror/rhel6.1-x86_64/images/pxeboot/vmlinuz
>>> import os
>>> dirname =
>>> os.path.dirname("/var/www/cobbler/ks_mirror/rhel6.1-x86_64/images/pxeboot/vmlinuz")
>>> base = os.path.split(os.path.split(dirname)[0])[0]
>>> print base
/var/www/cobbler/ks_mirror/rhel6.1-x86_64
>>> dirname =
>>> os.path.dirname("/var/www/cobbler/ks_mirror/esx-4.1-x86_64/isolinux/vmlinuz")
>>> base = os.path.split(os.path.split(dirname)[0])[0]
>>> print base
/var/www/cobbler/ks_mirror
>>>
This patch should hopefully make it work for all distros.
Thanks,
Jonathan
From 246dae78d466e3595104c004bbe3d8d1de9a9ab4 Mon Sep 17 00:00:00 2001
From: Jonathan Sabo <[email protected]>
Date: Wed, 22 Jun 2011 16:35:59 -0400
Subject: [PATCH 2/2] Fix cobbler replication for non-RHEL hosts. The slicing used in the link_distro function didn't work for all distros.
---
cobbler/utils.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 360728b..7d68490 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -2061,8 +2061,7 @@ def dhcpconf_location(api):
def link_distro(settings, distro):
# find the tree location
- dirname = os.path.dirname(distro.kernel)
- base = os.path.split(os.path.split(dirname)[0])[0]
+ base = os.path.join((settings.webdir, "ks_mirror", distro.name)
dest_link = os.path.join(settings.webdir, "links", distro.name)
# create the links directory only if we are mirroring because with
--
1.7.4.1
_______________________________________________
cobbler-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler-devel