summaryrefslogtreecommitdiffstats
path: root/cobbler/action_import.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-20 13:09:46 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-20 13:09:46 -0400
commit41ec33b6dcfc5e75c3676d52775003a8a214ca55 (patch)
treeaa0e7bacb8e23f45580bf82ca3eeb26057554f29 /cobbler/action_import.py
parent6383aad6ed6f0edc5d42b8eb663af1d17cb295d1 (diff)
downloadthird_party-cobbler-41ec33b6dcfc5e75c3676d52775003a8a214ca55.tar.gz
third_party-cobbler-41ec33b6dcfc5e75c3676d52775003a8a214ca55.tar.xz
third_party-cobbler-41ec33b6dcfc5e75c3676d52775003a8a214ca55.zip
Make "cobbler import" work for Centos 5, also remove unneccessary loop from
import code.
Diffstat (limited to 'cobbler/action_import.py')
-rw-r--r--cobbler/action_import.py40
1 files changed, 19 insertions, 21 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index e4dbc11..c4c6e3a 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -27,9 +27,9 @@ WGET_CMD = "wget --mirror --no-parent --no-host-directories --directory-prefix %
RSYNC_CMD = "rsync -a %s %s %s/ks_mirror/%s --exclude-from=/etc/cobbler/rsync.exclude --delete --delete-excluded --progress"
TRY_LIST = [
- "Fedora", "RedHat", "Client", "Server", "Centos",
+ "Fedora", "RedHat", "Client", "Server", "Centos", "CentOS",
"Fedora/RPMS", "RedHat/RPMS", "Client/RPMS", "Server/RPMS", "Centos/RPMS",
- "RPMS"
+ "CentOS/RPMS", "RPMS"
]
class Importer:
@@ -133,23 +133,22 @@ class Importer:
base_dir = "/".join(kdir.split("/")[0:-2])
for try_entry in TRY_LIST:
- for dnames in [ "fedora", "centos", "redhat" ]:
- try_dir = os.path.join(base_dir, try_entry)
- if os.path.exists(try_dir):
- rpms = glob.glob(os.path.join(try_dir, "*release-*"))
- for rpm in rpms:
- if rpm.find("notes") != -1:
- continue
- results = self.scan_rpm_filename(rpm)
- if results is None:
- continue
- (flavor, major, minor) = results
- print "- determining best kickstart for %s %s" % (flavor, major)
- kickstart = self.set_kickstart(profile, flavor, major, minor)
- print "- kickstart=%s" % kickstart
- self.configure_tree_location(distro)
- self.distros.add(distro) # re-save
- self.api.serialize()
+ try_dir = os.path.join(base_dir, try_entry)
+ if os.path.exists(try_dir):
+ rpms = glob.glob(os.path.join(try_dir, "*release-*"))
+ for rpm in rpms:
+ if rpm.find("notes") != -1:
+ continue
+ results = self.scan_rpm_filename(rpm)
+ if results is None:
+ continue
+ (flavor, major, minor) = results
+ print "- determining best kickstart for %s %s" % (flavor, major)
+ kickstart = self.set_kickstart(profile, flavor, major, minor)
+ print "- kickstart=%s" % kickstart
+ self.configure_tree_location(distro)
+ self.distros.add(distro) # re-save
+ self.api.serialize()
# --------------------------------------------------------------------
@@ -413,7 +412,6 @@ class Importer:
match = True
continue
if not match:
- # print "- skipping: %s" % dirname
return
# try to find a kernel header RPM and then look at it's arch.
@@ -442,7 +440,7 @@ class Importer:
"""
dirname2 = "/".join(dirname.split("/")[:-2]) # up two from images, then down as many as needed
print "- scanning %s for architecture info" % dirname2
- result = {}
+ result = { "result" : "x86" } # default, but possibly not correct ...
os.path.walk(dirname2, self.arch_walker, result)
return result["result"]