feat(api): handle jira unauthorized
feat(api): fixed jira update
This commit is contained in:
parent
df240bc7c4
commit
c0f11b3cf4
2 changed files with 13 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.core.integration_jira_cloud_issue import JIRACloudIntegrationIssue
|
||||
from chalicelib.core import integration_base
|
||||
from chalicelib.core.integration_jira_cloud_issue import JIRACloudIntegrationIssue
|
||||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
PROVIDER = "JIRA"
|
||||
|
||||
|
|
@ -89,7 +89,9 @@ class JIRAIntegration(integration_base.BaseIntegration):
|
|||
return self.update(
|
||||
changes={
|
||||
"username": data["username"],
|
||||
"token": data["token"],
|
||||
"token": data["token"] \
|
||||
if data.get("token") and len(data["token"]) > 0 and data["token"].find("***") == -1 \
|
||||
else s["token"],
|
||||
"url": data["url"]
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
from jira import JIRA
|
||||
from jira.exceptions import JIRAError
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
from jira import JIRA
|
||||
from jira.exceptions import JIRAError
|
||||
from requests.auth import HTTPBasicAuth
|
||||
|
||||
fields = "id, summary, description, creator, reporter, created, assignee, status, updated, comment, issuetype, labels"
|
||||
|
|
@ -15,7 +16,11 @@ class JiraManager:
|
|||
def __init__(self, url, username, password, project_id=None):
|
||||
self._config = {"JIRA_PROJECT_ID": project_id, "JIRA_URL": url, "JIRA_USERNAME": username,
|
||||
"JIRA_PASSWORD": password}
|
||||
self._jira = JIRA({'server': url}, basic_auth=(username, password), logging=True)
|
||||
try:
|
||||
self._jira = JIRA({'server': url}, basic_auth=(username, password), logging=True, max_retries=1)
|
||||
except Exception as e:
|
||||
print("!!! JIRA AUTH ERROR")
|
||||
print(e)
|
||||
|
||||
def set_jira_project_id(self, project_id):
|
||||
self._config["JIRA_PROJECT_ID"] = project_id
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue