Skip to content

Commit a29825f

Browse files
authored
fix: Return the correct policyID and policyName in get_image_scanning_results (#172)
1 parent c9df8df commit a29825f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sdcclient/_scanning.py

+2
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,8 @@ def get_image_scanning_results(self, image_name, policy_id=None):
12791279
policy_results = [result for result in json_res["results"] if result["policyId"] == policy_id]
12801280
if policy_results:
12811281
filtered_result_by_policy_id = policy_results[0]
1282+
result["policy_id"] = filtered_result_by_policy_id["policyId"]
1283+
result["policy_name"] = filtered_result_by_policy_id["policyName"]
12821284
result["total_stop"] = filtered_result_by_policy_id["nStop"]
12831285
result["total_warn"] = filtered_result_by_policy_id["nWarn"]
12841286
result["warn_results"] = [rule_result["checkOutput"]

specs/secure/scanning/policy_evaluation_spec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
total_warn=be_above_or_equal(0), total_stop=be_above_or_equal(0),
3838
last_evaluation=be_an(datetime),
3939
status="pass", image_tag="docker.io/alpine:latest",
40-
policy_id="*", policy_name="All policies",
40+
policy_id="default", policy_name="DefaultPolicy",
4141
warn_results=not_(be_empty))
4242
)
4343

0 commit comments

Comments
 (0)