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) self.retry_run(["git", "remote", "update", "origin"], workdir=destdir)
run(["git", "checkout", branch], workdir=destdir) run(["git", "checkout", branch], workdir=destdir)
except RuntimeError: except RuntimeError:
debugdir = os.path.join(self.compose.topdir, os.path.basename(destdir)) if self.compose:
self.log_debug("Copying %s to %s for debugging" % (destdir, debugdir)) debugdir = os.path.join(
makedirs(debugdir) self.compose.topdir, os.path.basename(destdir)
copy_all(destdir, debugdir) )
self.log_debug(
"Copying %s to %s for debugging" % (destdir, debugdir)
)
makedirs(debugdir)
copy_all(destdir, debugdir)
raise raise
self.run_process_command(destdir) self.run_process_command(destdir)