Skip to content

Commit 3e459e3

Browse files
committed
Fix patch.py issue
1 parent 76f0ab8 commit 3e459e3

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

content/install-guides/streamline-cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,4 @@ Follow these steps to integrate these patches into an RPM-based distribution's k
273273
```
274274
275275
You are now ready to use Streamline CLI Tools. Refer to [Profiling for Neoverse with Streamline CLI Tools](/learning-paths/servers-and-cloud-computing/profiling-for-neoverse/) to get started.
276+

tools/patch.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@ def patch(article_path: str, results: dict, link: str):
3434
results_values = defaultdict(lambda: "failed")
3535
results_values[0] = "passed"
3636

37-
for image, i in zip(test_images, range(len(test_images))):
38-
if content_title not in data["sw_categories"][sw_category]:
39-
raise SystemExit(f"{content_title} does not exist in {stats_file}. Add it to update the stats report.")
40-
data["sw_categories"][sw_category][content_title]["tests_and_status"][i][image] = results_values[results[image]]
37+
content_data = data["sw_categories"][sw_category][content_title]
38+
39+
# Create 'tests_and_status' if it doesn't exist
40+
if "tests_and_status" not in content_data or not isinstance(content_data["tests_and_status"], list):
41+
content_data["tests_and_status"] = [{} for _ in range(len(test_images))]
42+
43+
# If 'tests_and_status' exists but is too short, extend it
44+
if len(content_data["tests_and_status"]) < len(test_images):
45+
additional_entries = [{} for _ in range(len(test_images) - len(content_data["tests_and_status"]))]
46+
content_data["tests_and_status"].extend(additional_entries)
47+
48+
# Now safe to index
49+
for i, image in enumerate(test_images):
50+
idx = min(i, len(content_data["tests_and_status"]) - 1)
51+
content_data["tests_and_status"][idx][image] = results_values[results[image]]
4152

4253
if link:
4354
data["sw_categories"][sw_category][content_title]["test_link"] = link

0 commit comments

Comments
 (0)