From f30aa5c121702d9706daf2eddac8b043dae7f827 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 9 Nov 2007 15:27:39 -0500 Subject: Since reposync (yum-utils >1.0.4) works with rhn_yum_plugin again, make some fixes to enable repo handling to work better. Repos are no longer symlinked so if a name of a repository is specified that uses a channel, the repo must be named after the channel.Tested with yum-utils 1.0.4 and works fine. --- CHANGELOG | 1 + cobbler/action_reposync.py | 13 +++---------- cobbler/item_repo.py | 7 +++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b8cc7e2..ee932c0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Cobbler CHANGELOG * Thu Nov 07 2007 - 0.6.4 - Changed permissions of auth.conf +- Fixes for working with rhn_yum_plugin * Wed Nov 07 2007 - 0.6.3 - Be able to define and use Multiple NICs per system diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py index fdd9c3a..74a4d0d 100644 --- a/cobbler/action_reposync.py +++ b/cobbler/action_reposync.py @@ -153,6 +153,9 @@ class RepoSync: print _("- warning: --rpm-list is not supported for RHN content") rest = repo.mirror[6:] # everything after rhn:// cmd = "/usr/bin/reposync -r %s --download_path=%s" % (rest, store_path) + if repo.name != rest: + args = { "name" : repo.name, "rest" : rest } + raise CX(_("ERROR: repository %(name)s needs to be renamed %(rest)s as the name of the cobbler repository must match the name of the RHN channel") % args) if repo.arch != "": cmd = "%s -a %s" % (cmd, repo.arch) @@ -160,16 +163,6 @@ class RepoSync: print _("- %s") % cmd cmds.append(cmd) - # downloads using -r use the value given for -r as part of the output dir, - # so create a symlink with the name the user - # gave such that everything still works as intended and the sync code still works - # this doesn't happen for the http:// and ftp:// mirrors. - - if not os.path.exists(dest_path): - from1 = os.path.join(self.settings.webdir, "repo_mirror", rest) - print _("- symlink: %(from)s -> %(to)s") % { "from" : from1, "to" : dest_path } - os.symlink(from1, dest_path) - # now regardless of whether we're doing yumdownloader or reposync # or whether the repo was http://, ftp://, or rhn://, execute all queued # commands here. Any failure at any point stops the operation. diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py index 3424d75..67ea2e2 100644 --- a/cobbler/item_repo.py +++ b/cobbler/item_repo.py @@ -122,6 +122,13 @@ class Repo(item.Item): return False if self.mirror is None: return False + if self.mirror.startswith("rhn://"): + # reposync creates directories based on the channel name so this + # prevents a lot of ugly special case handling if we make the + # requirement that repo names match the channels. It makes sense too. + if self.mirror != "rhn://%s" % self.name: + args = { "m1" : self.mirror, "m2" : self.mirror.replace("rhn://","") } + raise CX(_("Since mirror is RHN %(m1)s, the repo must also be named %(m2)s") % args) return True def to_datastruct(self): -- cgit