Skip to content

Commit 34d810c

Browse files
JaimieWiJaimie Withers
andauthored
Implement Rubrik Tagging Policy and RP Fix (#1)
* Enhance storage account tags with backup and archive attributes. Also bring in fix based on resource processor bug. See issue 4557 on upstream repo. * Fix: update storage account tags for import and export resources * Fix: update lifecycle ignore_changes for export storage account and bump version to 0.12.9 * Fix from upstream - Required ahead of upgrade to 0.23. Refactor: replace strtobool with custom parse_bool function for better readability and maintainability; update version to 0.8.4 --------- Co-authored-by: Jaimie Withers <jaimie.withers@bdi.ox.ac.uk>
1 parent 0248bcf commit 34d810c

File tree

9 files changed

+23
-13
lines changed

9 files changed

+23
-13
lines changed

airlock_processor/BlobCreatedTrigger/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from distutils.util import strtobool
21
import logging
32
import datetime
43
import uuid
@@ -8,7 +7,7 @@
87

98
import azure.functions as func
109

11-
from shared_code import constants
10+
from shared_code import constants, parsers
1211
from shared_code.blob_operations import get_blob_info_from_topic_and_subject, get_blob_client_from_blob_info
1312

1413

@@ -27,7 +26,7 @@ def main(msg: func.ServiceBusMessage,
2726
# message originated from in-progress blob creation
2827
if constants.STORAGE_ACCOUNT_NAME_IMPORT_INPROGRESS in topic or constants.STORAGE_ACCOUNT_NAME_EXPORT_INPROGRESS in topic:
2928
try:
30-
enable_malware_scanning = strtobool(os.environ["ENABLE_MALWARE_SCANNING"])
29+
enable_malware_scanning = parsers.parse_bool(os.environ["ENABLE_MALWARE_SCANNING"])
3130
except KeyError:
3231
logging.error("environment variable 'ENABLE_MALWARE_SCANNING' does not exists. Cannot continue.")
3332
raise

airlock_processor/ScanResultTrigger/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from distutils.util import strtobool
21
import logging
32

43
import azure.functions as func
54
import datetime
65
import uuid
76
import json
87
import os
9-
from shared_code import constants, blob_operations
8+
from shared_code import constants, blob_operations, parsers
109

1110

1211
def main(msg: func.ServiceBusMessage,
@@ -18,7 +17,7 @@ def main(msg: func.ServiceBusMessage,
1817
status_message = None
1918

2019
try:
21-
enable_malware_scanning = strtobool(os.environ["ENABLE_MALWARE_SCANNING"])
20+
enable_malware_scanning = parsers.parse_bool(os.environ["ENABLE_MALWARE_SCANNING"])
2221
except KeyError as e:
2322
logging.error("environment variable 'ENABLE_MALWARE_SCANNING' does not exists. cannot continue.")
2423
raise e

airlock_processor/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.8.3"
1+
__version__ = "0.8.4"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def parse_bool(val: str) -> bool:
2+
"""Convert a string representation of a boolean to a bool."""
3+
val = val.lower()
4+
if val in ('true', 't', 'yes', 'y', 'on', '1'):
5+
return True
6+
elif val in ('false', 'f', 'no', 'n', 'off', '0'):
7+
return False
8+
raise ValueError(f"Invalid boolean value: {val}")

core/terraform/airlock/storage_accounts.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ resource "azurerm_storage_account" "sa_export_approved" {
107107
}
108108

109109
tags = merge(var.tre_core_tags, {
110-
description = "airlock;export;approved"
110+
description = "airlock;export;approved",
111+
backup = "true",
112+
archive = "false"
111113
})
112114

113-
lifecycle { ignore_changes = [infrastructure_encryption_enabled, tags] }
115+
lifecycle { ignore_changes = [infrastructure_encryption_enabled] }
114116
}
115117

116118
resource "azurerm_private_endpoint" "stg_export_approved_pe" {

core/terraform/resource_processor/vmss_porter/cloud-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ runcmd:
8787
- printf '\nalias rpstatus='\''tmux new-session -d "watch docker ps"; tmux split-window -p 100 -v "docker logs --since 1m --follow resource_processor1"; tmux split-window -v -p 90; tmux -2 attach-session -d'\''\n' >> /etc/bash.bashrc
8888
- export DEBIAN_FRONTEND=noninteractive
8989
- az cloud set --name ${azure_environment}
90-
- az login --identity -u ${vmss_msi_id}
90+
- az login --identity --client-id ${vmss_msi_id}
9191
- az acr login --name ${docker_registry_server}
9292
- docker run -d -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock
9393
--restart always --env-file .env

core/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.12.7"
1+
__version__ = "0.12.9"

templates/workspaces/base/porter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
schemaVersion: 1.0.0
33
name: tre-workspace-base
4-
version: 2.0.0
4+
version: 2.0.1
55
description: "A base Azure TRE workspace"
66
dockerfile: Dockerfile.tmpl
77
registry: azuretre

templates/workspaces/base/terraform/airlock/storage_accounts.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ resource "azurerm_storage_account" "sa_import_approved" {
4343
tags = merge(
4444
var.tre_workspace_tags,
4545
{
46-
description = "airlock;import;approved"
46+
description = "airlock;import;approved",
47+
backup = "true",
48+
archive = "false"
4749
}
4850
)
4951

0 commit comments

Comments
 (0)