[ostree] Put variant name in ostree log dir

This will prevent log files from being mangled when multiple ostree
repos are created.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-16 18:29:09 +02:00
parent e998bbe436
commit eeacb5b9f1
2 changed files with 6 additions and 5 deletions

View File

@ -46,7 +46,8 @@ class OSTreeThread(WorkerThread):
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))
self.logdir = compose.paths.log.topdir('{}/{}/ostree'.format(
arch, variant.uid))
repodir = os.path.join(workdir, 'config_repo')
source_variant = compose.variants[config['source_repo_from']]
@ -66,7 +67,7 @@ class OSTreeThread(WorkerThread):
def _run_ostree_cmd(self, compose, variant, arch, config, config_repo):
cmd = [
'pungi-make-ostree',
'--log-dir={}'.format(self.logdir),
'--log-dir={}'.format(os.path.join(self.logdir)),
'--treefile={}'.format(os.path.join(config_repo, config['treefile'])),
config['ostree_repo']
]

View File

@ -125,7 +125,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
self.assertEqual(koji.get_runroot_cmd.call_args_list,
[mock.call('rrt', 'x86_64',
['pungi-make-ostree',
'--log-dir={}/logs/x86_64/ostree'.format(self.topdir),
'--log-dir={}/logs/x86_64/Everything/ostree'.format(self.topdir),
'--treefile={}/fedora-atomic-docker-host.json'.format(
self.topdir + '/work/ostree/config_repo'),
self.repo],
@ -134,7 +134,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
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/ostree/runroot.log')])
log_file=self.topdir + '/logs/x86_64/Everything/ostree/runroot.log')])
with open(self.topdir + '/work/ostree/config_repo/fedora-rawhide.repo') as f:
self.assertIn('baseurl=http://example.com/Everything/x86_64/os'.format(self.topdir),
@ -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/ostree/runroot.log'))
self.topdir + '/logs/x86_64/Everything/ostree/runroot.log'))
])
@mock.patch('pungi.wrappers.scm.get_dir_from_scm')