Skip to content

Commit 69163d6

Browse files
fix: resolve OAuth installation store bugs and typos (#1864)
1 parent df39bee commit 69163d6

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

slack_sdk/oauth/installation_store/amazon_s3/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def save(self, installation: Installation):
106106

107107
def save_bot(self, bot: Bot):
108108
if bot.bot_token is None:
109-
self.logger.debug("Skipped saving a new row because of the absense of bot token in it")
109+
self.logger.debug("Skipped saving a new row because of the absence of bot token in it")
110110
return
111111

112112
none = "none"
@@ -273,7 +273,7 @@ def delete_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str]) ->
273273
Key=content.get("Key"),
274274
)
275275
except Exception as e:
276-
message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
276+
message = f"Failed to delete bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
277277
raise SlackClientConfigurationError(message)
278278

279279
async def async_delete_installation(
@@ -316,7 +316,7 @@ def delete_installation(
316316
)
317317
deleted_keys.append(key)
318318
except Exception as e:
319-
message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
319+
message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
320320
raise SlackClientConfigurationError(message)
321321

322322
try:
@@ -328,7 +328,7 @@ def delete_installation(
328328
)
329329
deleted_keys.append(no_user_id_key)
330330
except Exception as e:
331-
message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
331+
message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
332332
raise SlackClientConfigurationError(message)
333333

334334
# Check the remaining installation data
@@ -347,5 +347,5 @@ def delete_installation(
347347
Key=content.get("Key"),
348348
)
349349
except Exception as e:
350-
message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
350+
message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
351351
raise SlackClientConfigurationError(message)

slack_sdk/oauth/installation_store/async_cacheable_installation_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ async def async_delete_bot(
9898
team_id=team_id,
9999
)
100100
key = f"{enterprise_id or ''}-{team_id or ''}"
101-
self.cached_bots.pop(key)
101+
if key in self.cached_bots:
102+
self.cached_bots.pop(key)
102103

103104
async def async_delete_installation(
104105
self,

slack_sdk/oauth/installation_store/file/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def save(self, installation: Installation):
7878

7979
def save_bot(self, bot: Bot):
8080
if bot.bot_token is None:
81-
self.logger.debug("Skipped saving a new row because of the absense of bot token in it")
81+
self.logger.debug("Skipped saving a new row because of the absence of bot token in it")
8282
return
8383

8484
none = "none"

slack_sdk/oauth/installation_store/sqlite3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def save(self, installation: Installation):
217217

218218
def save_bot(self, bot: Bot):
219219
if bot.bot_token is None:
220-
self.logger.debug("Skipped saving a new row because of the absense of bot token in it")
220+
self.logger.debug("Skipped saving a new row because of the absence of bot token in it")
221221
return
222222

223223
with self.connect() as conn:

0 commit comments

Comments
 (0)