Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tell type checkers that the config options are strings (trivial) #208

Merged
merged 2 commits into from
Apr 16, 2024
Merged
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
10 changes: 6 additions & 4 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,9 @@ def _addon_reconciliation(self, addon_type: str) -> None:
current_installed_addons = set(t["name"] for t in exec_result.result)
logger.debug("Currently installed %s %s", addon_type, current_installed_addons)
addons_in_config = [
t.strip() for t in self.model.config[f"{addon_type}s"].split(",") if t.strip()
t.strip()
for t in cast(str, self.model.config[f"{addon_type}s"]).split(",")
if t.strip()
]
default_addons = (
self._WORDPRESS_DEFAULT_THEMES
Expand Down Expand Up @@ -1156,7 +1158,7 @@ def _plugin_akismet_reconciliation(self) -> None:
Raises:
WordPressBlockedStatusException: if askimet plugin reconciliation process fails.
"""
akismet_key = self.model.config["wp_plugin_akismet_key"].strip()
akismet_key = cast(str, self.model.config["wp_plugin_akismet_key"]).strip()
if not akismet_key:
result = self._deactivate_plugin(
"akismet",
Expand Down Expand Up @@ -1215,7 +1217,7 @@ def _encode_openid_team_map(team_map: str) -> str:

def _plugin_openid_reconciliation(self) -> None:
"""Reconciliation process for the openid plugin."""
openid_team_map = self.model.config["wp_plugin_openid_team_map"].strip()
openid_team_map = cast(str, self.model.config["wp_plugin_openid_team_map"]).strip()
result = None

def check_result():
Expand Down Expand Up @@ -1310,7 +1312,7 @@ def _swift_config(self) -> Dict[str, Any]:
Returns:
Swift configuration in dict.
"""
swift_config_str = self.model.config["wp_plugin_openstack-objectstorage_config"]
swift_config_str = cast(str, self.model.config["wp_plugin_openstack-objectstorage_config"])
required_swift_config_key = [
"auth-url",
"bucket",
Expand Down
Loading