Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail Firewall migration if there's no firewall #2792

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.5"
__version__ = "0.5.6"
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