|
18 | 18 | parser = argparse.ArgumentParser("A program to generate the notices file for a given project-version")
|
19 | 19 | parser.add_argument("project_name")
|
20 | 20 | parser.add_argument("version_name")
|
21 |
| - |
22 |
| -# TODO: Add the copyright checkbox option |
23 |
| - |
24 | 21 | parser.add_argument('-f', "--file_name_base", default="notices_report", help="Base file name to write the report data into. If the report format is TEXT a .zip file will be created, otherwise a .json file")
|
25 | 22 | parser.add_argument('-r', '--report_format', default='TEXT', choices=["JSON", "TEXT"], help="Report format - choices are TEXT or HTML")
|
26 | 23 | parser.add_argument('-c', '--include_copyright_info', action='store_true', help="Set this option to have additional copyright information from the Black Duck KB included in the notices file report.")
|
@@ -53,6 +50,12 @@ def download_report(location, file_name_base, retries=10):
|
53 | 50 | json.dump(response.json(), f, indent=3)
|
54 | 51 | logging.info("Successfully downloaded json file to {} for report {}".format(
|
55 | 52 | filename, report_id))
|
| 53 | + elif response.status_code == 412 and response.json()['errorCode'] == '{report.main.read.unfinished.report.contents}': |
| 54 | + # failed to download, and report generation still in progress, wait and try again infinitely |
| 55 | + # TODO: is it possible for things to get stuck in this forever? |
| 56 | + logging.warning(f"Failed to retrieve report {report_id} for reason {response.json()['errorCode']}. Waiting 5 seconds then trying infinitely") |
| 57 | + time.sleep(5) |
| 58 | + download_report(location, file_name_base, retries) |
56 | 59 | else:
|
57 | 60 | logging.warning("Failed to retrieve report {}".format(report_id))
|
58 | 61 | logging.warning("Probably not ready yet, waiting 5 seconds then retrying (remaining retries={}".format(retries))
|
|
0 commit comments