Skip to content

Commit 9d97947

Browse files
committed
Fix bicepparam file to match modified bicep template
1 parent b43ae74 commit 9d97947

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/confcom/azext_confcom/command/containers_from_radius.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
# --------------------------------------------------------------------------------------------
55

66
import json
7+
import os
78
import tempfile
89

910
from azext_confcom.lib.images import get_image_config, get_image_layers
1011
from azext_confcom.lib.deployments import parse_deployment_template
1112
from azext_confcom.lib.platform import ACI_MOUNTS
13+
import re
1214

1315

1416
def containers_from_radius(
1517
az_cli_command,
1618
template: str,
17-
parameters: dict,
19+
parameters: list,
1820
container_index: int,
1921
platform: str,
2022
) -> None:
@@ -26,6 +28,24 @@ def containers_from_radius(
2628
temp_template_file.write(f.read().replace("extension radius", ""))
2729
temp_template_file.flush()
2830

31+
# Handle parameters file if it's a path
32+
if len(parameters) > 0 and isinstance(parameters[0][0], str) and os.path.isfile(parameters[0][0]):
33+
parameters_path = parameters[0][0]
34+
with open(parameters_path, 'r') as params_file:
35+
params_content = params_file.read()
36+
37+
# Replace any references to the original template file with the temporary one
38+
params_content = re.sub(
39+
r"using\s+'.*\.bicep'",
40+
f"using '{os.path.basename(temp_template_file.name)}'",
41+
params_content
42+
)
43+
44+
with tempfile.NamedTemporaryFile('w+', delete=False, suffix=".bicepparam") as temp_params_file:
45+
temp_params_file.write(params_content)
46+
temp_params_file.flush()
47+
parameters = [[temp_params_file.name]]
48+
2949
template = parse_deployment_template(
3050
az_cli_command,
3151
temp_template_file.name,

0 commit comments

Comments
 (0)