From db0448aa41291e0e3438cabb2bf83d85ef4361e7 Mon Sep 17 00:00:00 2001 From: Matt Craddock <5796417+craddm@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:10:46 +0000 Subject: [PATCH] Catch errors when no pulumi config present --- data_safe_haven/infrastructure/programs/imperative_shm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data_safe_haven/infrastructure/programs/imperative_shm.py b/data_safe_haven/infrastructure/programs/imperative_shm.py index c4c0f5e761..023e015789 100644 --- a/data_safe_haven/infrastructure/programs/imperative_shm.py +++ b/data_safe_haven/infrastructure/programs/imperative_shm.py @@ -178,8 +178,12 @@ def teardown(self) -> None: DataSafeHavenAzureError if any resources cannot be destroyed """ logger = get_logger() - pulumi_config = DSHPulumiConfig.from_remote(self.context) - deployed = pulumi_config.project_names + try: + pulumi_config = DSHPulumiConfig.from_remote(self.context) + deployed = pulumi_config.project_names + except DataSafeHavenAzureError: + deployed = None + pass if deployed: logger.info(f"Found deployed SREs: {deployed}.") msg = "Deployed SREs must be torn down before the SHM can be torn down."