plugin: pass repos as arrays

Currently we were passing the repo information as a comma
separated string, which is fragile, since urls can contain
commas. Just transfer them as arrays of strings.
This commit is contained in:
Christian Kellner 2020-09-17 15:36:13 +02:00 committed by Tom Gundersen
parent c6f1fa0a6f
commit 1d9612ca05
4 changed files with 9 additions and 7 deletions

View file

@ -267,9 +267,8 @@ class OSBuildImage(BaseTaskHandler):
return [Repository(repourl + "/$arch")] return [Repository(repourl + "/$arch")]
def make_repos_for_user(self, repos): def make_repos_for_user(self, repos):
urls = repos.split(',') self.logger.debug("user repo override: %s", str(repos))
self.logger.debug("user repo override: %s", urls) return [Repository(r) for r in repos]
return [Repository(u.strip()) for u in urls]
# pylint: disable=arguments-differ # pylint: disable=arguments-differ
def handler(self, name, version, distro, image_types, target, arches, opts): def handler(self, name, version, distro, image_types, target, arches, opts):

View file

@ -76,7 +76,7 @@ def handle_osbuild_image(options, session, argv):
opts["release"] = args.release opts["release"] = args.release
if args.repo: if args.repo:
opts["repo"] = ",".join(args.repo) opts["repo"] = args.repo
# Do some early checks to be able to give quick feedback # Do some early checks to be able to give quick feedback
check_target(session, target) check_target(session, target)

View file

@ -52,8 +52,11 @@ OSBUILD_IMAGE_SCHEMA = {
"additionalProperties": False, "additionalProperties": False,
"properties": { "properties": {
"repo": { "repo": {
"type": "string", "type": "array",
"description": "Repositories" "description": "Repositories",
"items": {
"type": "string"
}
}, },
"release": { "release": {
"type": "string", "type": "string",

View file

@ -338,7 +338,7 @@ class TestBuilderPlugin(PluginTest):
["image_type"], ["image_type"],
"fedora-candidate", "fedora-candidate",
["x86_64"], ["x86_64"],
{"repo": ",".join(repos)}] {"repo": repos}]
url = self.plugin.DEFAULT_COMPOSER_URL url = self.plugin.DEFAULT_COMPOSER_URL
composer = MockComposer(url, architectures=["x86_64"]) composer = MockComposer(url, architectures=["x86_64"])