From f1fdc48aaab772d21f27ae4558a214ac19642b6a Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 28 Aug 2024 23:17:13 +0000 Subject: [PATCH] Work around this bug: https://github.com/python/cpython/pull/14064 (#941) Otherwise we sometimes see errors like: ``` cerc-webapp-deployer: File "/root/.shiv/laconic-so_0f937aa98c2748ef9af8585d6f441dbc01546ace0d6660cbb159d1e5040aeddf/site-packages/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py", line 671, in command cerc-webapp-deployer: shutil.rmtree(tempdir) cerc-webapp-deployer: File "/usr/lib/python3.10/shutil.py", line 725, in rmtree cerc-webapp-deployer: _rmtree_safe_fd(fd, path, onerror) cerc-webapp-deployer: File "/usr/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd cerc-webapp-deployer: onerror(os.unlink, fullname, sys.exc_info()) cerc-webapp-deployer: File "/usr/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd cerc-webapp-deployer: os.unlink(entry.name, dir_fd=topfd) cerc-webapp-deployer: FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' ``` Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/941 Co-authored-by: Thomas E Lackey Co-committed-by: Thomas E Lackey --- stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py | 2 +- stack_orchestrator/deploy/webapp/request_webapp_deployment.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py index 5da1f4eb..aa3a4d8f 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py @@ -668,4 +668,4 @@ def command( # noqa: C901 main_logger.log("UNCAUGHT ERROR:" + str(e)) raise e finally: - shutil.rmtree(tempdir) + shutil.rmtree(tempdir, ignore_errors=True) diff --git a/stack_orchestrator/deploy/webapp/request_webapp_deployment.py b/stack_orchestrator/deploy/webapp/request_webapp_deployment.py index 70884f9d..466c4c54 100644 --- a/stack_orchestrator/deploy/webapp/request_webapp_deployment.py +++ b/stack_orchestrator/deploy/webapp/request_webapp_deployment.py @@ -172,4 +172,4 @@ def command( # Send the request laconic.publish(deployment_request) finally: - shutil.rmtree(tempdir) + shutil.rmtree(tempdir, ignore_errors=True)