Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ def create_default_config():

# Jira server information
#server:
# url: https://linaro.atlassian.net
# token: abcdefghijkl
# url: https://issues.redhat.com
# token: abcdefghijkl # Jira Cloud Token
# token_auth: abcdefghijkl # Jira Personal Access Token

#test_server:
# url: https://<name_of_test_instance>.atlassian.net
# token: abcdefghijkl
# token: abcdefghijkl # Jira Cloud Token
# token_auth: abcdefghijkl # Jira Personal Access Token

# Extra comments added to each Jira issue (multiline is OK)
comments:
Expand Down
6 changes: 4 additions & 2 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ looks like this:
# Jira server information
#server:
# url: https://linaro.atlassian.net
# token: abcdefghijkl
# token: abcdefghijkl # Jira Cloud Token
# token_auth: abcdefghijkl # Jira Personal Access Token

#test_server:
# url: https://<name_of_test_instance>.atlassian.net
# token: abcdefghijkl
# token: abcdefghijkl # Jira Cloud Token
# token_auth: abcdefghijkl # Jira Personal Access Token

# Extra comments added to each Jira issue (multiline is OK)
comments:
Expand Down
10 changes: 7 additions & 3 deletions jiralogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ def get_jira_instance(use_test_server):
server = cfg.get_server(use_test_server)
url = server.get('url')
token = server.get('token')
token_auth = server.get('token_auth')

# password based authentication
if not token:
if not (token or token_auth):
password = get_password()

try:
if token:
log.debug("Accessing %s with %s using token based authentication" % (url, username))
if token_auth:
log.debug("Accessing %s with %s using personal access token authentication" % (url, username))
j = JIRA(url, token_auth=(token_auth)), username
elif token:
log.debug("Accessing %s with %s using cloud token authentication" % (url, username))
j = JIRA(url, basic_auth=(username, token)), username
else:
log.debug("Accessing %s with %s using password based authentication" % (url, username))
Expand Down