Skip to content

Commit

Permalink
Fail Firewall migration if there's no firewall (#2792)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanya-borisova committed Oct 31, 2022
1 parent 6034dc3 commit 403804a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api_app/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.7"
__version__ = "0.5.8"
7 changes: 5 additions & 2 deletions api_app/db/migrations/shared_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ def checkMinFirewallVersion(self) -> bool:
template_name = 'tre-shared-service-firewall'
min_template_version = semantic_version.Version('0.4.0')

resource = self.query(query=f'SELECT * FROM c WHERE c.resourceType = "shared-service" \
resources = self.query(query=f'SELECT * FROM c WHERE c.resourceType = "shared-service" \
AND c.templateName = "{template_name}" AND {IS_OPERATING_SHARED_SERVICE}')

template_version = semantic_version.Version(resource[0]["templateVersion"])
if not resources:
raise ValueError(f"Expecting to have an instance of Firewall (template name {template_name}) deployed in a successful TRE deployment")

template_version = semantic_version.Version(resources[0]["templateVersion"])

if (template_version < min_template_version):
raise ValueError(f"{template_name} deployed version ({template_version}) is below minimum ({min_template_version})!",
Expand Down

0 comments on commit 403804a

Please sign in to comment.