[live-images] Move repo calculation to separate method

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-22 10:29:06 +01:00
parent 9b748f752e
commit 4a1e029c1d

View File

@ -92,6 +92,17 @@ class LiveImagesPhase(PhaseBase):
return repo return repo
def _get_repos(self, arch, variant, data):
repos = []
if not variant.is_empty:
repos.append(translate_path(
self.compose, self.compose.paths.compose.repository(arch, variant, create_dir=False)))
# additional repos
repos.extend(data.get("additional_repos", []))
repos.extend(self._get_extra_repos(arch, variant, data.get('repo_from', [])))
return repos
def _get_release(self, image_conf): def _get_release(self, image_conf):
"""If release is set explicitly to None, replace it with date and respin.""" """If release is set explicitly to None, replace it with date and respin."""
if 'release' in image_conf and image_conf['release'] is None: if 'release' in image_conf and image_conf['release'] is None:
@ -126,14 +137,7 @@ class LiveImagesPhase(PhaseBase):
if 'ksurl' in data: if 'ksurl' in data:
cmd['ksurl'] = resolve_git_url(data['ksurl']) cmd['ksurl'] = resolve_git_url(data['ksurl'])
cmd["repos"] = [] cmd["repos"] = self._get_repos(arch, variant, data)
if not variant.is_empty:
cmd["repos"].append(translate_path(
self.compose, self.compose.paths.compose.repository(arch, variant, create_dir=False)))
# additional repos
cmd["repos"].extend(data.get("additional_repos", []))
cmd['repos'].extend(self._get_extra_repos(arch, variant, data.get('repo_from', [])))
# Explicit name and version # Explicit name and version
cmd["name"] = data.get("name", None) cmd["name"] = data.get("name", None)