Skip to content

Commit

Permalink
Merge branch 'main' into feat/2592-dark-mode-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiryous authored Dec 4, 2024
2 parents eb5ccce + 40d3733 commit 66c3aef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions keep/providers/jira_provider/jira_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class JiraProviderAuthConfig:
"sensitive": False,
"documentation_url": "https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/#Create-an-API-token",
"hint": "https://keephq.atlassian.net",
"validation": "https_url"
"validation": "https_url",
}
)

Expand Down Expand Up @@ -101,6 +101,7 @@ def __init__(
self, context_manager: ContextManager, provider_id: str, config: ProviderConfig
):
super().__init__(context_manager, provider_id, config)
self._host = None

def validate_scopes(self):
"""
Expand Down Expand Up @@ -161,10 +162,16 @@ def validate_config(self):
)

@property
def jira_host(self):
if self._host:
def jira_host(self) -> str:
if self._host is not None:
return self._host
self._host = str(self.authentication_config.host)
host = (
self.authentication_config.host
if self.authentication_config.host.startswith("https://")
or self.authentication_config.host.startswith("http://")
else f"https://{self.authentication_config.host}"
)
self._host = host
return self._host

def dispose(self):
Expand Down Expand Up @@ -483,9 +490,7 @@ def _query(self, ticket_id="", board_id="", **kwargs: dict):
kwargs (dict): The providers with context
"""
if not ticket_id:
request_url = (
f"{self.jira_host}/rest/agile/1.0/board/{board_id}/issue"
)
request_url = f"{self.jira_host}/rest/agile/1.0/board/{board_id}/issue"
response = requests.get(request_url, auth=self.__get_auth(), verify=False)
if not response.ok:
raise ProviderException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _format_alert(
message=annotations.get("summary"),
status=VictoriametricsProvider.STATUS_MAP[alert["status"]],
severity=VictoriametricsProvider.SEVERITIES_MAP[
alert.get("labels", {}).get("severity", "info")
labels.get("severity", "low")
],
startedAt=alert.get("startsAt"),
url=alert.get("generatorURL"),
Expand Down

0 comments on commit 66c3aef

Please sign in to comment.