scm: Only copy debugging data if we have a compose

If we don't have a compose, this copy will fail. Let's prevent that.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-12-08 08:54:16 +01:00
parent 62a97c0e1b
commit cda67776d9

View File

@ -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)