From cda67776d986da48f22d936bf27277d8faddcd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 8 Dec 2020 08:54:16 +0100 Subject: [PATCH] scm: Only copy debugging data if we have a compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we don't have a compose, this copy will fail. Let's prevent that. Signed-off-by: Lubomír Sedlář --- pungi/wrappers/scm.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index a099a902..5602aafe 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -174,10 +174,15 @@ class GitWrapper(ScmBase): self.retry_run(["git", "remote", "update", "origin"], workdir=destdir) run(["git", "checkout", branch], workdir=destdir) except RuntimeError: - debugdir = os.path.join(self.compose.topdir, os.path.basename(destdir)) - self.log_debug("Copying %s to %s for debugging" % (destdir, debugdir)) - makedirs(debugdir) - copy_all(destdir, debugdir) + if self.compose: + debugdir = os.path.join( + self.compose.topdir, os.path.basename(destdir) + ) + self.log_debug( + "Copying %s to %s for debugging" % (destdir, debugdir) + ) + makedirs(debugdir) + copy_all(destdir, debugdir) raise self.run_process_command(destdir)