mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-07 20:58:27 +08:00
catch exceptions when removing temporary directory
Additionally, don't try to remove it when it wasn't created in the first place.
This commit is contained in:
@@ -71,6 +71,7 @@ def submit_build():
|
||||
return "The submitted scmurl isn't allowed", 403
|
||||
|
||||
yaml = str()
|
||||
td = None
|
||||
try:
|
||||
td = tempfile.mkdtemp()
|
||||
scm = rida.scm.SCM(url, conf.scmurls)
|
||||
@@ -88,7 +89,13 @@ def submit_build():
|
||||
rc = 500
|
||||
return str(e), rc
|
||||
finally:
|
||||
shutil.rmtree(td)
|
||||
try:
|
||||
if td is not None:
|
||||
shutil.rmtree(td)
|
||||
except Exception as e:
|
||||
log.warning(
|
||||
"Failed to remove temporary directory {!r}: {}".format(
|
||||
td, str(e)))
|
||||
|
||||
mmd = modulemd.ModuleMetadata()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user