Skip to content

Commit 565ddf3

Browse files
committed
[confcom] regenerate golden policies
1 parent 1cc8cd0 commit 565ddf3

File tree

19 files changed

+1652
-1621
lines changed

19 files changed

+1652
-1621
lines changed

src/confcom/azext_confcom/lib/images.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,23 @@ def get_image_layers(image: str, platform: str = "linux/amd64") -> list[str]:
7474
text=True,
7575
)
7676

77+
stdout_str = result.stdout.strip()
78+
79+
# Try JSON output first (newer dmverity-vhd versions)
80+
if stdout_str.startswith("{"):
81+
try:
82+
import json
83+
json_output = json.loads(stdout_str)
84+
return json_output.get("layers", [])
85+
except json.JSONDecodeError:
86+
pass
87+
88+
# Fallback: line-by-line parsing for older versions
7789
layers = []
78-
for line in result.stdout.splitlines():
90+
for line in stdout_str.splitlines():
7991
if "hash: " in line:
8092
layers.append(line.split("hash: ")[-1])
8193
else:
82-
# dmverity-vhd may print warnings to stdout (e.g. OCI format
83-
# parsing errors). Log them so they are visible but don't treat them
84-
# as layer hashes.
8594
logger.warning("Unexpected dmverity-vhd output: %s", line)
8695

8796
return layers

src/confcom/azext_confcom/tests/latest/test_confcom_acipolicygen_arm.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import json
1111
import os
1212
import tempfile
13+
import unittest.mock
1314
import pytest
1415
from itertools import product
1516

@@ -166,15 +167,17 @@ def test_acipolicygen_arm_diff(case):
166167
arm_template_file.flush()
167168

168169
# Populate the arm template with a CCEPolicy field
169-
acipolicygen_confcom(
170-
input_path=None,
171-
arm_template=arm_template_file.name,
172-
arm_template_parameters=None,
173-
image_name=None,
174-
virtual_node_yaml_path=None,
175-
infrastructure_svn=None,
176-
tar_mapping_location=None,
177-
)
170+
# Mock input to auto-approve the overwrite prompt
171+
with unittest.mock.patch("builtins.input", return_value="y"):
172+
acipolicygen_confcom(
173+
input_path=None,
174+
arm_template=arm_template_file.name,
175+
arm_template_parameters=None,
176+
image_name=None,
177+
virtual_node_yaml_path=None,
178+
infrastructure_svn=None,
179+
tar_mapping_location=None,
180+
)
178181
arm_template_file.seek(0)
179182

180183
# Modify the ARM template

src/confcom/samples/images/command/aci_container.inc.rego

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
"id": "confcom_test_command",
33
"name": "confcom_test_command",
44
"layers": [
5-
"8b4664979ffe3c5188efbbbb30e31716c03bfe880f15f455be0fc3beb4741de9"
5+
"f1ba3e38cc8c3755648e05aa57ea155496e9a2e42fd2454932b6647bc93575b2"
66
],
7+
"platform": "linux/amd64",
78
"mounts": [
89
{
910
"destination": "/etc/resolv.conf",
11+
"source": "sandbox:///tmp/atlas/resolvconf/.+",
12+
"type": "bind",
1013
"options": [
1114
"rbind",
1215
"rshared",
1316
"rw"
14-
],
15-
"source": "sandbox:///tmp/atlas/resolvconf/.+",
16-
"type": "bind"
17+
]
1718
}
1819
],
1920
"command": [

src/confcom/samples/images/environment_variables/aci_container.inc.rego

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
"id": "confcom_test_environment_variables",
33
"name": "confcom_test_environment_variables",
44
"layers": [
5-
"8b4664979ffe3c5188efbbbb30e31716c03bfe880f15f455be0fc3beb4741de9"
5+
"f1ba3e38cc8c3755648e05aa57ea155496e9a2e42fd2454932b6647bc93575b2"
66
],
7+
"platform": "linux/amd64",
78
"mounts": [
89
{
910
"destination": "/etc/resolv.conf",
11+
"source": "sandbox:///tmp/atlas/resolvconf/.+",
12+
"type": "bind",
1013
"options": [
1114
"rbind",
1215
"rshared",
1316
"rw"
14-
],
15-
"source": "sandbox:///tmp/atlas/resolvconf/.+",
16-
"type": "bind"
17+
]
1718
}
1819
],
1920
"command": [

src/confcom/samples/images/minimal/aci_container.inc.rego

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
"id": "confcom_test_minimal",
33
"name": "confcom_test_minimal",
44
"layers": [
5-
"8b4664979ffe3c5188efbbbb30e31716c03bfe880f15f455be0fc3beb4741de9"
5+
"f1ba3e38cc8c3755648e05aa57ea155496e9a2e42fd2454932b6647bc93575b2"
66
],
7+
"platform": "linux/amd64",
78
"mounts": [
89
{
910
"destination": "/etc/resolv.conf",
11+
"source": "sandbox:///tmp/atlas/resolvconf/.+",
12+
"type": "bind",
1013
"options": [
1114
"rbind",
1215
"rshared",
1316
"rw"
14-
],
15-
"source": "sandbox:///tmp/atlas/resolvconf/.+",
16-
"type": "bind"
17+
]
1718
}
1819
],
1920
"command": [

0 commit comments

Comments
 (0)