本文整理汇总了Python中jira.JIRA.create_issue方法的典型用法代码示例。如果您正苦于以下问题:Python JIRA.create_issue方法的具体用法?Python JIRA.create_issue怎么用?Python JIRA.create_issue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jira.JIRA
的用法示例。
在下文中一共展示了JIRA.create_issue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_jira
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def create_jira(self, username):
options = {
'server': '%s' % settings.JIRA_OPTS['URL'],
'verify': settings.JIRA_OPTS.get('VERIFY_SSL', False)
}
project = self.cleaned_data.get('project')
summary = self.cleaned_data.get('summary')
issue_type = self.cleaned_data.get('issue_type')
component = self.cleaned_data.get('component')
description = self.cleaned_data.get('description')
description += '*JIRA Created by:* %s' % username
try:
jconn = JIRA(options, basic_auth=(settings.JIRA_OPTS['USER'], settings.JIRA_OPTS['PASSWORD']))
except Exception as e:
logger.error('Error creating JIRA ticket :%s' % e)
raise forms.ValidationError(u"Error connecting to JIRA ticket, please check the server logs")
try:
jira_ticket = jconn.create_issue(project=project, summary=summary, description=description,
issuetype={'name': issue_type}, components=[{'name': component}])
except Exception as e:
logger.error('Error creating JIRA ticket project=%s, summary=%s, issue_type=%s, description=%s,' % (project,
summary,
issue_type,
description))
logger.error('Server message %s' % e)
msg = u"Error creating JIRA ticket, please check the project name and issue type. If that doesn't work then check the server logs"
raise forms.ValidationError(msg)
if isinstance(jira_ticket, jira.resources.Issue):
return jira_ticket.key
else:
raise forms.ValidationError(u"Error creating JIRA ticket, JIRA server did not return a ticket key.")
示例2: add_issue
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def add_issue(find, push_to_jira):
eng = Engagement.objects.get(test=find.test)
prod = Product.objects.get(engagement= eng)
jpkey = JIRA_PKey.objects.get(product=prod)
jira_conf = jpkey.conf
if push_to_jira:
if 'Active' in find.status() and 'Verified' in find.status():
try:
JIRAError.log_to_tempfile=False
jira = JIRA(server=jira_conf.url, basic_auth=(jira_conf.username, jira_conf.password))
if jpkey.component:
new_issue = jira.create_issue(project=jpkey.project_key, summary=find.title,
components=[{'name': jpkey.component}, ],
description=jira_long_description(find.long_desc(), find.id,
jira_conf.finding_text),
issuetype={'name': jira_conf.default_issue_type},
priority={'name': jira_conf.get_priority(find.severity)})
else:
new_issue = jira.create_issue(project=jpkey.project_key, summary=find.title,
description=jira_long_description(find.long_desc(), find.id,
jira_conf.finding_text),
issuetype={'name': jira_conf.default_issue_type},
priority={'name': jira_conf.get_priority(find.severity)})
j_issue = JIRA_Issue(jira_id=new_issue.id, jira_key=new_issue, finding=find)
j_issue.save()
issue = jira.issue(new_issue.id)
#Add labels (security & product)
add_labels(find, new_issue)
#Upload dojo finding screenshots to Jira
for pic in find.images.all():
jira_attachment(jira, issue, settings.MEDIA_ROOT + pic.image_large.name)
#if jpkey.enable_engagement_epic_mapping:
# epic = JIRA_Issue.objects.get(engagement=eng)
# issue_list = [j_issue.jira_id,]
# jira.add_issues_to_epic(epic_id=epic.jira_id, issue_keys=[str(j_issue.jira_id)], ignore_epics=True)
except JIRAError as e:
log_jira_alert(e.text, find)
else:
log_jira_alert("Finding not active or verified.", find)
示例3: JiraApi
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
class JiraApi():
def __init__(self, instance=None):
self.instance = instance
@staticmethod
def get_datetime_now():
return datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.0+0000")
def connect(self):
options = {'server': app.config['JIRA_HOSTNAME'],'verify':False}
self.instance = JIRA(options,
basic_auth=(app.config['JIRA_USERNAME'], app.config['JIRA_PASSWORD']))
@staticmethod
def ticket_link(issue):
return '<a href="{}/browse/{}">{}</a>'.format(app.config['JIRA_HOSTNAME'], issue.key, issue.key)
def resolve(self, issue):
self.instance.transition_issue(
issue,
app.config['JIRA_RESOLVE_TRANSITION_ID'],
assignee={'name': app.config['JIRA_USERNAME']},
resolution={'id': app.config['JIRA_RESOLVE_STATE_ID']})
def defect_for_exception(self, summary_title, e):
return self.instance.create_issue(
project='IPGBD',
summary='[auto-{}] Problem: {}'.format(current_user.username, summary_title),
description="Exception: {}".format(e),
customfield_13842=JiraApi.get_datetime_now(),
customfield_13838= {
"self": "https://jira.rim.net/rest/api/2/customFieldOption/16680",
"value": "No",
"id": "16680"
},
customfield_13831 = [
{
"self": "https://jira.rim.net/rest/api/2/customFieldOption/16592",
"value": "Quality",
"id": "16592"
},
{
"self": "https://jira.rim.net/rest/api/2/customFieldOption/16594",
"value": "Risk Avoidance",
"id": "16594"
}],
issuetype={'name': 'Defect'})
示例4: add_epic
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def add_epic(eng, push_to_jira):
engagement = eng
prod = Product.objects.get(engagement=engagement)
jpkey = JIRA_PKey.objects.get(product=prod)
jira_conf = jpkey.conf
if jpkey.enable_engagement_epic_mapping and push_to_jira:
issue_dict = {
'project': {'key': jpkey.project_key},
'summary': engagement.name,
'description' : engagement.name,
'issuetype': {'name': 'Epic'},
'customfield_' + str(jira_conf.epic_name_id) : engagement.name,
}
jira = JIRA(server=jira_conf.url, basic_auth=(jira_conf.username, jira_conf.password))
new_issue = jira.create_issue(fields=issue_dict)
j_issue = JIRA_Issue(jira_id=new_issue.id, jira_key=new_issue, engagement=engagement)
j_issue.save()
示例5: create_issue
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def create_issue(self, blank_issue=False):
self.__populate_fields()
if blank_issue:
self.DESCRIPTION_TEMPLATE = ""
jira = JIRA(options=self.JIRA_OPTIONS, basic_auth=(self.USER_NAME, self.USER_PW)) # jira-python API
new_issue = jira.create_issue(fields=self.ISSUE_FIELDS)
issue_url = self.JIRA_SERVER + "browse/" + new_issue.key
wb.open_new_tab(issue_url)
print '[+] Created a new ticket: ', self.SUMMARY_TEMPLATE
print '[+] Issue:', new_issue.key
print '---------------------------------------------------'
print ' +++++++++++++++++++++++++++++++++++++++++++++++++ '
print '---------------------------------------------------'
print '[+] Template used:'
print self.DESCRIPTION_TEMPLATE
示例6: __init__
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def __init__(self):
options = {
'server': 'http://192.168.33.49:8080'
}
jira_client = JIRA(options, basic_auth=('scm', 'scm'))
# 创建项目模块
# print jira_client.create_component(name=u'项目共性问题', project='SCM')
# 创建issue
issue_dict = {
'project': {'key': 'PUBISSUE'},
'summary': u'项目共性问题测试002',
'issuetype': {'name': 'New Feature'},
}
new_issue = jira_client.create_issue(fields=issue_dict)
示例7: import_issue
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def import_issue(self, message, bug):
"""import lp ____: Creates a Jira ticket based on ___ bug"""
jira = JIRA(
basic_auth=(settings.JIRA_USER, settings.JIRA_PASS),
server=settings.JIRA_HOST,
validate=False,
options={'verify': False}
)
issues = jira.search_issues(self.SEARCH_PATTERN % (
settings.JIRA_PROJ, bug, bug))
if len(issues) > 0:
self.reply(
message,
self.render_jira(issues[0]),
html=True
)
else:
launchpad = Launchpad.login_anonymously(
'will_jira_import',
'production'
)
try:
launchpad.bugs[bug]
except KeyError:
self.reply(message, "That issue does not exist in Launchpad")
return
issue_dict = {
'project': {'key': settings.JIRA_PROJ},
'summary': launchpad.bugs[bug].title,
'description': launchpad.bugs[bug].description,
'issuetype': {'name': 'Bug'},
'customfield_10602': launchpad.bugs[bug].web_link,
'components': [{'id': '18567'}],
'reporter': {'name': self.get_requester_email(message)}
}
self.reply(message, "I need to create that")
new_issue = jira.create_issue(fields=issue_dict)
self.reply(message, self.render_jira(new_issue), html=True)
示例8: create_project
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def create_project(params):
api_server = params['api_url']
api_username = params['api_username']
api_password = params['api_password']
auth = (api_username, api_password)
jira = JIRA( {'server': api_server}, basic_auth=auth)
project_key = params['project_key']
project_name = params['project_name']
assignee = params['assignee']
# create project and view
if not jira.create_project(project_key, name=project_name, assignee=assignee):
return None
proj = jira.project(project_key)
board = jira.create_board("{0} View".format(project_name), project_key, preset='scrum')
issue = jira.create_issue(
project=project_key,
summary="Sample Issue for {0}".format(project_name),
description="This is just sample",
issuetype={"name":"Task"}
)
return proj
示例9: create_jira
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def create_jira(self, username):
options = {"server": "%s" % settings.JIRA_OPTS["URL"], "verify": settings.JIRA_OPTS.get("VERIFY_SSL", False)}
project = self.cleaned_data.get("project")
summary = self.cleaned_data.get("summary")
issue_type = self.cleaned_data.get("issue_type")
component = self.cleaned_data.get("component")
description = self.cleaned_data.get("description")
description += "*JIRA Created by:* %s" % username
try:
jconn = JIRA(options, basic_auth=(settings.JIRA_OPTS["USER"], settings.JIRA_OPTS["PASSWORD"]))
except Exception as e:
logger.error("Error creating JIRA ticket :%s" % e)
raise forms.ValidationError("Error connecting to JIRA ticket, please check the server logs")
try:
jira_ticket = jconn.create_issue(
project=project,
summary=summary,
description=description,
issuetype={"name": issue_type},
components=[{"name": component}],
)
except Exception as e:
logger.error(
"Error creating JIRA ticket project=%s, summary=%s, issue_type=%s, description=%s,"
% (project, summary, issue_type, description)
)
logger.error("Server message %s" % e)
msg = "Error creating JIRA ticket, please check the project name and issue type. If that doesn't work then check the server logs"
raise forms.ValidationError(msg)
if isinstance(jira_ticket, jira.resources.Issue):
return jira_ticket.key
else:
raise forms.ValidationError("Error creating JIRA ticket, JIRA server did not return a ticket key.")
示例10: quote
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def quote(x):
return '"' + x + '"'
if not options.componentjbide and not options.componentjbds:
rootJBDS_dict = {
'project' : { 'key': 'JBDS' },
'summary' : 'For JBDS ' + jbds_fixversion + ': ' + taskdescription,
'description' : 'For JBDS ' + jbds_fixversion + ': ' + taskdescriptionfull + '\n\n[Search for all task JIRA|' + tasksearch + ']',
'issuetype' : { 'name' : 'Task' },
'priority' : { 'name' :'Blocker'},
'fixVersions' : [{ "name" : jbds_fixversion }],
'components' : [{ "name" : "installer" }],
'labels' : [ "task" ],
}
rootJBDS = jira.create_issue(fields=rootJBDS_dict)
installerLead = queryComponentLead(CLJBDS, 'installer', 0)
try:
jira.assign_issue(rootJBDS, installerLead)
except:
if (not options.jiraonly):
print "[WARNING] Unexpected error! User {0} tried to assign {1} to {2}: {3}".format(options.usernameJIRA, rootJBDS, installerLead, sys.exc_info()[0])
if (options.jiraonly):
print(rootJBDS.key)
else:
print("Task JIRA created for this milestone include:")
print("")
print("JBDS : " + jiraserver + '/browse/' + rootJBDS.key + " => " + installerLead)
rootJBIDE_dict = {
'project' : { 'key': 'JBIDE' },
示例11: create_jira_ticket
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def create_jira_ticket(summary, description, **kwargs):
"""
Create a new jira ticket, returning the associated number.
Examples:
Synchronously create a jira ticket::
create_jira_ticket("Test Ticket", "This is a test")
Asynchronously create a jira ticket::
create_jira_ticket.delay("Test Ticket", "This is a test")
Inputs:
.. note:: watchers and watcher_group are mutually exclusive.
:summary: The ticket summary
:description: The ticket description
:assignee: Who the ticket should be assigned to. Defaults to "-1" which
is analogous to selecting "automatic" on the JIRA web form.
:reporter: Who created the ticket (or is responsible for QCing it).
Defaults to "automaticagent".
:issuetype: The type of issue. Defaults to "Task".
:project: The project the ticket should be created in. Defaults to
"ST", which is Product Support.
:priority: Ticket Priority. Defaults to "Major".
:components: A list of components this ticket belongs to.
:watchers: A list of user names to add as watchers of this ticket.
:watcher_group: A group to assign as watchesr.
Output:
.. note:: The instance isn't returned because we need the ability to pass
the results to another asynchronous task without blocking, which
requires that all arguments be serializable.
The ticket key which corresponds to the created JIRA ticket.
"""
jira = JIRA(options=options, basic_auth=housekeeping_auth)
assignee = {'name': kwargs.setdefault('assignee', '-1')}
reporter = {'name': kwargs.setdefault('reporter', 'automationagent')}
issuetype = {'name': kwargs.setdefault('issuetype', 'Task')}
project = {'key': kwargs.setdefault('project', 'ST')}
priority = {'name': kwargs.setdefault('priority', 'Major')}
components = [{'name': name}
for name in kwargs.setdefault('components', [])]
watchers = kwargs.setdefault('watchers', set())
if 'watcher_group' in kwargs:
watchers = watchers.union(
jira.group_members(kwargs['watcher_group']).keys())
if assignee == reporter:
raise ValueError("Assignee and reporter must be different.")
fields = {
'project': project,
'summary': summary,
'description': description,
'issuetype': issuetype,
'priority': priority,
'reporter': reporter,
'assignee': assignee,
'components': components,
}
issue = jira.create_issue(fields=fields)
for watcher in watchers:
jira.add_watcher(issue, watcher)
return issue.key
示例12: Jira
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
class Jira(object):
"""
jira operation class
"""
def __init__(self, **args):
"""
Init JIRA connection
"""
self.server = settings.CASELINK_JIRA['SERVER']
self.username = settings.CASELINK_JIRA['USER']
self.password = settings.CASELINK_JIRA['PASSWORD']
self.verify = False # TODO: move to settings
self._jira = JIRA(options={
'server': self.server,
'verify': self.verify,
}, basic_auth=(self.username, self.password))
def search_issues(self, project_name, jql_str, fields=None):
"""
Search issue under the project and return result
"""
jql_str = "project = " + project_name + " and " + jql_str
return self.jira_.search_issues(jql_str, maxResults=-1, fields=fields)
def add_comment(self, issue, comment):
"""
Add comments in the issue
"""
if isinstance(issue, (str, unicode)):
issue = self._jira.issue(issue)
return self._jira.add_comment(issue, comment)
def transition_issue(self, issue, status):
"""
Transition issue status to another
"""
self.jira_.transition_issue(issue, status)
def get_watchers(self, issue):
"""
Get a watchers Resource from the server for an issue
"""
watcher_data = self.jira_.watchers(issue)
return [str(w.key) for w in watcher_data.watchers]
def add_watcher(self, issue, watchers):
"""
Append an issue's watchers list
"""
new_watchers = []
if isinstance(watchers, str):
new_watchers.append(watchers)
elif isinstance(watchers, list):
new_watchers = watchers
for watcher in new_watchers:
self.jira_.add_watcher(issue, watcher)
def remove_watcher(self, issue, watchers):
"""
Remove watchers from an issue's watchers list
"""
del_watchers = []
if isinstance(watchers, str):
del_watchers.append(watchers)
elif isinstance(watchers, list):
del_watchers = watchers
for watcher in del_watchers:
self.jira_.remove_watcher(issue, watcher)
def create_issue(self, issue_dict):
"""
Create Issue and apply some default properties
"""
dict_ = {
'project': {
'key': 'LIBVIRTAT',
},
'summary': None,
'description': None,
'priority': {
'name': 'Major',
},
'assignee': {
'name': None
},
}
parent_issue = issue_dict.pop('parent_issue', None) or settings.CASELINK_JIRA['DEFAULT_PARENT_ISSUE']
assignee = issue_dict.pop('assignee', None) or settings.CASELINK_JIRA['DEFAULT_ASSIGNEE']
dict_.update({
'assignee': {
'name': assignee
}
})
if parent_issue:
dict_.update({
'parent': {
'id': parent_issue
#.........这里部分代码省略.........
示例13: prettyXML
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
failureDetails = failureDetails + '{code:title=' + testurl + '' + className_re + '/' + name_re + '}\n'
failureDetails = failureDetails + prettyXML(s)
failureDetails = failureDetails + '\n{code}\n\n'
#print failureDetails
rootJBIDE_dict = {
'project' : { 'key': 'JBIDE' },
'summary' : str(len(testcaselist)) + ' Test Failure(s) in JBIDE ' + jbide_affectedversion + ' for ' + component + ' component',
'description' : failureSummary + failureDetails,
'issuetype' : { 'name' : 'Task' },
'priority' : { 'name' :'Critical'},
'versions' : [{ "name" : jbide_affectedversion }],
'components' : [{ "name" : component }],
'labels' : [ "testfailure" ]
}
jira = JIRA(options={'server':jiraserver}, basic_auth=(options.usernameJIRA, options.passwordJIRA))
CLJBIDE = jira.project_components(jira.project('JBIDE')) # full list of components in JBIDE
rootJBIDE = jira.create_issue(fields=rootJBIDE_dict)
componentLead = queryComponentLead(CLJBIDE, component, 0)
try:
jira.assign_issue(rootJBIDE, componentLead)
except:
print "[WARNING] Unexpected error! User {0} tried to assign {1} to {2}: {3}".format(options.usernameJIRA, rootJBIDE, componentLead, sys.exc_info()[0])
accept = raw_input("\nAccept new JIRA " + jiraserver + '/browse/' + rootJBIDE.key + " => " + componentLead + " ? [Y/n] ")
if accept.capitalize() in ["N"] :
rootJBIDE.delete()
# see JIRA_components listing in components.py
# Sample usage: see createTestFailureJIRA.py.examples.txt
示例14: main
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
def main(arguments):
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config-file', required=True)
parser.add_argument('-w', '--write-jira', action='store_true')
args = parser.parse_args(arguments)
settings = ConfigParser.ConfigParser()
settings.read(args.config_file)
# Connect to Bugzilla
bz_url = settings.get('bugzilla', 'url')
bz_user = settings.get('bugzilla', 'user')
bz_pass = settings.get('bugzilla', 'pass')
bz_product = settings.get('bugzilla', 'product')
bzURL = 'https://%s:%[email protected]%s' % (bz_user, bz_pass, bz_url)
bzapi = bugzilla.Bugzilla(url=bzURL,
user=bz_user,
password=bz_pass,
sslverify=False,
use_creds=False)
# Connect to JIRA
jira_url = settings.get('jira', 'url')
jira_user = settings.get('jira', 'user')
jira_pass = settings.get('jira', 'pass')
jira_product = settings.get('jira', 'product')
jira_project = settings.get('jira', 'project')
jac = JIRA(server=jira_url,
basic_auth=(jira_user, jira_pass))
# Obtain Bugzilla bugs
query = bzapi.build_query(product=bz_product)
t1 = time.time()
bugs = bzapi.query(query)
t2 = time.time()
print("Found %d bugs in BugZilla with our query" % len(bugs))
print("Quicker query processing time: %s" % (t2 - t1))
# Sync Bugzilla bugs with Jira
# For simplicity and for reporting only 2 states are considered in JIRA
# Open and Closed(Resolved)
cnt_update = 0
cnt_new = 0
for bzbug in bugs:
if bzbug.see_also:
# Check if the bug exists in Jira and sync the status
# we look for a JIRA in link in the see_also fields in bugzilla
for url in bzbug.see_also:
if jira_url in url:
issue = jac.issue(url.rsplit('/',1)[-1])
# Assuming that JIRA issues will only have 2 status if the bug is
# resolved in bugzilla we close it in JIRA
if not args.write_jira and bzbug.status == "RESOLVED" and issue.fields.status == "Open":
print("Sync status Bug id=%s summary=%s status=%s jira_status=%s"
% (bzbug.id, bzbug.summary, status_mapping[bzbug.status], issue.fields.status))
elif bzbug.status == "RESOLVED" and issue.fields.status == "Open":
# Close Issue
jira.transition_issue(issue, '2')
cnt_update += 1
else:
print("Not need to Sync Bug id=%s summary=%s status=%s jira_status=%s"
% (bzbug.id, bzbug.summary, status_mapping[bzbug.status], issue.fields.status))
# We assume 1<->1 links from bugzilla to jira
break
else:
# Create Bugzilla bug in JIRA
bzbug_url = 'https://%s/show_bug.cgi?id=%i' % (bz_url, bzbug.id)
if args.write_jira:
new_issue = jac.create_issue(project=jira_project,
summary=bzbug.summary,
labels=[jira_product, "bugzilla"],
customfield_16700=bzbug_url,
issuetype={'name': 'Bug'})
issue_url = 'https://%s/browse/%s' % (jira_url, new_issue.key)
# add the JIRA link to the see_also field
update = bzapi.build_update(see_also_add=[issue_url])
bzapi.update_bugs([bzbug.id], update)
if status_mapping[bzbug.status] != new_issue.fields.status:
sync_bug_status(jac, new_issue, bzbug.status, new_issue.fields.status)
else:
print("Create new Bug id=%s summary=%s status=%s"
% (bzbug.id, bzbug.summary, bzbug.status))
cnt_new += 1
if args.write_jira:
print("%i bugs will be created in JIRA" % cnt_new)
print("%i bugs will be synced between JIRA and Bugzilla" % cnt_update)
示例15: str
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import create_issue [as 别名]
logger.info("{0} Jira bugs were found".format(len(Jbugs)))
logger.info("{0} Launchpad bugs were found".format(len(lp_bugs)))
for Lbug in lp_bugs:
m = str(Lbug.milestone).replace('https://api.launchpad.net/' + lp_api +
'/' + lp_project + '/+milestone/', '')
logger.info("{0} milestone: {1}".format(Lbug.title.encode('utf-8'), m))
it_created = False
for Jbug in Jbugs:
if str(Lbug.bug.id) in Jbug.fields.summary:
for ver in Jbug.fields.fixVersions:
if milestones[m] in ver.name:
logger.info("Matched to Jira issue {0} ({1})".format(
Jbug.key, Jbug.fields.summary.encode('utf-8')))
it_created = True
sync_jira_status(Jbug, Lbug)
break
if not it_created and not Lbug.bug.duplicate_of and Lbug.status not in \
["Won't Fix", 'Invalid', 'Fix Released']:
summary = Lbug.title
newJbug = jira.create_issue(project=jira_project,
summary=summary,
description=Lbug.web_link,
labels=['launchpad'],
issuetype={'name': 'Bug'})
logger.info("Jira issue {0} ({1}) was successfully added".format(
newJbug.key, newJbug.fields.summary.encode('utf-8')))
issue_dict = {"fixVersions": [{"name": milestones[m]}]}
newJbug.update(fields=issue_dict)
sync_jira_status(newJbug, Lbug)