Commit 0568b90f authored by Seblu's avatar Seblu

select_repository now handle uuid

parent 8f2ec5bf
...@@ -31,6 +31,7 @@ import fnmatch ...@@ -31,6 +31,7 @@ import fnmatch
import cStringIO import cStringIO
import json import json
import uuid import uuid
import string
import installsystems import installsystems
import installsystems.tools as istools import installsystems.tools as istools
from installsystems.exception import * from installsystems.exception import *
...@@ -860,6 +861,22 @@ class RepositoryManager(object): ...@@ -860,6 +861,22 @@ class RepositoryManager(object):
''' '''
return [ r.config.name for r in self.repos ] return [ r.config.name for r in self.repos ]
@property
def uuids(self):
'''
Return a dict of repository UUID and associated names
'''
d = {}
for r in self.repos:
uuid = r.uuid
if uuid is None:
continue
if uuid in d:
d[uuid].append(r)
else:
d[uuid] = [r]
return d
@property @property
def onlines(self): def onlines(self):
''' '''
...@@ -1030,8 +1047,12 @@ class RepositoryManager(object): ...@@ -1030,8 +1047,12 @@ class RepositoryManager(object):
Return a list of repository Return a list of repository
''' '''
ans = set() ans = set()
uuidb = self.uuids
for pattern in patterns: for pattern in patterns:
ans |= set(fnmatch.filter(self.names, pattern)) ans |= set(fnmatch.filter(self.names, pattern))
if istools.strcspn(pattern, string.hexdigits + "-") == 0:
for uuid in filter(lambda x: x.startswith(pattern), uuidb.keys()):
ans |= set((r.config.name for r in uuidb[uuid]))
return sorted(ans) return sorted(ans)
def purge_repositories(self, patterns): def purge_repositories(self, patterns):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment