Merge pull request #420 from pypeclub/bugfix/cleanup-staging-dir-not-set

Cleanup plugin fail on instances without staging dir
This commit is contained in:
Milan Kolar 2020-08-07 15:22:00 +02:00 committed by GitHub
commit 78d8337029
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,12 +71,16 @@ class CleanUp(pyblish.api.InstancePlugin):
temp_root = tempfile.gettempdir()
staging_dir = instance.data.get("stagingDir", None)
if not staging_dir:
self.log.info("Staging dir not set.")
return
if not os.path.normpath(staging_dir).startswith(temp_root):
self.log.info("Skipping cleanup. Staging directory is not in the "
"temp folder: %s" % staging_dir)
return
if not staging_dir or not os.path.exists(staging_dir):
if not os.path.exists(staging_dir):
self.log.info("No staging directory found: %s" % staging_dir)
return