handle nested exceptions during cleanup on function deploy failures (#172)

This commit is contained in:
anslutsk
2020-10-19 15:31:11 -07:00
committed by GitHub
parent 24e437bfbe
commit 85f9ecc496

View File

@ -586,11 +586,9 @@ class Client:
def deploy_app(self): def deploy_app(self):
logger.info("deploying function app %s", self.app_zip) logger.info("deploying function app %s", self.app_zip)
current_dir = os.getcwd()
with tempfile.TemporaryDirectory() as tmpdirname: with tempfile.TemporaryDirectory() as tmpdirname:
with zipfile.ZipFile(self.app_zip, "r") as zip_ref: with zipfile.ZipFile(self.app_zip, "r") as zip_ref:
zip_ref.extractall(tmpdirname) zip_ref.extractall(tmpdirname)
os.chdir(tmpdirname)
subprocess.check_output( subprocess.check_output(
[ [
shutil.which("func"), shutil.which("func"),
@ -602,10 +600,9 @@ class Client:
"--no-build", "--no-build",
], ],
env=dict(os.environ, CLI_DEBUG="1"), env=dict(os.environ, CLI_DEBUG="1"),
cwd=tmpdirname,
) )
os.chdir(current_dir)
def update_registration(self): def update_registration(self):
if not self.create_registration: if not self.create_registration:
return return