# HG changeset patch # User Goffi # Date 1508132394 -7200 # Node ID a49a19f06e3860352a868577aebcc63279482461 # Parent 72c30e73a9a536fa0285a4a6f50d8c9abe5e1229 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 diff -r 72c30e73a9a5 -r a49a19f06e38 src/plugins/plugin_tickets_import.py --- 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: diff -r 72c30e73a9a5 -r a49a19f06e38 src/plugins/plugin_tickets_import_bugzilla.py --- 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')