image_container: Fix incorrect arch processing
OSBS will reject no scratch builds with arch_override. When the option is not specified in Pungi, it would do `"".split(" ")` to get list of arches, which returns a list with empty string instead of an empty list. With this fixed, it might be possible to have multiple images match the spec (unless arch is used in the filter). To fix that, we can replace arch with $basearch variable. JIRA: RHELCMP-3824 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
2769232b72
commit
535034ef91
@ -53,7 +53,7 @@ class ImageContainerThread(WorkerThread):
|
||||
self._get_repo(
|
||||
compose,
|
||||
variant,
|
||||
config.get("arch_override", "").split(" "),
|
||||
config.get("arch_override", "").split(),
|
||||
config.pop("image_spec"),
|
||||
)
|
||||
]
|
||||
@ -95,7 +95,7 @@ class ImageContainerThread(WorkerThread):
|
||||
if not re.match(value, getattr(image, key)):
|
||||
break
|
||||
else:
|
||||
image_paths.add(image.path)
|
||||
image_paths.add(image.path.replace(arch, "$basearch"))
|
||||
|
||||
if len(image_paths) != 1:
|
||||
raise RuntimeError(
|
||||
|
@ -130,7 +130,6 @@ class ImageContainerThreadTest(helpers.PungiTestCase):
|
||||
"target": "f24-docker-candidate",
|
||||
"git_branch": "f24-docker",
|
||||
"image_spec": {"type": "qcow2"},
|
||||
"arch_override": "x86_64",
|
||||
}
|
||||
self.compose.im.images["Server"] = {
|
||||
"x86_64": [
|
||||
@ -150,7 +149,7 @@ class ImageContainerThreadTest(helpers.PungiTestCase):
|
||||
repo_content = list(f)
|
||||
self.assertIn("[image-to-include]\n", repo_content)
|
||||
self.assertIn(
|
||||
"baseurl=http://root/compose/Server/x86_64/images/image.qcow2\n",
|
||||
"baseurl=http://root/compose/Server/$basearch/images/image.qcow2\n",
|
||||
repo_content,
|
||||
)
|
||||
self.assertIn("enabled=0\n", repo_content)
|
||||
@ -158,7 +157,6 @@ class ImageContainerThreadTest(helpers.PungiTestCase):
|
||||
def assertKojiCalls(self, cfg, scratch=False):
|
||||
opts = {
|
||||
"git_branch": cfg["git_branch"],
|
||||
"arch_override": cfg["arch_override"],
|
||||
"yum_repourls": ["http://root/" + self.repofile_path],
|
||||
}
|
||||
if scratch:
|
||||
|
Loading…
Reference in New Issue
Block a user