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:
parent
940a581bd9
commit
31bafa29c5
@ -345,6 +345,10 @@ def filter_by_whitelist(compose, module_builds, input_modules):
|
|||||||
specs = set()
|
specs = set()
|
||||||
nvr_prefixes = set()
|
nvr_prefixes = set()
|
||||||
for spec in input_modules:
|
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"])
|
info = variant_dict_from_str(compose, spec["name"])
|
||||||
prefix = ("%s-%s-%s.%s" % (
|
prefix = ("%s-%s-%s.%s" % (
|
||||||
info["name"],
|
info["name"],
|
||||||
|
@ -799,6 +799,26 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
result, [{"nvr": "foo-1-201809031047.deadbeef"}]
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user