From fe9e206667187b61a6315626aac4af29d3c8cbdf Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Wed, 22 Apr 2020 18:13:25 -0700 Subject: [PATCH] [container analysis] effective severity [(#3478)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3478) Use new effective_severity field fixes b/142836422 --- .../google-cloud-containeranalysis/samples/snippets/samples.py | 2 +- .../samples/snippets/samples_test.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-containeranalysis/samples/snippets/samples.py b/packages/google-cloud-containeranalysis/samples/snippets/samples.py index 9a3edc4ebc0a..2eeda1cae81a 100644 --- a/packages/google-cloud-containeranalysis/samples/snippets/samples.py +++ b/packages/google-cloud-containeranalysis/samples/snippets/samples.py @@ -367,7 +367,7 @@ def find_high_severity_vulnerabilities_for_image(resource_url, project_id): vulnerabilities = grafeas_client.list_occurrences(project_name, filter_str) filtered_list = [] for v in vulnerabilities: - if v.severity == Severity.HIGH or v.severity == Severity.CRITICAL: + if v.effective_severity == Severity.HIGH or v.effective_severity == Severity.CRITICAL: filtered_list.append(v) return filtered_list # [END containeranalysis_filter_vulnerability_occurrences] diff --git a/packages/google-cloud-containeranalysis/samples/snippets/samples_test.py b/packages/google-cloud-containeranalysis/samples/snippets/samples_test.py index b8eb6c5fbcba..04768836d009 100644 --- a/packages/google-cloud-containeranalysis/samples/snippets/samples_test.py +++ b/packages/google-cloud-containeranalysis/samples/snippets/samples_test.py @@ -278,6 +278,7 @@ def test_find_high_severity_vulnerabilities(self): 'note_name': client.note_path(PROJECT_ID, note_id), 'resource_uri': self.image_url, 'vulnerability': { + 'effective_severity': Severity.CRITICAL, 'package_issue': [ { 'affected_cpe_uri': 'your-uri-here',