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
This commit is contained in:
Goffi 2017-10-16 07:39:54 +02:00
commit 158d61b84e

View file

@ -48,9 +48,17 @@ Tickets will be uploaded with the same ID as for Bugzilla, any existing ticket w
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 @@ class BugzillaParser(object):
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')