Red Hat Bugzilla – Bug 749667
Regression importing Red Hat distros with 'cobbler import
Last modified: 2012-04-21 09:18:11 EDT
cobbler import --name=xdist-rhel6-latest --path=/mnt/data/devel/trees/rhel6-latest --available-as=http://192.168.1.149/trees/rhel6-latest
No longer works for me with latest f16 cobbler. It worked with cobbler 2.0 IIRC.
The following patch fixes a few issues, pasted inline for explaination:
--- cobbler/modules/manage_import_redhat.py 2011-10-05 20:49:16.000000000 -0400
+++ /usr/lib/python2.7/site-packages/cobbler/modules/manage_import_redhat.py 2011-10-27 16:24:47.905975596 -0400
@@ -246,7 +246,7 @@ class ImportRedhatManager:
if not self.network_root.endswith("/"):
self.network_root = self.network_root + "/"
- self.path = os.path.normpath( self.mirror )
+ self.path = self.rootdir = os.path.normpath( self.mirror )
valid_roots = [ "nfs://", "ftp://", "http://" ]
for valid_root in valid_roots:
rootdir needs to match self.path here, otherwise rootdir was pointing to somewhere under /var, when we need it to point to the media being imported.
@@ -273,6 +273,10 @@ class ImportRedhatManager:
# FIXME: this automagic is not possible (yet) without mirroring
+ if not distros_added:
+ "Failed to detect any distros in %s" % self.path)
# find the most appropriate answer files for each profile object
This makes 'cobbler import' appropriately fail if no distros are actually successfully detected from the passed tree.
@@ -281,11 +285,12 @@ class ImportRedhatManager:
# ensure bootloaders are present
# required function for import modules
- return ["i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64", "x86",]
+ return ["i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64"]
# required function for import modules
Ignoring the accidental whitespace change, this removes x86 from the expected package arch list. AFAIK red hat has never used 'x86' in RPM package strings. It's a problem anyways, because x86 will always also match x86_64, so importing an x86_64 distro will cause problems since cobbler detects it as a multiarch tree.
self.get_entry should also be changed to never return None (which it does in 2 error paths), since callers expect a list for a return value. The offending areas should probably just use utils.die.
Created attachment 530565 [details]
Fix various issues importing RH distros
A couple more fixes were needed for importing an F16 tree. The first basic one is that fedora16 needs to be added to the whitelist in cobblers/codes.py
Second problem is that scanning an x86_64 tree is again detecting 2 architectures, because the kernel package scanning is picking up an i686 kernel-tools package. This patch fixes that:
@@ -835,12 +844,22 @@ class ImportRedhatManager:
Is the given filename a kernel filename?
+ blacklist = ["kernel-tools"]
+ whitelist = ["kernel-header", "kernel-source", "kernel-smp",
+ "kernel-largesmp", "kernel-hugemem", "linux-headers-",
+ "kernel-devel", "kernel-"]
if not filename.endswith("rpm") and not filename.endswith("deb"):
- for match in ["kernel-header", "kernel-source", "kernel-smp", "kernel-largesmp", "kernel-hugemem", "linux-headers-", "kernel-devel", "kernel-"]:
+ for match in blacklist:
+ if filename.find(match) != -1:
+ return False
+ for match in whitelist:
if filename.find(match) != -1:
def scan_pkg_filename(self, rpm):
Yall should probably be parsing .treeinfo files for red hat distros, it's much much easier. Would also be nice to have some logic that makes an unknown fedora value just default to the highest supported fedora OS. We do similar things in python-virtinst:
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
I believe this has been fixed in the most recent release (2.2.x). Can you please verify if this is still an issue? I have imported SL6 on a F16 system running cobbler without issue.
Things don't obviously fail like previously, but now there is a very annoying change in behavior.
I have a RHEL6 tree on my local machine. I want cobbler to learn about it and advertise a kickstart for it. I don't want it to copy it to it's preferred location.
sudo cobbler import --name=xdist-rhel6-latest --path=/mnt/data/devel/trees/rhel6-latest --available-as=http://192.168.1.149/trees/rhel6-latest
Previously the above invocation was a very quick operation. With current version from updates-testing, it begins rsyncing the distro tree to /var/www/cobbler/ks_mirror/xdist-rhel6-latest which would leave 2 copies on my physical machine.
Maybe there was a regression and import just isn't taking into account --available-as ?
Actually it looks like the change was deliberate (and done by you) :)
But the commit message provides little justification for this change. All the cobbler documentation for --available-as touted its main feature that it didn't try and mirror the distro to another location. So this change is a regression and an API break since the cli tool is the admin's API to cobbler.
IMO this change should be reverted. If you need a way to pass to specify network_root but still do the mirroring, what you want is a new cli option to force mirroring, not changing existing option semantics.
My workflow has me regularly blow away and reimport distros with cobbler (I'm a virt developer and use pxe to advertise multiple distros).
Yes, that is correct. That commit was to address a chicken & egg problem with the new import modules, which have to scan files before they can figure out what distro to import. Doing the full rsync was supposed to be a stop-gap measure so that --available-as imports didn't fail outright (which was the situation before).
I will start working on correcting this situation, which is going to involve using a file containing a whitelist of just the files it needs to rsync while excluding the rest. This bug will be closed as fixed, and I'll open a new issue on github to track the fix if that works for you.
Got this working for RedHat-based distros: http://pastebin.com/qSYeW973
As you can see, the downloaded data for Centos 5.8 was just 78M - much better than the full DVD (or more). I should get the rest of the distros fixed up the same way, and will aim to get fix in 2.2.3.
Sounds good, thanks James. I'd also appreciate a redhat bugzilla so I can track when the issue is fixed in fedora.
That's fine, I'll just leave this open as well. The github issue is https://github.com/cobbler/cobbler/issues/138
Code merged into master to correct this: https://github.com/cobbler/cobbler/pull/145
If there's enough testing we may be able to get it into 2.2.3, otherwise it will be in 2.2.4.