From 638ab7261beaf8f29cf2050df19281564bd3b8bf Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 19 May 2025 17:45:38 -0700 Subject: [PATCH 1/4] fix(jira): pass url as str --- src/dispatch/plugins/dispatch_jira/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_jira/plugin.py b/src/dispatch/plugins/dispatch_jira/plugin.py index 73cd04aa7bb6..a0f1246949cf 100644 --- a/src/dispatch/plugins/dispatch_jira/plugin.py +++ b/src/dispatch/plugins/dispatch_jira/plugin.py @@ -145,7 +145,7 @@ def create_dict_from_plugin_metadata(plugin_metadata: dict): def create_client(configuration: JiraConfiguration) -> JIRA: """Creates a Jira client.""" return JIRA( - configuration.api_url, + str(configuration.api_url), basic_auth=(configuration.username, configuration.password.get_secret_value()), ) From 210c9278335ea87aad90524a4909881441c5be85 Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 19 May 2025 17:48:42 -0700 Subject: [PATCH 2/4] fixing confluence as well --- .../plugins/dispatch_atlassian_confluence/docs/plugin.py | 2 +- src/dispatch/plugins/generic_workflow/plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dispatch/plugins/dispatch_atlassian_confluence/docs/plugin.py b/src/dispatch/plugins/dispatch_atlassian_confluence/docs/plugin.py index 1b9cdc2b2a3d..ae92413df341 100644 --- a/src/dispatch/plugins/dispatch_atlassian_confluence/docs/plugin.py +++ b/src/dispatch/plugins/dispatch_atlassian_confluence/docs/plugin.py @@ -43,7 +43,7 @@ def update(self, document_id: str, **kwargs): """Replaces text in document.""" kwargs = {"{{" + k + "}}": v for k, v in kwargs.items()} confluence_client = Confluence( - url=self.configuration.api_url, + url=str(self.configuration.api_url), username=self.configuration.username, password=self.configuration.password.get_secret_value(), cloud=self.configuration.hosting_type, diff --git a/src/dispatch/plugins/generic_workflow/plugin.py b/src/dispatch/plugins/generic_workflow/plugin.py index af2dd18c7756..542793b20a82 100644 --- a/src/dispatch/plugins/generic_workflow/plugin.py +++ b/src/dispatch/plugins/generic_workflow/plugin.py @@ -102,7 +102,7 @@ def get_workflow_instance( @retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=1, max=10)) def run(self, workflow_id: str, params: dict, **kwargs): logging.info("Run on generic workflow %s, %s", params, kwargs) - api_url = self.configuration.api_url + api_url = str(self.configuration.api_url) obj = {"workflow_id": workflow_id, "params": params} headers = { "Content-Type": "application/json", From c1df48b61d580a3e96cdea2a1a71b0b826793e2d Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 19 May 2025 17:51:17 -0700 Subject: [PATCH 3/4] Additional fixes --- .../plugins/dispatch_atlassian_confluence/plugin.py | 4 ++-- src/dispatch/plugins/dispatch_pagerduty/plugin.py | 12 ++++++------ src/dispatch/plugins/generic_workflow/plugin.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dispatch/plugins/dispatch_atlassian_confluence/plugin.py b/src/dispatch/plugins/dispatch_atlassian_confluence/plugin.py index 6b062ccc6fe4..9d841a91d273 100644 --- a/src/dispatch/plugins/dispatch_atlassian_confluence/plugin.py +++ b/src/dispatch/plugins/dispatch_atlassian_confluence/plugin.py @@ -58,7 +58,7 @@ def create_file( if file_type not in ["document", "folder"]: return None confluence_client = Confluence( - url=self.configuration.api_url, + url=str(self.configuration.api_url), username=self.configuration.username, password=self.configuration.password.get_secret_value(), cloud=self.configuration.hosting_type, @@ -90,7 +90,7 @@ def copy_file(self, folder_id: str, file_id: str, name: str): # TODO : This is the function that is responsible for making the incident documents. try: confluence_client = Confluence( - url=self.configuration.api_url, + url=str(self.configuration.api_url), username=self.configuration.username, password=self.configuration.password.get_secret_value(), cloud=self.configuration.hosting_type, diff --git a/src/dispatch/plugins/dispatch_pagerduty/plugin.py b/src/dispatch/plugins/dispatch_pagerduty/plugin.py index a2619618fcd4..2cca42bda652 100644 --- a/src/dispatch/plugins/dispatch_pagerduty/plugin.py +++ b/src/dispatch/plugins/dispatch_pagerduty/plugin.py @@ -61,7 +61,7 @@ def __init__(self): def get(self, service_id: str) -> str: """Gets the current oncall person's email.""" client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) return get_oncall_email(client=client, service_id=service_id) def page( @@ -74,7 +74,7 @@ def page( ) -> dict: """Pages the oncall person.""" client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) return page_oncall( client=client, from_email=self.configuration.from_email, @@ -87,7 +87,7 @@ def page( def did_oncall_just_go_off_shift(self, schedule_id: str, hour: int) -> dict | None: client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) return oncall_shift_check( client=client, schedule_id=schedule_id, @@ -100,7 +100,7 @@ def get_schedule_id_from_service_id(self, service_id: str) -> str | None: try: client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) service = get_service( client=client, service_id=service_id, @@ -122,7 +122,7 @@ def get_service_url(self, service_id: str) -> str | None: return None client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) try: service = get_service(client, service_id) return service.get("html_url") @@ -135,7 +135,7 @@ def get_next_oncall(self, service_id: str) -> str | None: schedule_id = self.get_schedule_id_from_service_id(service_id) client = APISession(self.configuration.api_key.get_secret_value()) - client.url = self.configuration.pagerduty_api_url + client.url = str(self.configuration.pagerduty_api_url) return get_next_oncall( client=client, schedule_id=schedule_id, diff --git a/src/dispatch/plugins/generic_workflow/plugin.py b/src/dispatch/plugins/generic_workflow/plugin.py index 542793b20a82..d6627210af13 100644 --- a/src/dispatch/plugins/generic_workflow/plugin.py +++ b/src/dispatch/plugins/generic_workflow/plugin.py @@ -83,7 +83,7 @@ def get_workflow_instance( tags: list[str], **kwargs, ): - api_url = self.configuration.api_url + api_url = str(self.configuration.api_url) headers = { "Content-Type": "application/json", "Authorization": self.configuration.auth_header.get_secret_value(), From ad44bc63d00b8cff143c1070031f50f8599d8dce Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Mon, 19 May 2025 17:53:44 -0700 Subject: [PATCH 4/4] Additional fixes --- src/dispatch/plugins/dispatch_slack/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/plugin.py b/src/dispatch/plugins/dispatch_slack/plugin.py index 1a0decd97b89..0bba3c227c62 100644 --- a/src/dispatch/plugins/dispatch_slack/plugin.py +++ b/src/dispatch/plugins/dispatch_slack/plugin.py @@ -514,8 +514,8 @@ def get(self, email: str, **kwargs): department = profile_fields.get(self.configuration.profile_department_field_id, {}).get( "value", "Unknown" ) - weblink = profile_fields.get(self.configuration.profile_weblink_field_id, {}).get( - "value", "" + weblink = str( + profile_fields.get(self.configuration.profile_weblink_field_id, {}).get("value", "") ) return {