Skip to content

Commit 6f299a8

Browse files
committed
vuln_batch_remediation.py: Fix broken script by only requesting 1000 items.
This makes the script work again with newer Blackduck versions.
1 parent 83bfd61 commit 6f299a8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

blackduck/Vulnerabilities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def get_vulnerable_bom_components(self, version_obj, limit=9999):
2828
param_string = self._get_parameter_string({'limit': limit})
2929
url = "{}{}".format(url, param_string)
3030
response = self.execute_get(url, custom_headers=custom_headers)
31+
response.raise_for_status()
3132
return response.json()
3233

3334
# TODO: Remove or refactor this

examples/vuln_batch_remediation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ def main(argv=None): # IGNORE:C0111
273273
exclusion_data = None
274274

275275

276-
# Retrieve the vulnerabiltites for the project version
277-
vulnerable_components = hub.get_vulnerable_bom_components(version)
278276

277+
# Retrieve the vulnerabiltites for the project version. Newer API versions only allow 1000 items at most.
278+
vulnerable_components = hub.get_vulnerable_bom_components(version, 1000)
279279
process_vulnerabilities(hub, vulnerable_components, remediation_data, exclusion_data, dry_run)
280280

281281
return 0

0 commit comments

Comments
 (0)