backend/satellite_tools/repo_plugins/yum_src.py | 9 +++++++--
backend/satellite_tools/reposync.py | 6 +++++-
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit c9c2d15afdf2537fff94aa47c0931aca198cc9d7
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Aug 26 17:53:43 2009 -0400
adding mirror list support to spacewalk-repo-sync
diff --git a/backend/satellite_tools/repo_plugins/yum_src.py
b/backend/satellite_tools/repo_plugins/yum_src.py
index a9c0ad6..4e911e2 100644
--- a/backend/satellite_tools/repo_plugins/yum_src.py
+++ b/backend/satellite_tools/repo_plugins/yum_src.py
@@ -22,11 +22,13 @@ class ContentSource:
url = None
name = None
repo = None
+ mirrorlist = False
cache_dir = '/var/cache/rhn/reposync/'
- def __init__(self, url, name):
+ def __init__(self, url, name, mirrorlist):
self.url = url
self.name = name
self._clean_cache(self.cache_dir + name)
+ self.mirrorlist = mirrorlist
def list_packages(self):
""" list packages"""
@@ -34,7 +36,10 @@ class ContentSource:
self.repo = repo
repo.cache = 0
repo.metadata_expire = 0
- repo.baseurl = [self.url]
+ if self.mirrorlist:
+ repo.mirrorlist = self.url
+ else:
+ repo.baseurl = [self.url]
repo.basecachedir = self.cache_dir
repo.baseurlSetup()
repo.setup(False)
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 99b7f07..173371d 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -27,6 +27,7 @@ from server.importlib.packageImport import ChannelPackageSubscription
default_log_location = '/var/log/rhn/reposync/'
class RepoSync:
+
parser = None
type = None
url = None
@@ -36,6 +37,7 @@ class RepoSync:
fail = False
repo_label = None
quiet = False
+ mirrorlist = False
def main(self):
initCFG('server')
@@ -80,6 +82,7 @@ class RepoSync:
self.channel_label = options.channel_label
self.fail = options.fail
self.repo_label = options.label
+ self.mirrorlist = options.mirror
self.quiet = options.quiet
self.channel = self.load_channel()
@@ -87,7 +90,7 @@ class RepoSync:
print "Channel does not exist or is not custom"
sys.exit(1)
- self.plugin = self.load_plugin()(self.url, self.channel_label + "-" +
self.repo_label)
+ self.plugin = self.load_plugin()(self.url, self.channel_label + "-" +
self.repo_label, self.mirrorlist)
self.import_packages(self.plugin.list_packages())
self.print_msg("Sync complete")
@@ -99,6 +102,7 @@ class RepoSync:
self.parser.add_option('-l', '--label', action='store',
dest='label', help='A friendly label to refer to the repo')
self.parser.add_option('-f', '--fail',
action='store_true', dest='fail', default=False , help="If a package
import fails, fail the entire operation")
self.parser.add_option('-q', '--quiet',
action='store_true', dest='quiet', default=False, help="Print no
output, still logs output")
+ self.parser.add_option('-m', '--mirrorlist',
action='store_true', dest='mirror', default=False, help="Treat --url
as a mirror list (may not be supported by all content sources)")
return self.parser.parse_args()
def load_plugin(self):