summaryrefslogtreecommitdiffstats
path: root/cobbler/action_reposync.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-04 17:41:29 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-04-04 17:41:29 -0400
commit8beee322aa60f9ac1a947e70eedccec665af18c9 (patch)
tree2fb47b32b4d3df322d93e4d4eea0eacfcf3319de /cobbler/action_reposync.py
parent5109a32f333c9aceb978e1dd2887191ee1f9fdf6 (diff)
downloadthird_party-cobbler-8beee322aa60f9ac1a947e70eedccec665af18c9.tar.gz
third_party-cobbler-8beee322aa60f9ac1a947e70eedccec665af18c9.tar.xz
third_party-cobbler-8beee322aa60f9ac1a947e70eedccec665af18c9.zip
Diffstat (limited to 'cobbler/action_reposync.py')
-rw-r--r--cobbler/action_reposync.py26
1 files changed, 19 insertions, 7 deletions
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