Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. root_issue_data = {
  2. "project": {
  3. "key": remote_project
  4. },
  5.  
  6. "issuetype": {
  7. "name": "Application Change"
  8. },
  9.  
  10. "summary": u"{0} {1} {2} {3}".format(
  11. installation_source.vendor_name,
  12. installation_source.software_name,
  13. installation_source.version_name,
  14. installation_source.language_name,
  15. ),
  16.  
  17. "customfield_10376": str(current_workflow.id),
  18. "customfield_10327": installation_source.vendor_name,
  19. "customfield_10410": installation_source.software_name,
  20. "customfield_10444": installation_source.version_name,
  21. }
  22.  
  23. root_issue = jira_instance.create_issue(fields=root_issue_data)
  24.  
  25. packaging_document_manual = current_workflow.packaging_documents.filter_by(uploaded_by_user=True).first()
  26. packaging_document_automated = current_workflow.packaging_documents.filter_by(uploaded_by_user=False).first()
  27.  
  28. child_issue_description = "Project name: {0}\n\n".format(current_project.name)
  29.  
  30. if packaging_document_manual:
  31. child_issue_description += "Discovery document (Uploaded): {}\n".format(
  32. url_for("factory_packaging.download", type="packaging_document",
  33. id=packaging_document_manual.id,
  34. unique_hash=unique_hash, _external=True)
  35. )
  36.  
  37. if packaging_document_automated:
  38. child_issue_description += "Discovery document (Automated): {}\n".format(
  39. url_for("factory_packaging.download", type="packaging_document",
  40. id=packaging_document_automated.id,
  41. unique_hash=unique_hash, _external=True)
  42. )
  43.  
  44. child_issue_description += "Installation source: {}\n".format(
  45. url_for("factory_packaging.download", type="source",
  46. unique_hash=unique_hash, id=installation_source.id,
  47. _external=True)
  48. )
  49.  
  50. if current_workflow.supplementary_files.count():
  51. child_issue_description += "Supplementary files:\n"
  52.  
  53. for supplementary_file in current_workflow.supplementary_files:
  54. child_issue_description += "\t{0} - {1}\n".format(
  55. supplementary_file.file.name,
  56. url_for("factory_packaging.download", type="supplementary_file",
  57. unique_hash=unique_hash, id=supplementary_file.id,
  58. _external=True)
  59. )
  60.  
  61. packages = installation_source.workflow.packages.all()
  62.  
  63. if packages:
  64. child_issue_description += "\nPackages:\n"
  65.  
  66. for package in packages:
  67. if not package.file:
  68. continue
  69.  
  70. if package.type == 1:
  71. name = 'Installation Package'
  72. elif package.type == 2:
  73. name = 'Installation Package'
  74. elif package.type == 3:
  75. name = 'App-V Package'
  76. elif package.type == 4:
  77. name = 'SCCM MSI Importer'
  78. elif package.type == 5:
  79. name = 'SCCM App-V Importer'
  80. elif package.type == 7:
  81. name = 'Installation + configuration package'
  82. else:
  83. name = "Package"
  84.  
  85. child_issue_description += "\t{0} - {1} \n".format(
  86. name,
  87. url_for("factory_packaging.download", type="package",
  88. id=package.id, unique_hash=unique_hash, _external=True)
  89. )
  90.  
  91. child_issue_description += "\nApptimized Backend: " + url_for("factory_packaging.upload",
  92. unique_hash=unique_hash,
  93. _external=True)
  94.  
  95. child_issue_data = {
  96. "project": {
  97. "key": remote_project
  98. },
  99.  
  100. "issuetype": {
  101. "name": "Application Package"
  102. },
  103.  
  104. "parent": {
  105. "id": root_issue.key
  106. },
  107.  
  108. # "labels": [
  109. # installation_source.workflow.project.name
  110. # ],
  111.  
  112. "summary": u"Apptimized Package of {0} {1} {2}".format(
  113. installation_source.vendor_name,
  114. installation_source.software_name,
  115. installation_source.version_name
  116. ),
  117.  
  118. "customfield_10376": str(current_workflow.id),
  119. "customfield_10327": installation_source.vendor_name,
  120. "customfield_10410": installation_source.software_name,
  121. "customfield_10444": installation_source.version_name,
  122.  
  123. "customfield_10020": url_for("factory_packaging.download", type="source",
  124. id=installation_source.id, unique_hash=unique_hash,
  125. _external=True),
  126. # "customfield_10173": installation_source.app_reference,
  127. "description": child_issue_description
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement