Skip to content

Commit

Permalink
remove unused bits
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Sep 12, 2024
1 parent 3122eef commit 6f78f2b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ share/

/requirements.txt
/requirements-last-build.txt
/charm_internal_version
/charm_internal_version
13 changes: 1 addition & 12 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
)

from config import Config
from exceptions import AdminUserCreationError, MissingSecretError, NotConfigServerError
from exceptions import AdminUserCreationError, MissingSecretError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1561,17 +1561,6 @@ def is_relation_feasible(self, rel_interface: str) -> bool:

return True

def is_cluster_on_same_revision(self) -> bool:
"""Returns True if the cluster is using the same charm revision.
Note: This can only be determined by the config-server since shards are not integrated to
each other.
"""
if not self.is_role(Config.Role.CONFIG_SERVER):
raise NotConfigServerError("This check can only be ran by the config-server.")

return self.version_checker.are_related_apps_valid()

def is_sharding_component(self) -> bool:
"""Returns true if charm is running as a sharded component."""
return self.is_role(Config.Role.SHARD) or self.is_role(Config.Role.CONFIG_SERVER)
Expand Down
4 changes: 0 additions & 4 deletions src/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ class MissingSecretError(MongoSecretError):

class SecretAlreadyExistsError(MongoSecretError):
"""A secret that we want to create already exists."""


class NotConfigServerError(Exception):
"""Raised when an operation is performed on a component that is not a config server."""
4 changes: 3 additions & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,11 @@ def test_reconfigure_remove_member_failure(self, connection, defer):
connection.return_value.__enter__.return_value.remove_replset_member.assert_called()
defer.assert_called()

@patch("charms.mongodb.v0.set_status.get_charm_revision")
@patch("charm.CrossAppVersionChecker.is_local_charm")
@patch("ops.framework.EventBase.defer")
@patch("charm.MongoDBConnection")
def test_reconfigure_peer_not_ready(self, connection, defer):
def test_reconfigure_peer_not_ready(self, connection, defer, *unused):
"""Tests reconfigure does not proceed when the adding member is not ready.
Verifies in relation joined events, that when the adding member is not ready that the event
Expand Down

0 comments on commit 6f78f2b

Please sign in to comment.