[ostree] Use unique work and log paths

Each variant.arch combination can have multiple ostree repos configured,
so we need to make sure the filesystem paths don't clash.

The paths used now are:

    logs/<arch>/<variant>/ostree-<x>/
    work/ostree-<x>/config_repo

The x stands for a number identifying the task. It has no relation to
actual contents of the repo.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-18 08:03:31 +02:00
parent 00f2e24bce
commit 9dce30a78d
2 changed files with 11 additions and 11 deletions

View File

@ -45,9 +45,9 @@ class OSTreeThread(WorkerThread):
def worker(self, compose, variant, arch, config):
msg = 'OSTree phase for variant %s, arch %s' % (variant.uid, arch)
self.pool.log_info('[BEGIN] %s' % msg)
workdir = compose.paths.work.topdir('ostree')
self.logdir = compose.paths.log.topdir('{}/{}/ostree'.format(
arch, variant.uid))
workdir = compose.paths.work.topdir('ostree-%d' % self.num)
self.logdir = compose.paths.log.topdir('%s/%s/ostree-%d' %
(arch, variant.uid, self.num))
repodir = os.path.join(workdir, 'config_repo')
source_variant = compose.variants[config['source_repo_from']]

View File

@ -121,28 +121,28 @@ class OSTreeThreadTest(helpers.PungiTestCase):
self.assertEqual(get_dir_from_scm.call_args_list,
[mock.call({'scm': 'git', 'repo': 'https://git.fedorahosted.org/git/fedora-atomic.git',
'branch': 'f24', 'dir': '.'},
self.topdir + '/work/ostree/config_repo', logger=pool._logger)])
self.topdir + '/work/ostree-1/config_repo', logger=pool._logger)])
self.assertEqual(koji.get_runroot_cmd.call_args_list,
[mock.call('rrt', 'x86_64',
['pungi-make-ostree',
'--log-dir={}/logs/x86_64/Everything/ostree'.format(self.topdir),
'--log-dir={}/logs/x86_64/Everything/ostree-1'.format(self.topdir),
'--treefile={}/fedora-atomic-docker-host.json'.format(
self.topdir + '/work/ostree/config_repo'),
self.topdir + '/work/ostree-1/config_repo'),
self.repo],
channel=None, mounts=[self.topdir, self.repo],
packages=['pungi', 'ostree', 'rpm-ostree'],
task_id=True, use_shell=True)])
self.assertEqual(koji.run_runroot_cmd.call_args_list,
[mock.call(koji.get_runroot_cmd.return_value,
log_file=self.topdir + '/logs/x86_64/Everything/ostree/runroot.log')])
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
with open(self.topdir + '/work/ostree/config_repo/fedora-rawhide.repo') as f:
with open(self.topdir + '/work/ostree-1/config_repo/fedora-rawhide.repo') as f:
self.assertIn('baseurl=http://example.com/Everything/x86_64/os'.format(self.topdir),
f.read())
with open(self.topdir + '/work/ostree/config_repo/fedora-24.repo') as f:
with open(self.topdir + '/work/ostree-1/config_repo/fedora-24.repo') as f:
self.assertIn('baseurl=http://example.com/Everything/x86_64/os'.format(self.topdir),
f.read())
with open(self.topdir + '/work/ostree/config_repo/fedora-23.repo') as f:
with open(self.topdir + '/work/ostree-1/config_repo/fedora-23.repo') as f:
self.assertIn('baseurl=http://example.com/Everything/x86_64/os'.format(self.topdir),
f.read())
self.assertTrue(os.path.isdir(self.repo))
@ -181,7 +181,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
compose.log_info.assert_has_calls([
mock.call('[FAIL] Ostree (variant Everything, arch x86_64) failed, but going on anyway.'),
mock.call('Runroot task failed: 1234. See {} for more details.'.format(
self.topdir + '/logs/x86_64/Everything/ostree/runroot.log'))
self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log'))
])
@mock.patch('pungi.wrappers.scm.get_dir_from_scm')