Skip to content

Commit 94cff05

Browse files
author
Suyog Potnis
committed
Adding Comments
1 parent 32dc7e1 commit 94cff05

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

examples/write_component_source_paths_to_custom_field.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#!/usr/bin/env python
22

3+
"""
4+
Date: 04/07/2020
5+
Requirements:
6+
1. Define a Custom Field at the BOM Component Level from the Black Duck UI under Custom Fields Management.
7+
2. The field type needs to be "Text Area"
8+
9+
Script: Executing the script will write source paths of each component from a Project-Version to the defined Custom Field.
10+
Executing the script again will simply overwrite the existing values with new ones. This is particularly useful if an end-user
11+
is using REST APIs and would like to pull file paths.
12+
13+
"""
14+
315
import argparse
416
import logging
517

@@ -12,7 +24,8 @@
1224

1325
args = parser.parse_args()
1426

15-
custom_field_id = "4"
27+
# Set the Custom Field Id
28+
custom_field_id = ""
1629

1730

1831
custom_headers = {'Accept': 'application/vnd.blackducksoftware.bill-of-materials-6+json'}
@@ -23,6 +36,11 @@
2336
project = hub.get_project_by_name(args.project_name)
2437
version = hub.get_version_by_name(project, args.version)
2538

39+
# Custom Field Id Check
40+
if custom_field_id == "":
41+
print("Set the custom_field_id variable above with the correct Id and try executing the script again.")
42+
exit()
43+
2644
# Get all BOM Components
2745
bom_components = hub.get_version_components(version)
2846

0 commit comments

Comments
 (0)