diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-12-12 16:44:20 -0500 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-12-12 16:44:20 -0500 |
commit | edec049f66add415f402e251b217c9f09f589e40 (patch) | |
tree | 5d0105157734f2425ea979113dfb9d86aa29d66f /cobbler/action_sync.py | |
parent | f24ee795f6296abc4643889bbb9d35b9fc128799 (diff) | |
download | third_party-cobbler-edec049f66add415f402e251b217c9f09f589e40.tar.gz third_party-cobbler-edec049f66add415f402e251b217c9f09f589e40.tar.xz third_party-cobbler-edec049f66add415f402e251b217c9f09f589e40.zip |
Preliminary support for repo mirroring.
Diffstat (limited to 'cobbler/action_sync.py')
-rw-r--r-- | cobbler/action_sync.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 31784f8..93f428a 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -44,7 +44,7 @@ class BootSync: self.profiles = config.profiles() self.systems = config.systems() self.settings = config.settings() - + self.repos = config.repos() def run(self,dryrun=False,verbose=True): """ @@ -191,7 +191,10 @@ class BootSync: if os.path.isfile(path): self.rmfile(path) if os.path.isdir(path): - if not x == "localmirror": + if not x in ["localmirror","repo_mirror","ks_mirror"] : + # new versions of cobbler use repo_mirror for repos and ks_mirror for + # basic kickstart tree core data. older versions just used "local_mirror" so we + # do have to leave the "localmirror" in there to avoid breaking users on upgrades self.rmtree(path) self.rmtree(os.path.join(self.settings.tftpboot, "pxelinux.cfg")) self.rmtree(os.path.join(self.settings.tftpboot, "images")) @@ -278,12 +281,27 @@ class BootSync: distro.ks_meta, g.ks_meta, )) + meta["yum_repo_stanza"] = self.generate_repo_stanza(g) self.apply_template(kickstart_path, meta, dest) except: traceback.print_exc() # leave this in, for now... msg = "err_kickstart2" raise cexceptions.CobblerException(msg,kickstart_path,dest) + def generate_repo_stanza(self, profile): + # returns the line of repo additions (Anaconda supports in FC-6 and later) that adds + # the list of repos to things that Anaconda can install from. This corresponds + # will replace "TEMPLATE::yum_repo_stanza" in a cobbler kickstart file. + buf = "" + repos = profile.repos.split(" ") + for r in repos: + repo = self.repos.find(r) + if repo is None: + raise cexceptions.CobblerException("no_repo",r) + http_url = "http://%s/repo_mirror/%s" % (self.settings.server, repo.name) + buf = buf + "repo --name=%s --baseurl=%s\n" % (repo.name, http_url) + return buf + def validate_kickstarts_per_system(self): """ PXE provisioning needs kickstarts evaluated per system. @@ -312,6 +330,7 @@ class BootSync: profile.ks_meta, s.ks_meta )) + meta["yum_repo_stanza"] = self.generate_repo_stanza(profile) self.apply_template(kickstart_path, meta, dest) except: msg = "err_kickstart2" |