From d1877090ad7c971140fcc25e3490e307fe8f7a49 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 4 May 2012 10:55:36 -0400 Subject: fixed repo name generation --- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Source.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index a7c246940..f005d41ec 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -33,7 +33,7 @@ class SourceInitError(Exception): class Source(Bcfg2.Server.Plugin.Debuggable): mrepo_re = re.compile(r'/RPMS\.([^/]+)') pulprepo_re = re.compile(r'pulp/repos/([^/]+)') - genericrepo_re = re.compile(r'https?://[^/]+/(.+?)/?$') + genericrepo_re = re.compile('https?://.*?/([^/]+)/?$') basegroups = [] def __init__(self, basepath, xsource, config): @@ -136,7 +136,7 @@ class Source(Bcfg2.Server.Plugin.Debuggable): def get_repo_name(self, url_map): # try to find a sensible name for a repo - if url_map['components']: + if 'components' in url_map and url_map['components']: # use the first component as the name rname = url_map['components'][0] else: @@ -146,6 +146,7 @@ class Source(Bcfg2.Server.Plugin.Debuggable): self.genericrepo_re): match = repo_re.search(url_map['url']) if match: + name = match.group(1) break if name is None: # couldn't figure out the name from the URL or URL map -- cgit v1.2.3-1-g7c22