Allow setting wildcard as a module name in variants to include all the modules.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2019-02-07 13:58:08 +01:00
parent 940a581bd9
commit 31bafa29c5
2 changed files with 24 additions and 0 deletions

View File

@ -345,6 +345,10 @@ def filter_by_whitelist(compose, module_builds, input_modules):
specs = set()
nvr_prefixes = set()
for spec in input_modules:
# Do not do any filtering in case variant wants all the modules.
if spec["name"] == "*":
return module_builds
info = variant_dict_from_str(compose, spec["name"])
prefix = ("%s-%s-%s.%s" % (
info["name"],

View File

@ -799,6 +799,26 @@ class TestFilterByWhitelist(unittest.TestCase):
result, [{"nvr": "foo-1-201809031047.deadbeef"}]
)
def test_filter_by_wildcard(self):
compose = mock.Mock()
module_builds = [
{"nvr": "foo-1-201809031048.cafebabe"},
{"nvr": "foo-1-201809031047.deadbeef"},
{"nvr": "foo-2-201809031047.deadbeef"},
]
input_modules = [{"name": "*"}]
result = source_koji.filter_by_whitelist(compose, module_builds, input_modules)
self.assertItemsEqual(
result,
[
{"nvr": "foo-1-201809031048.cafebabe"},
{"nvr": "foo-1-201809031047.deadbeef"},
{"nvr": "foo-2-201809031047.deadbeef"},
],
)
if __name__ == "__main__":
unittest.main()