summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Klohna <tklohna@redhat.com>2019-05-20 16:59:04 +0200
committerTomas Klohna <tklohna@redhat.com>2019-11-07 13:54:31 +0000
commit331bbe5ccd68eecd24709792d6b56f84a163b632 (patch)
tree5ce31ed719b7a390294fa200be100937d87eea8a
parent90066ad68d9de407c5c05e08b984608b6928af8d (diff)
Fix variant filter in bkr workflow-simple
When user specified variant but no arch on command line, he would incorrectly get all arches across all variants. This has now been fixed and variant will correctly output only possible arches that are present. Bug: 657559 Change-Id: I09db13fcdc2ce34f56ae0eea98fdfffe86c03ff1
-rw-r--r--Client/src/bkr/client/__init__.py12
-rw-r--r--Server/bkr/server/distro.py9
2 files changed, 14 insertions, 7 deletions
diff --git a/Client/src/bkr/client/__init__.py b/Client/src/bkr/client/__init__.py
index 95e1910..61fbee2 100644
--- a/Client/src/bkr/client/__init__.py
+++ b/Client/src/bkr/client/__init__.py
@@ -489,19 +489,21 @@ class BeakerWorkflow(BeakerCommand):
"""
Get all arches that apply to either this distro, or the distro which
will be selected by the given family and tag.
+ Variant can be used as a further filter.
"""
- distro = kwargs.get("distro", None)
- family = kwargs.get("family", None)
- tags = kwargs.get("tag", None)
+ distro = kwargs.get("distro")
+ family = kwargs.get("family")
+ tags = kwargs.get("tag")
+ variant = kwargs.get("variant")
if not hasattr(self, 'hub'):
self.set_hub(**kwargs)
if distro:
- return self.hub.distros.get_arch(dict(distro=distro))
+ return self.hub.distros.get_arch(dict(distro=distro, variant=variant))
else:
- return self.hub.distros.get_arch(dict(osmajor=family, tags=tags))
+ return self.hub.distros.get_arch(dict(osmajor=family, tags=tags, variant=variant))
getArches = get_arches
diff --git a/Server/bkr/server/distro.py b/Server/bkr/server/distro.py
index 7147442..c4045ca 100644
--- a/Server/bkr/server/distro.py
+++ b/Server/bkr/server/distro.py
@@ -78,14 +78,19 @@ class Distros(RPCRoot):
@expose()
def get_arch(self, filter):
- """ pass in a dict() with either distro or osmajor to get possible arches
+ """
+ Pass in a dict() with either `distro` or `osmajor` to get possible arches.
+ Further supported filters are `variant` and `tags`.
"""
distros = Distro.query
if 'distro' in filter:
distros = distros.filter(Distro.name == filter['distro'])
if 'osmajor' in filter:
distros = distros.join(Distro.osversion).join(OSVersion.osmajor)\
- .filter(OSMajor.osmajor == filter['osmajor'])
+ .filter(OSMajor.osmajor == filter['osmajor'])
+ if filter.get('variant'):
+ distros = distros.join(Distro.trees)\
+ .filter(DistroTree.variant == filter['variant'])
for tag in filter.get('tags', []):
distros = distros.filter(Distro._tags.any(DistroTag.tag == tag))
# approximates the behaviour of <distroRequires/>