File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 66from prefect .client .orchestration import PrefectClient , get_client
77from prefect .client .schemas .filters import DeploymentFilter , DeploymentFilterName
88from prefect .events .schemas .automations import Automation
9+ from prefect .exceptions import PrefectHTTPStatusError
910
1011from infrahub import lock
1112from infrahub .database import InfrahubDatabase
@@ -133,8 +134,14 @@ async def setup_triggers(
133134 continue
134135
135136 report .deleted .append (existing_automation )
136- await client .delete_automation (automation_id = existing_automation .id )
137- log .info (f"{ item_to_delete } Deleted" )
137+ try :
138+ await client .delete_automation (automation_id = existing_automation .id )
139+ log .info (f"{ item_to_delete } Deleted" )
140+ except PrefectHTTPStatusError as exc :
141+ if exc .response .status_code == 404 :
142+ log .info (f"{ item_to_delete } was already deleted" )
143+ else :
144+ raise
138145
139146 if trigger_type :
140147 log .info (
You can’t perform that action at this time.
0 commit comments