From eeacb5b9f112bcdcdc9bccf1aca02cf6be4fba1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 16 May 2016 18:29:09 +0200 Subject: [PATCH] [ostree] Put variant name in ostree log dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will prevent log files from being mangled when multiple ostree repos are created. Signed-off-by: Lubomír Sedlář --- pungi/phases/ostree.py | 5 +++-- tests/test_ostree_phase.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py index 53947ffa..f5c8b05d 100644 --- a/pungi/phases/ostree.py +++ b/pungi/phases/ostree.py @@ -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'] ] diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py index f5060042..b98de6c9 100755 --- a/tests/test_ostree_phase.py +++ b/tests/test_ostree_phase.py @@ -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')