Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_html_notices_from_json.py uses componentLicenses keys are missed from the report on latest releases #280

Open
senthilkumarasr opened this issue Nov 25, 2024 · 1 comment

Comments

@senthilkumarasr
Copy link

Hi Team,
While creating report using the script "examples/generate_html_notices_report_from_json/generate_html_notices_from_json.py", returning only below keys on the json on latest hub releases 2024.7.x+,

{
"reportContent": [
{
"fileName": "TestProject-ProjectVersion_2024-11-25_141727/version-license_2024-11-25_141727.json",
"fileContent": {
"projectVersion": [
{
"projectName": "TestProject",
"versionName": "ProjectVersion",
"versionPhase": "PLANNING",
"versionDistribution": "EXTERNAL"
}
],
"reportContents": [
{
"label": "Origin Copyright Text",
"description": "Copyright texts discovered by component origins. Only available if components with origins are present in the project.",
"category": "COPYRIGHT_TEXT",
"dependsOn": []
}
],
"componentCopyrightTexts": [
{
"componentVersionSummary": {
"projectName": "Apache Tomcat",
"versionName": "10.1.28",
"homeUrl": "http://tomcat.apache.org/"
},
"originFullName": "maven:org.apache.tomcat.embed:tomcat-embed-websocket:10.1.28",
"copyrightTexts": [
"Copyright 1999-2024 The Apache Software Foundation This product includes software developed at"
],
"originId": "a21266f9-f8eb-4039-a393-3e4773f94f20",
"componentProjectName": "Apache Tomcat"
}
]
},
"fileNamePrefix": "version-license_2024-11-25_141727"
}
]
}

but the script uses
fh.write(template.render(componentLicenses=fileContent['componentLicenses'],
licenseTexts=fileContent['licenseTexts'],
componentCopyrightTexts=fileContent['componentCopyrightTexts'],
projectVersion=fileContent['projectVersion']))

those fields are missed in the latest releases, so please update the script with latest hub releases

@Lythenas
Copy link

Lythenas commented Dec 3, 2024

I ran into the same issue. Root cause seems to be this: https://documentation.blackduck.com/bundle/bd-hub/page/ReleaseNotes/2024.7.x/apiEnhancements_2024_7_1.html (LICENSE_DATA and LICENSE_TEXT are no longer the default).

I fixed it running the following instead of calling create_version_notices_report:

    # copied and adapted version of
    # response = hub.create_version_notices_report(version, 'JSON', include_copyright_info=True)
    # with the new api changes that exclude the LICENSE_DATA and LICENSE_TEXT by default
    post_data = {
        'versionId': blackduck.Utils.object_id(version),
        'reportType': 'VERSION',
        'reportFormat': 'JSON',
        'categories': [
            'LICENSE_DATA', 'LICENSE_TEXT', 'COPYRIGHT_TEXT',
        ]
    }

    notices_report_url = hub.get_link(version, 'licenseReports')
    logger.error(notices_report_url)
    response = hub.execute_post(notices_report_url, post_data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants