diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-16 17:51:37 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-16 17:51:37 -0400 |
commit | 3b5617844e91d5d9febf391ca389230e3ba9d7cb (patch) | |
tree | 7875c9ce954faaae31d6e6101d60e8569a7f2060 /cobbler/action_import.py | |
parent | 9a543ce6800a3c42f24429416072e16d9059001f (diff) | |
download | third_party-cobbler-3b5617844e91d5d9febf391ca389230e3ba9d7cb.tar.gz third_party-cobbler-3b5617844e91d5d9febf391ca389230e3ba9d7cb.tar.xz third_party-cobbler-3b5617844e91d5d9febf391ca389230e3ba9d7cb.zip |
(A) using http:// or ftp:// for cobbler imports is an error, and (B) allow imports across symlinks
Diffstat (limited to 'cobbler/action_import.py')
-rw-r--r-- | cobbler/action_import.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 5789ae0..d1fd7ab 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -80,11 +80,11 @@ class Importer: if not self.mirror.endswith("/"): self.mirror = "%s/" % self.mirror - if self.mirror.startswith("http://"): + if self.mirror.startswith("http://") or self.mirror.startswith("ftp://") or self.mirror.startswith("nfs://"): # http mirrors are kind of primative. rsync is better. # that's why this isn't documented in the manpage. # TODO: how about adding recursive FTP as an option? - self.run_this(WGET_CMD, (self.settings.webdir, self.mirror_name, self.mirror)) + raise CX(_("unsupported protocol")) else: # use rsync.. no SSH for public mirrors and local files. # presence of user@host syntax means use SSH @@ -310,11 +310,22 @@ class Importer: initrd = None kernel = None - - if not self.is_relevant_dir(dirname): - return + + # NOTE: can't make this optomization anymore since we may have to re-invoke + # walk for symlinks. + # + # + #if not self.is_relevant_dir(dirname): + # print "DEBUG: %s is not relevant" % dirname + # return for x in fnames: + + fullname = os.path.join(dirname,x) + if os.path.islink(fullname) and os.path.isdir(fullname): + print "- following symlink: %s" % fullname + os.path.walk(fullname, self.distro_adder, {}) + if x.startswith("initrd"): initrd = os.path.join(dirname,x) if x.startswith("vmlinuz"): @@ -324,6 +335,8 @@ class Importer: path_parts = kernel.split("/")[:-2] comps_path = "/".join(path_parts) + + # ---------------------------------------------------------------------- def repo_finder(self): @@ -342,6 +355,7 @@ class Importer: def repo_scanner(self,distro,dirname,fnames): + print "DEBUG: repo scanner for %s" % dirname for x in fnames: if x == "base": # don't do "repodata" self.process_comps_file(dirname, distro) |