diff options
author | David Lutterkort <dlutter@redhat.com> | 2006-10-25 10:26:37 -0700 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-10-25 10:26:37 -0700 |
commit | 1ba62867b46323e6b53b5233be300b4faae2458d (patch) | |
tree | 6f1b44557338082655e9e0ab3f85604797e65b4b /cobbler/action_import.py | |
parent | 679d35e42dfc3ae181167522dc1f171dcf008a84 (diff) | |
download | third_party-cobbler-1ba62867b46323e6b53b5233be300b4faae2458d.tar.gz third_party-cobbler-1ba62867b46323e6b53b5233be300b4faae2458d.tar.xz third_party-cobbler-1ba62867b46323e6b53b5233be300b4faae2458d.zip |
Merge 243:1f764e5dd1cc
Diffstat (limited to 'cobbler/action_import.py')
-rw-r--r-- | cobbler/action_import.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 69bfa97..486842e 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -85,18 +85,19 @@ class Importer: if self.path and not os.path.isdir(self.path): raise cexceptions.CobblerException("import_failed","bad path") if self.mirror is not None: - if not self.mirror.startswith("rsync://"): - raise cexceptions.CobblerException("import_failed","expecting rsync:// url") if self.mirror_name is None: raise cexceptions.CobblerException("import_failed","must specify --mirror-name") print "This will take a while..." self.path = "/var/www/cobbler/localmirror/%s" % self.mirror_name try: - os.mkdir(self.path) + os.makedirs(self.path) except: if not os.path.exists(self.path): raise cexceptions.CobblerException("couldn't create: %s" % (self.path)) - cmd = "rsync -az %s /var/www/cobbler/localmirror/%s --progress" % (self.mirror, self.mirror_name) + spacer = "" + if not self.mirror.startswith("rsync://"): + spacer = ' -e "ssh" ' + cmd = "rsync -az %s %s /var/www/cobbler/localmirror/%s --progress" % (spacer, self.mirror, self.mirror_name) sub_process.call(cmd,shell=True) update_file = open(os.path.join(self.path,"update.sh"),"w+") update_file.write("#!/bin/sh") @@ -186,7 +187,7 @@ class Importer: if tentative == filter_out: fnames.remove(tentative) print "%s" % dirname - if not self.is_pxe_or_xen_dir(dirname): + if not self.is_pxe_or_virt_dir(dirname): return for x in fnames: if x.startswith("initrd"): @@ -235,8 +236,8 @@ class Importer: return "x86" return "x86" - def is_pxe_or_xen_dir(self,dirname): - if dirname.find("pxe") != -1 or dirname.find("xen") != -1: + def is_pxe_or_virt_dir(self,dirname): + if dirname.find("pxe") != -1 or dirname.find("xen") != -1 or dirname.find("virt") != -1: return True return False |