diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-12-13 17:21:20 -0500 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-12-13 17:21:20 -0500 |
commit | 3f5908135cfe81bc15333fad015edb7c7d6ded86 (patch) | |
tree | 3017fe9ac1578ebd4dc801cb493784824da3f83a | |
parent | 3e56da3ca7a1a856e64ba8039d9617582852f14a (diff) | |
download | third_party-cobbler-3f5908135cfe81bc15333fad015edb7c7d6ded86.tar.gz third_party-cobbler-3f5908135cfe81bc15333fad015edb7c7d6ded86.tar.xz third_party-cobbler-3f5908135cfe81bc15333fad015edb7c7d6ded86.zip |
Remaining parts of integrating yum.repos.d file configuration with repo mirroring.
-rw-r--r-- | cobbler/action_reposync.py | 17 | ||||
-rw-r--r-- | cobbler/action_sync.py | 6 |
2 files changed, 20 insertions, 3 deletions
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py index f067aee..cbd69d0 100644 --- a/cobbler/action_reposync.py +++ b/cobbler/action_reposync.py @@ -84,6 +84,21 @@ class RepoSync: print "- walking: %s" % dest_path os.path.walk(dest_path, self.createrepo_walker, arg) + if repo.local_filename is not None and repo.local_filename != "": + # this is a rather primative configuration in terms of yum options, but allows + # for repos that were added with a value for --local-filename to provision a system + # using a kickstart that will write the yum config for that repo (named whatever + # was used for local_filename) in /etc/yum.repos.d ... see code in action_sync.py + # that relies on this and for more info about how this is added to %post kickstart + # templating. + config_file = open(os.path.join(dest_path,"config.repo"),"w+") + config_file.write("[%s]\n" % repo.local_filename) + config_file.write("baseurl=http://%s/cobbler/repo_mirror/%s\n" % (self.settings.server, repo.name)) + config_file.write("enabled=1\n") + config_file.write("gpgcheck=0\n") + config_file.close() + + def createrepo_walker(self, arg, dirname, fname): target_dir = os.path.dirname(dirname).split("/")[-1] print "- scanning: %s" % target_dir @@ -95,4 +110,4 @@ class RepoSync: except: print "- createrepo failed. Is it installed?" fnames = [] # we're in the right place - + diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 1b5bbf5..2e20535 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -305,14 +305,14 @@ class BootSync: def generate_config_stanza(self, profile): # returns the line in post that would configure yum to use repos added with "cobbler repo add" - repos = profile.respos.split(" ") + repos = profile.repos.split(" ") buf = "" for r in repos: repo = self.repos.find(r) if repo is None: raise cexceptions.CobblerException("no_repo",r) if not (repo.local_filename is None and repo.local_filename != ""): - buf = buf + "wget http://%s/cobbler/repo_mirror/this.repo -O /etc/yum.repos.d/%s.repo" % (self.settings.server, repo.name, repo.local_filename) + buf = buf + "wget http://%s/cobbler/repo_mirror/%s/config.repo -O /etc/yum.repos.d/%s.repo" % (self.settings.server, repo.name, repo.local_filename) return buf def validate_kickstarts_per_system(self): @@ -327,6 +327,8 @@ class BootSync: for s in self.systems: profile = self.profiles.find(s.profile) + if profile is None: + raise cexceptions.CobblerException("orphan_profile2",s.name,s.profile) distro = self.distros.find(profile.distro) kickstart_path = utils.find_kickstart(profile.kickstart) if kickstart_path and os.path.exists(kickstart_path): |