Skip to content

Commit

Permalink
personal nits
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Oct 30, 2023
1 parent 38fec10 commit 4b8aebb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/charms/mongodb/v1/mongos.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 2
LIBPATCH = 3

# path to store mongodb ketFile
logger = logging.getLogger(__name__)
Expand Down
6 changes: 1 addition & 5 deletions lib/charms/mongodb/v1/shards_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 2
LIBPATCH = 3
KEYFILE_KEY = "key-file"
HOSTS_KEY = "host"
OPERATOR_PASSWORD_KEY = MongoDBUser.get_password_key_name_for_user(OperatorUser.get_username())
Expand Down Expand Up @@ -649,18 +649,14 @@ def update_keyfile(self, key_file_contents: str) -> None:
# match what is on the machine.
current_key_file = self.charm.get_keyfile_contents()
if not key_file_contents or key_file_contents == current_key_file:
logger.info(f"Skipping update. proposed keyfile {key_file_contents}")
logger.info(f"Skipping update. current keyfile {current_key_file}")
return

# put keyfile on the machine with appropriate permissions
self.charm.push_file_to_unit(
parent_dir=Config.MONGOD_CONF_DIR, file_name=KEY_FILE, file_contents=key_file_contents
)

logger.info(f"Updated keyfile from {current_key_file} to {key_file_contents}")
current_key_file = self.charm.get_keyfile_contents()
logger.info(f"Now {current_key_file}")

# when the contents of the keyfile change, we must restart the service
self.charm.restart_mongod_service()
Expand Down

0 comments on commit 4b8aebb

Please sign in to comment.