Skip to content

Commit

Permalink
fix: Return the correct policyID and policyName in get_image_scanning…
Browse files Browse the repository at this point in the history
…_results (#172)
  • Loading branch information
tembleking authored Nov 19, 2020
1 parent c9df8df commit a29825f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sdcclient/_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,8 @@ def get_image_scanning_results(self, image_name, policy_id=None):
policy_results = [result for result in json_res["results"] if result["policyId"] == policy_id]
if policy_results:
filtered_result_by_policy_id = policy_results[0]
result["policy_id"] = filtered_result_by_policy_id["policyId"]
result["policy_name"] = filtered_result_by_policy_id["policyName"]
result["total_stop"] = filtered_result_by_policy_id["nStop"]
result["total_warn"] = filtered_result_by_policy_id["nWarn"]
result["warn_results"] = [rule_result["checkOutput"]
Expand Down
2 changes: 1 addition & 1 deletion specs/secure/scanning/policy_evaluation_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
total_warn=be_above_or_equal(0), total_stop=be_above_or_equal(0),
last_evaluation=be_an(datetime),
status="pass", image_tag="docker.io/alpine:latest",
policy_id="*", policy_name="All policies",
policy_id="default", policy_name="DefaultPolicy",
warn_results=not_(be_empty))
)

Expand Down

0 comments on commit a29825f

Please sign in to comment.