From 74c97c90a9fa10ebad46ec00061da9e2578b33a7 Mon Sep 17 00:00:00 2001 From: Miruna Paun Date: Fri, 7 Apr 2017 12:27:55 +0200 Subject: Updated ENFV (COSNOS) Installation Guide COSNOSCR-318 seeking to complete first time push --- gen_known_issues.py | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 gen_known_issues.py (limited to 'gen_known_issues.py') diff --git a/gen_known_issues.py b/gen_known_issues.py new file mode 100644 index 0000000..6d3f6e2 --- /dev/null +++ b/gen_known_issues.py @@ -0,0 +1,120 @@ +#!/usr/bin/python + +#------------------------------------------------------------------------------ +# This script generates an XML file with a table with issues in Jira. See the +# variable 'conditions' for query details. It is used by the make system in +# the generation of the release notes. +# The result is printed to STDOUT. +# +# It is possible to override the generation. If there is a file named +# jiraissues_override.xml in the current directory, then that file will be +# printed instead. This mechanism can be used if the table needs manual +# modifications. +# +#------------------------------------------------------------------------------ + +from subprocess import check_output +import json, re, datetime +import time + +try: + with open("book-enea-linux-release-info/doc/jiraissues_override.xml") as f: + print f.read(), + + exit(0) + +except SystemExit: + # Printing the override file was successful. Exception raised by + # the exit() call in the try block. + exit(0) + +except IOError: + # Accessing the override file failed. Assume that it does not exist + # and proceed with normal operation. + pass + +jd = json.JSONDecoder() + +def jira_query(query): + jira_url = "http://eneaissues.enea.com" + fields = "key,summary" + query = query.replace(" ", "+") + + cmd = ["curl", + "-s", + "-D-", + "-u", "rest_reader:jira123", + "-X", "GET", + "-H", "Content-Type: application/json", + jira_url + "/rest/api/2/search?jql=" + query + "&fields=" + fields + ] + + tmp = check_output(cmd).splitlines() + tmp = jd.decode(tmp[-1]) + return tmp["issues"] + +conditions = ("project=LXCR", + "issueType=bug", + "resolution=Unresolved", + 'affectedversion="Enea Linux 6"' + ) + +bugs = [] + +time_str = time.strftime("%Y-%m-%d, %H:%M:%S (%Z)") + +for issue in jira_query(" and ".join(conditions)): + bugs.append((issue["key"], issue["fields"]["summary"])) + +print '' +print '' +print '
' +print ' Extracted from Jira' +print +print ' ' +print ' This section lists open bugs in Jira. Extracted at %s.' % time_str +print ' ' +print +print ' Jira query: (%s)' % "\n and ".join(conditions) +print +print ' ' +print ' ' +print ' ' +print +print ' ' +print +print ' ' +print ' ' +print ' Summary' +print +print ' Enea Ref' +print ' ' +print ' ' +print +print ' ', + +if bugs: + for bug in sorted(bugs): + print + print ' ' + print ' %s' % bug[1] + print + print ' %s' % bug[0] + print ' ' + +else: + print ' ' + print ' ' + print ' No issues found' + print ' ' + print ' ' + +print ' ' +print ' ' +print ' ' + +if bugs: + print ' Number of open bugs: %d' % len(bugs) + +print '
' \ No newline at end of file -- cgit v1.2.3-54-g00ecf