From 8beee322aa60f9ac1a947e70eedccec665af18c9 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 4 Apr 2007 17:41:29 -0400 Subject: --- cobbler/action_import.py | 5 +++-- cobbler/action_reposync.py | 26 +++++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'cobbler') diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 1f35b44..d6885e9 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -121,8 +121,9 @@ class Importer: for profile in self.profiles: distro = self.distros.find(profile.distro) - if distro is None: - raise cexceptions.CobblerException("orphan_distro2",profile.name,profile.distro) + if distro is None or not (distro in self.distros_added): + print "- skipping distro %s since it wasn't imported this time" % profile.distro + continue if not distro.kernel.startswith("%s/ks_mirror/" % self.settings.webdir): # this isn't a mirrored profile, so we won't touch it print "- skipping %s since profile isn't mirrored" % profile.name diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py index fb6fdf6..5cab392 100644 --- a/cobbler/action_reposync.py +++ b/cobbler/action_reposync.py @@ -54,11 +54,11 @@ class RepoSync: print "considering: %s" % repo repo_path = os.path.join(self.settings.webdir, "repo_mirror", repo.name) mirror = repo.mirror - if not os.path.isdir(repo_path): + if not os.path.isdir(repo_path) and not repo.mirror.lower().startswith("rhn://"): os.makedirs(repo_path) # if path contains http:// or ftp://, use with yum's reposync. # else do rsync - if mirror.lower().find("http://") != -1 or mirror.lower().find("ftp://") != -1: + if mirror.lower().find("http://") != -1 or mirror.lower().find("ftp://") or mirror.lower().find("rhn://") != -1: self.do_reposync(repo) else: self.do_rsync(repo) @@ -80,13 +80,25 @@ class RepoSync: store_path = os.path.join(self.settings.webdir, "repo_mirror") dest_path = os.path.join(store_path, repo.name) temp_path = os.path.join(store_path, ".origin") - if not os.path.isdir(temp_path): + if not os.path.isdir(temp_path) and not repo.mirror.lower().startswith("rhn://"): os.makedirs(temp_path) - temp_file = self.create_local_file(repo, temp_path, output=False) - - cmd = "/usr/bin/reposync --config=%s --repoid=%s --tempcache --download_path=%s" % (temp_file, repo.name, store_path) - print "- %s" % cmd + + if not repo.mirror.lower().startswith("rhn://"): + cmd = "/usr/bin/reposync --config=%s --repoid=%s --download_path=%s" % (temp_file, repo.name, store_path) + print "- %s" % cmd + else: + rest = repo.mirror[6:] + cmd = "/usr/bin/reposync -r %s --download_path=%s" % (rest, store_path) + print "- %s" % cmd + # downloads using -r use the value given for -r as part of the output dir, so create a symlink with the name the user + # gave such that everything still works as intended. + print "- %s" % dest_path + if not os.path.exists(dest_path): + from1 = os.path.join(self.settings.webdir, "repo_mirror", rest) + print "- symlink: %s -> %s" % (from1, dest_path) + os.symlink(from1, dest_path) rc = sub_process.call(cmd, shell=True) + temp_file = self.create_local_file(repo, temp_path, output=False) if rc !=0: raise cexceptions.CobblerException("cobbler reposync failed") arg = None -- cgit