HBASE-19032 Set mimetype for patches uploaded by submit-patch.py

Change-Id: I38e6417dddd4e2525cd6a929922b2612c91d660d
This commit is contained in:
Apekshit Sharma 2017-10-17 15:32:39 -07:00
parent aeffd3ad76
commit 9908edc887
1 changed files with 4 additions and 4 deletions

View File

@ -205,10 +205,10 @@ def get_credentials():
return creds return creds
def attach_patch_to_jira(issue_url, patch_filepath, creds): def attach_patch_to_jira(issue_url, patch_filepath, patch_filename, creds):
# Upload patch to jira using REST API. # Upload patch to jira using REST API.
headers = {'X-Atlassian-Token': 'no-check'} headers = {'X-Atlassian-Token': 'no-check'}
files = {'file': open(patch_filepath, 'rb')} files = {'file': (patch_filename, open(patch_filepath, 'rb'), 'text/plain')}
jira_auth = requests.auth.HTTPBasicAuth(creds['jira_username'], creds['jira_password']) jira_auth = requests.auth.HTTPBasicAuth(creds['jira_username'], creds['jira_password'])
attachment_url = issue_url + "/attachments" attachment_url = issue_url + "/attachments"
r = requests.post(attachment_url, headers = headers, files = files, auth = jira_auth) r = requests.post(attachment_url, headers = headers, files = files, auth = jira_auth)
@ -256,7 +256,7 @@ if args.jira_id is not None:
creds = get_credentials() creds = get_credentials()
issue_url = "https://issues.apache.org/jira/rest/api/2/issue/" + args.jira_id issue_url = "https://issues.apache.org/jira/rest/api/2/issue/" + args.jira_id
attach_patch_to_jira(issue_url, patch_filepath, creds) attach_patch_to_jira(issue_url, patch_filepath, patch_filename, creds)
if not args.skip_review_board: if not args.skip_review_board:
rb_auth = requests.auth.HTTPBasicAuth(creds['rb_username'], creds['rb_password']) rb_auth = requests.auth.HTTPBasicAuth(creds['rb_username'], creds['rb_password'])