From cd4739e1d25fcd2f37bbb687cc1427d488eb6ee5 Mon Sep 17 00:00:00 2001 From: Miruna Paun Date: Fri, 14 Apr 2017 17:58:15 +0200 Subject: First draft of Virt profile to master branch LXCR-7536 Updating to the CR that contains info about this new profile documentation as a whole. Signed-off-by: Miruna Paun --- doc/gen_known_issues.py | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 doc/gen_known_issues.py (limited to 'doc/gen_known_issues.py') diff --git a/doc/gen_known_issues.py b/doc/gen_known_issues.py new file mode 100644 index 0000000..4f37120 --- /dev/null +++ b/doc/gen_known_issues.py @@ -0,0 +1,122 @@ +#!/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 bu 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 '
' -- cgit v1.2.3-54-g00ecf