aboutsummaryrefslogtreecommitdiffstats
path: root/bin/acme/srtool_jira_acme.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/acme/srtool_jira_acme.py')
-rwxr-xr-xbin/acme/srtool_jira_acme.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/bin/acme/srtool_jira_acme.py b/bin/acme/srtool_jira_acme.py
index d7ef0507..dcfdb81a 100755
--- a/bin/acme/srtool_jira_acme.py
+++ b/bin/acme/srtool_jira_acme.py
@@ -211,7 +211,7 @@ def do_update_jira():
products = c.execute('''SELECT * FROM orm_product''').fetchall()
for i,product in enumerate(products):
# print("JIRA_PRODUCT_SCAN:%s,%s" % (product[ORM.PRODUCT_DEFECT_TAGS],get_tag_key(product[ORM.PRODUCT_DEFECT_TAGS],'key')))
- product_defect_prefix = get_tag_key(product[ORM.PRODUCT_DEFECT_TAGS],'key')
+ product_defect_key = get_tag_key(product[ORM.PRODUCT_DEFECT_TAGS],'key')
if get_override('SRTDBG_MINIMAL_DB') and (i > 1):
break
@@ -227,7 +227,7 @@ def do_update_jira():
print("\tloading" + spinner[block_num % 4] + "\t" + product[ORM.PRODUCT_NAME] + " " + product[ORM.PRODUCT_VERSION] + " " + product[ORM.PRODUCT_PROFILE], end='\r', flush=True)
start_idx = block_num*block_size
#searches current project's bug issues that contain "cve" in their text
- issues = jira.search_issues('project=%s AND text ~ "cve*" AND type = Bug' % product_defect_prefix, start_idx, block_size, False, fields='key,summary,priority,status,resolution,project,updated,created,%s,%s' % (JIRA_PUBLISHED_FIELD, JIRA_FIX_VERSION_FIELD))
+ issues = jira.search_issues('project=%s AND text ~ "cve*" AND type = Bug' % product_defect_key, start_idx, block_size, False, fields='key,summary,priority,status,resolution,project,updated,created,%s,%s' % (JIRA_PUBLISHED_FIELD, JIRA_FIX_VERSION_FIELD))
if len(issues) == 0:
# Retrieve issues until there are no more to come
break
@@ -571,14 +571,14 @@ def jira_update_list(jira_list):
print("Updating:\t" + jira_name, flush=True)
# find the matching parent project
for i,product in enumerate(products):
- product_defect_prefix = get_tag_key(product[ORM.PRODUCT_DEFECT_TAGS],'key')
- print("\tfrom:\t%s %s %s %s" %(product[ORM.PRODUCT_NAME],product[ORM.PRODUCT_VERSION],product[ORM.PRODUCT_PROFILE],product_defect_prefix), flush=True)
+ product_defect_key = get_tag_key(product[ORM.PRODUCT_DEFECT_TAGS],'key')
+ print("\tfrom:\t%s %s %s %s" %(product[ORM.PRODUCT_NAME],product[ORM.PRODUCT_VERSION],product[ORM.PRODUCT_PROFILE],product_defect_key), flush=True)
block_size = 500
block_num = 0
while True:
start_idx = block_num*block_size
#searches current project's bug issues that contain "cve" in their text
- issues = jira.search_issues('project=%s AND text ~ "%s" AND type = Bug' % (product_defect_prefix,jira_name), start_idx, block_size, False, fields='key,summary,priority,status,resolution,project,updated,created,%s,%s' % (JIRA_PUBLISHED_FIELD, JIRA_FIX_VERSION_FIELD)) #project argument could be better written I guess :)
+ issues = jira.search_issues('project=%s AND text ~ "%s" AND type = Bug' % (product_defect_key,jira_name), start_idx, block_size, False, fields='key,summary,priority,status,resolution,project,updated,created,%s,%s' % (JIRA_PUBLISHED_FIELD, JIRA_FIX_VERSION_FIELD)) #project argument could be better written I guess :)
if len(issues) == 0:
# Retrieve issues until there are no more to come
break
@@ -720,8 +720,8 @@ def simulate_new_defect_name(product_prefix):
return defect_name
def simulate_new_defect(product_defect_tags,summary,cve_list,description,reason,priority,components,link,jira_url):
- product_defect_prefix = get_tag_key(product_defect_tags,'key')
- defect_name = simulate_new_defect_name(product_defect_prefix)
+ product_defect_key = get_tag_key(product_defect_tags,'key')
+ defect_name = simulate_new_defect_name(product_defect_key)
print("CREATED:%s,%s/browse/%s" % (defect_name,jira_url,defect_name))
def jira_new_defect(product_defect_tags,summary,cve_list,description,reason,priority,components,link):
@@ -751,19 +751,19 @@ def jira_new_defect(product_defect_tags,summary,cve_list,description,reason,prio
# append the jira link to description
description += "\n\n\n%s" % link
- product_defect_prefix = get_tag_key(product_defect_tags,'key')
+ product_defect_key = get_tag_key(product_defect_tags,'key')
# Translate the SRTool priority to Jira priority
priority = translate_priority_srt_to_jira(priority)
- #print("FOO1:%s,%s,%s" % (product_defect_prefix,summary,description))
+ #print("FOO1:%s,%s,%s" % (product_defect_key,summary,description))
jira_components=list()
for component in components.split(' '):
jira_components.append({'name' : component})
issue_dict = {
- 'project': {'key': product_defect_prefix},
+ 'project': {'key': product_defect_key},
'summary': summary,
'description': description,
'issuetype': {'name': 'Bug'},
@@ -784,10 +784,10 @@ def jira_new_defect(product_defect_tags,summary,cve_list,description,reason,prio
new_issue = jira.create_issue(fields=issue_dict)
#print("CREATE:%s" % issue_dict)
- #new_issue = '%s-%s' % (product_defect_prefix,datetime.now().strftime('%H%M%S'))
+ #new_issue = '%s-%s' % (product_defect_key,datetime.now().strftime('%H%M%S'))
new_issue = str(new_issue.key)
- if not new_issue.startswith(product_defect_prefix):
+ if not new_issue.startswith(product_defect_key):
print("ERROR:%s" % new_issue)
else:
print("CREATED:%s,%s/browse/%s" % (new_issue,jira_url,new_issue))
@@ -860,11 +860,11 @@ def main(argv):
if args.user:
srt_user = args.user
else:
- srt_user = os.environ.get('SRT_USER')
+ srt_user = os.environ.get('SRT_DEFECT_USER')
if args.passwd:
srt_passwd = args.passwd
else:
- srt_passwd = os.environ.get('SRT_PASSWD')
+ srt_passwd = os.environ.get('SRT_DEFECT_PASSWD')
if not srt_user or not srt_passwd:
msg = "FATAL ERROR: Missing user/password for Jira access"
print(msg)