From 9dce30a78d198ed9ca5c26961fc55469bbff2e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 18 May 2016 08:03:31 +0200 Subject: [PATCH] [ostree] Use unique work and log paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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///ostree-/ work/ostree-/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ář --- pungi/phases/ostree.py | 6 +++--- tests/test_ostree_phase.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py index f5c8b05d..f9014c1d 100644 --- a/pungi/phases/ostree.py +++ b/pungi/phases/ostree.py @@ -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']] diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py index b98de6c9..1e2c4729 100755 --- a/tests/test_ostree_phase.py +++ b/tests/test_ostree_phase.py @@ -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')