summaryrefslogtreecommitdiffstats
path: root/cobbler/action_import.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-10-16 16:39:19 -0400
committerJim Meyering <jim@meyering.net>2006-10-16 16:39:19 -0400
commitc3d68090295a776f1cc13ba1f5718a526adec6dc (patch)
treee52d9198346ba1c63e3f552e8b4481e6c5a8e7ba /cobbler/action_import.py
parentdc989463760d19c1e0ad41c0b6317f9753b93ac3 (diff)
downloadthird_party-cobbler-c3d68090295a776f1cc13ba1f5718a526adec6dc.tar.gz
third_party-cobbler-c3d68090295a776f1cc13ba1f5718a526adec6dc.tar.xz
third_party-cobbler-c3d68090295a776f1cc13ba1f5718a526adec6dc.zip
Numerous fixes to import code
Diffstat (limited to 'cobbler/action_import.py')
-rw-r--r--cobbler/action_import.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index cd19ed0..5f1f61d 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -52,8 +52,8 @@ class Importer:
self.path = path
self.mirror = mirror
self.mirror_name = mirror_name
- if path is None:
- raise cexceptions.CobblerException("import_failed","no path specified")
+ #if path is None:
+ # raise cexceptions.CobblerException("import_failed","no path specified")
self.distros = config.distros()
self.profiles = config.profiles()
self.systems = config.systems()
@@ -62,7 +62,7 @@ class Importer:
def run(self):
if self.path is None and self.mirror is None:
raise cexceptions.CobblerException("import_failed","no path specified")
- if not os.path.isdir(self.path):
+ 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://"):
@@ -73,9 +73,13 @@ class Importer:
# line option and not the default (?)
print "This will take a while..."
self.path = "/var/www/cobbler/localmirror/%s" % self.mirror_name
- cmd = "rsync -az %s /var/www/cobbler/localmirror/%s --progress" % self.mirror_name
+ try:
+ os.mkdir(self.path)
+ except:
+ raise cexceptions.CobblerException("couldn't create: %s" % (self.path))
+ cmd = "rsync -az %s /var/www/cobbler/localmirror/%s --progress" % (self.mirror, self.mirror_name)
sub_process.call(cmd,shell=True)
- update_file = os.path.open(os.path.join(self.path,"update.sh"))
+ update_file = open(os.path.join(self.path,"update.sh"))
update_file.write("#!/bin/sh")
update_file.write("%s\n" % cmd)
# leave this commented out in the file because it will