Mercurial > libervia-backend
changeset 2382:a49a19f06e38
plugin import ticket, import ticket bugzilla: some normalization in values:
normalization (i.e. recommandations for importer to have similar values) has been done for some values:
- "status" is now one of "queued", "started", "review", "closed"
- "priority" and "severity" must be stripped and lower case
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 16 Oct 2017 07:39:54 +0200 |
parents | 72c30e73a9a5 |
children | a37457da2bb7 |
files | src/plugins/plugin_tickets_import.py src/plugins/plugin_tickets_import_bugzilla.py |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_tickets_import.py Mon Oct 16 07:36:41 2017 +0200 +++ b/src/plugins/plugin_tickets_import.py Mon Oct 16 07:39:54 2017 +0200 @@ -73,7 +73,11 @@ 'version': version of the product/component concerned by this ticket 'platform': platform converned by this ticket 'os': operating system concerned by this ticket - 'status': current status of the ticket + 'status': current status of the ticket, values: + - "queued": ticket is waiting + - "started": progress is ongoing + - "review": ticket is fixed and waiting for review + - "closed": ticket is finished or invalid 'milestone': target milestone for this ticket """ if not 'schema' in session:
--- a/src/plugins/plugin_tickets_import_bugzilla.py Mon Oct 16 07:36:41 2017 +0200 +++ b/src/plugins/plugin_tickets_import_bugzilla.py Mon Oct 16 07:39:54 2017 +0200 @@ -48,9 +48,17 @@ location: you must use the absolute path to your .xml file """) +STATUS_MAP = { + 'NEW': 'queued', + 'ASSIGNED': 'started', + 'RESOLVED': 'review', + 'CLOSED': 'closed', + 'REOPENED': 'started' # we loose data here because there is no need on basic workflow to have a reopened status +} + class BugzillaParser(object): - + # TODO: add a way to reassign values def parse(self, file_path): tickets = [] @@ -69,14 +77,14 @@ ticket['assigned_to_name'] = assigned_to_elt.get('name') ticket['assigned_to_email'] = assigned_to_elt.text ticket['cc_emails'] = [e.text for e in bug.findall('cc')] - ticket['priority'] = bug.findtext('priority') - ticket['severity'] = bug.findtext('bug_severity') + ticket['priority'] = bug.findtext('priority').lower().strip() + ticket['severity'] = bug.findtext('bug_severity').lower().strip() ticket['product'] = bug.findtext('product') ticket['component'] = bug.findtext('component') ticket['version'] = bug.findtext('version') ticket['platform'] = bug.findtext('rep_platform') ticket['os'] = bug.findtext('op_sys') - ticket['status'] = bug.findtext('bug_status') + ticket['status'] = STATUS_MAP.get(bug.findtext('bug_status'), 'queued') ticket['milestone'] = bug.findtext('target_milestone')