Skip to content

Commit fbbd51b

Browse files
authored
Merge pull request #162 from nichollsdave/master
Modified way sub projects are determined from activityData to componentType attribute.
2 parents 8cbbe34 + 21556c4 commit fbbd51b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

examples/generate_source_reports_for_sub_projects_recursive.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,11 @@ def genreportsforversion(projectname,versionname,reportlist):
9292
projectname, versionname, result.status_code))
9393

9494
for component in components['items']:
95-
subname = (component['componentName'] + '_' + component['componentVersionName'] + '.zip')
96-
subname = (subname.replace(" ", ""))
97-
# Above step is to generate the output from the get_version_components and specifically look at the activityData
98-
# portion to indicate whether a component is a KB component, or a subproject.
99-
if len(component['activityData']) == 0:
100-
# Above checks length of output from activityData is >0. If equals 0, is sub-project.
101-
print("activityData is empty, {} is subproject version {}".format(component['componentName'],component['componentVersionName']))
95+
# NOTE THIS REQUIRES pip blackduck 0.0.56 to have the correct request header to obtain the componentType attribute.
96+
if component['componentType'] == 'SUB_PROJECT':
97+
print("is subproject, {} version {}".format(component['componentName'],component['componentVersionName']))
10298
genreportsforversion(component['componentName'],component['componentVersionName'],reportlist=['FILES'])
103-
elif len(component['activityData']) != 0:
99+
else:
104100
print('is OSS component, no report to download')
105101

106102

0 commit comments

Comments
 (0)