ostree-installer: Skip comps repo if there are no comps
When the compose is not using comps, we can't pass the comps to lorax, since it doesn't exist and it would cause a crash. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
663a07068e
commit
c10a4ca337
@ -63,13 +63,20 @@ class OstreeInstallerThread(WorkerThread):
|
||||
self.logdir = compose.paths.log.topdir('%s/%s/ostree_installer-%s' % (arch, variant, self.num))
|
||||
|
||||
repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False)
|
||||
comps_baseurl = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False)
|
||||
repos = get_repo_urls(None, # compose==None. Special value says that method should ignore deprecated variant-type repo
|
||||
shortcuts.force_list(config['repo'])
|
||||
+ shortcuts.force_list(translate_path(compose, repo_baseurl))
|
||||
+ shortcuts.force_list(translate_path(compose, comps_baseurl)),
|
||||
+ shortcuts.force_list(translate_path(compose, repo_baseurl)),
|
||||
arch=arch,
|
||||
logger=self.pool)
|
||||
if compose.has_comps:
|
||||
repos.append(
|
||||
translate_path(
|
||||
compose,
|
||||
compose.paths.work.comps_repo(
|
||||
'$basearch', variant=variant, create_dir=False
|
||||
),
|
||||
)
|
||||
)
|
||||
repos = [url.replace('$arch', arch) for url in repos]
|
||||
output_dir = os.path.join(compose.paths.work.topdir(arch), variant.uid, 'ostree_installer')
|
||||
util.makedirs(os.path.dirname(output_dir))
|
||||
|
@ -326,6 +326,40 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
||||
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
||||
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
||||
|
||||
@mock.patch('pungi.util.copy_all')
|
||||
@mock.patch('productmd.images.Image')
|
||||
@mock.patch('pungi.util.get_mtime')
|
||||
@mock.patch('pungi.util.get_file_size')
|
||||
@mock.patch('pungi.phases.ostree_installer.iso')
|
||||
@mock.patch('os.link')
|
||||
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||
def test_run_without_comps(
|
||||
self, KojiWrapper, link, iso, get_file_size, get_mtime, ImageCls, copy_all
|
||||
):
|
||||
self.compose.has_comps = False
|
||||
pool = mock.Mock()
|
||||
cfg = {
|
||||
'release': '20160321.n.0',
|
||||
'repo': [],
|
||||
}
|
||||
koji = KojiWrapper.return_value
|
||||
koji.run_runroot_cmd.return_value = {
|
||||
'task_id': 1234,
|
||||
'retcode': 0,
|
||||
'output': 'Foo bar\n',
|
||||
}
|
||||
|
||||
t = ostree.OstreeInstallerThread(pool)
|
||||
|
||||
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
|
||||
|
||||
sources = [
|
||||
'http://example.com/work/$basearch/repo',
|
||||
]
|
||||
|
||||
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
|
||||
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
|
||||
|
||||
@mock.patch('pungi.util.copy_all')
|
||||
@mock.patch('productmd.images.Image')
|
||||
@mock.patch('pungi.util.get_mtime')
|
||||
|
Loading…
Reference in New Issue
Block a user