Skip to content

Commit

Permalink
fmt + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Nov 29, 2023
1 parent 03eaa15 commit 9a8d340
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/charms/mongodb/v0/config_server_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
This class handles the sharing of secrets between sharded components, adding shards, and removing
shards.
"""
import logging
import json
import logging

from charms.mongodb.v1.helpers import add_args_to_env, get_mongos_args
from charms.mongodb.v1.mongos import MongosConnection
from ops.charm import CharmBase, EventBase
from ops.framework import Object
from ops.model import WaitingStatus, MaintenanceStatus, ActiveStatus

from charms.mongodb.v1.helpers import get_mongos_args, add_args_to_env
from charms.mongodb.v1.mongos import MongosConnection
from ops.model import ActiveStatus, MaintenanceStatus, WaitingStatus

from config import Config

Expand Down Expand Up @@ -51,7 +50,7 @@ def __init__(
)

# TODO Future PRs handle scale down
# TODO Future PRs handle changing of units/passwords to be propogated to mongos
# TODO Future PRs handle changing of units/passwords to be propagated to mongos

def pass_hook_checks(self, event: EventBase) -> bool:
"""Runs the pre-hooks checks for ClusterProvider, returns True if all pass."""
Expand All @@ -71,7 +70,7 @@ def pass_hook_checks(self, event: EventBase) -> bool:

return True

def _on_relation_joined(self, event):
def _on_relation_joined(self, event) -> None:
"""Handles providing mongos with KeyFile and hosts."""
if not self.pass_hook_checks(event):
logger.info("Skipping relation joined event: hook checks did not pass")
Expand Down Expand Up @@ -133,7 +132,7 @@ def __init__(
)
# TODO Future PRs handle scale down

def _on_relation_changed(self, event):
def _on_relation_changed(self, event) -> None:
"""Starts/restarts monogs with config server information."""
relation_data = event.relation.data[event.app]
if not relation_data.get(KEYFILE_KEY) or not relation_data.get(CONFIG_SERVER_DB_KEY):
Expand All @@ -158,7 +157,7 @@ def _on_relation_changed(self, event):

# restart on high loaded databases can be very slow (e.g. up to 10-20 minutes).
if not self.is_mongos_running():
logger.info("mongos has not started, deferfing")
logger.info("mongos has not started, deferring")
self.charm.unit.status = WaitingStatus("Waiting for mongos to start")
event.defer()
return
Expand Down

0 comments on commit 9a8d340

Please sign in to comment.