Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 72d73ce

Browse files
daniel-sanchebusunkim96
authored andcommitted
[container analysis] effective severity [(#3478)](GoogleCloudPlatform/python-docs-samples#3478)
Use new effective_severity field fixes b/142836422
1 parent 787cd96 commit 72d73ce

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

samples/snippets/samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def find_high_severity_vulnerabilities_for_image(resource_url, project_id):
367367
vulnerabilities = grafeas_client.list_occurrences(project_name, filter_str)
368368
filtered_list = []
369369
for v in vulnerabilities:
370-
if v.severity == Severity.HIGH or v.severity == Severity.CRITICAL:
370+
if v.effective_severity == Severity.HIGH or v.effective_severity == Severity.CRITICAL:
371371
filtered_list.append(v)
372372
return filtered_list
373373
# [END containeranalysis_filter_vulnerability_occurrences]

samples/snippets/samples_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def test_find_high_severity_vulnerabilities(self):
278278
'note_name': client.note_path(PROJECT_ID, note_id),
279279
'resource_uri': self.image_url,
280280
'vulnerability': {
281+
'effective_severity': Severity.CRITICAL,
281282
'package_issue': [
282283
{
283284
'affected_cpe_uri': 'your-uri-here',

0 commit comments

Comments
 (0)