diff options
| author | Lennart Johansson <lennart.johansson@enea.com> | 2016-06-20 10:14:23 +0200 |
|---|---|---|
| committer | Lennart Johansson <lennart.johansson@enea.com> | 2016-06-20 10:14:23 +0200 |
| commit | d32acca7ab520ccbbb4b70304291a6db92f2e084 (patch) | |
| tree | d9f02d7349f0b63f84165f1d3da7f775373d7b90 /doc/gen_known_issues.py | |
| parent | c8bef6fd9e4186f2907107102be646f49b0231b8 (diff) | |
| download | el_releases-standard-d32acca7ab520ccbbb4b70304291a6db92f2e084.tar.gz | |
First commit for el6 standard
Diffstat (limited to 'doc/gen_known_issues.py')
| -rw-r--r-- | doc/gen_known_issues.py | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/doc/gen_known_issues.py b/doc/gen_known_issues.py new file mode 100644 index 0000000..a400577 --- /dev/null +++ b/doc/gen_known_issues.py | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | from subprocess import check_output | ||
| 4 | import json, re, datetime | ||
| 5 | import time | ||
| 6 | |||
| 7 | jd = json.JSONDecoder() | ||
| 8 | |||
| 9 | def jira_query(query): | ||
| 10 | jira_url = "http://eneaissues.enea.com" | ||
| 11 | fields = "key,summary" | ||
| 12 | query = query.replace(" ", "+") | ||
| 13 | |||
| 14 | cmd = ["curl", | ||
| 15 | "-s", | ||
| 16 | "-D-", | ||
| 17 | "-u", "rest_reader:jira123", | ||
| 18 | "-X", "GET", | ||
| 19 | "-H", "Content-Type: application/json", | ||
| 20 | jira_url + "/rest/api/2/search?jql=" + query + "&fields=" + fields | ||
| 21 | ] | ||
| 22 | |||
| 23 | tmp = check_output(cmd).splitlines() | ||
| 24 | tmp = jd.decode(tmp[-1]) | ||
| 25 | return tmp["issues"] | ||
| 26 | |||
| 27 | conditions = ("project=LXCR", | ||
| 28 | "issueType=bug", | ||
| 29 | "resolution=Unresolved", | ||
| 30 | 'affectedversion="Enea Linux 6"' | ||
| 31 | ) | ||
| 32 | |||
| 33 | bugs = [] | ||
| 34 | |||
| 35 | time_str = time.strftime("%Y-%m-%d, %H:%M:%S (%Z)") | ||
| 36 | |||
| 37 | for issue in jira_query(" and ".join(conditions)): | ||
| 38 | bugs.append((issue["key"], issue["fields"]["summary"])) | ||
| 39 | |||
| 40 | print '<?xml version="1.0" encoding="ISO-8859-1"?>' | ||
| 41 | print '<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"' | ||
| 42 | print '"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' | ||
| 43 | print '<section id="relinfo-extracted-from-jira">' | ||
| 44 | print ' <title>Extracted from Jira</title>' | ||
| 45 | |||
| 46 | print ' <para>' | ||
| 47 | print ' This section lists open bugs in Jira. Extracted at %s.' % time_str | ||
| 48 | print ' </para>' | ||
| 49 | |||
| 50 | print ' <remark>Jira query: (%s)</remark>' % "\n and ".join(conditions) | ||
| 51 | |||
| 52 | print ' <informaltable>' | ||
| 53 | print ' <tgroup cols="2">' | ||
| 54 | print ' <colspec colwidth="6*" colname="c1"/>' | ||
| 55 | |||
| 56 | print ' <colspec align="center" colwidth="1*" colname="c2"/>' | ||
| 57 | |||
| 58 | print ' <thead>' | ||
| 59 | print ' <row>' | ||
| 60 | print ' <entry align="center">Summary</entry>' | ||
| 61 | |||
| 62 | print ' <entry>Enea Ref</entry>' | ||
| 63 | print ' </row>' | ||
| 64 | print ' </thead>' | ||
| 65 | |||
| 66 | print ' <tbody>', | ||
| 67 | |||
| 68 | if bugs: | ||
| 69 | for bug in sorted(bugs): | ||
| 70 | |||
| 71 | print ' <row>' | ||
| 72 | print ' <entry>%s</entry>' % bug[1] | ||
| 73 | |||
| 74 | print ' <entry>%s</entry>' % bug[0] | ||
| 75 | print ' </row>' | ||
| 76 | |||
| 77 | else: | ||
| 78 | print ' <row>' | ||
| 79 | print ' <entry namest="c1" nameend="c2" align="center">' | ||
| 80 | print ' No issues found' | ||
| 81 | print ' </entry>' | ||
| 82 | print ' </row>' | ||
| 83 | |||
| 84 | print ' </tbody>' | ||
| 85 | print ' </tgroup>' | ||
| 86 | print ' </informaltable>' | ||
| 87 | |||
| 88 | if bugs: | ||
| 89 | print ' <para>Number of open bugs: %d</para>' % len(bugs) | ||
| 90 | |||
| 91 | print '</section>' | ||
