Skip to content

Commit

Permalink
Deleting cert before pushing new ones (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
juditnovak authored Jul 28, 2023
1 parent f887459 commit ca9afc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/charms/mongodb/v0/mongodb_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _on_certificate_available(self, event: CertificateAvailableEvent) -> None:

logger.info("Restarting mongod with TLS enabled.")

self.charm.delete_tls_certificate_from_workload()
self.charm.push_tls_certificate_to_workload()
self.charm.unit.status = MaintenanceStatus("enabling TLS")
self.charm.restart_mongod_service()
Expand Down
5 changes: 4 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,10 @@ def delete_tls_certificate_from_workload(self) -> None:
Config.TLS.INT_CA_FILE,
Config.TLS.INT_PEM_FILE,
]:
container.remove_path(f"{Config.CONF_DIR}/{file}")
try:
container.remove_path(f"{Config.CONF_DIR}/{file}")
except PathError as err:
logger.debug("Path unavailable: %s (%s)", file, str(err))

def get_hostname_for_unit(self, unit: Unit) -> str:
"""Create a DNS name for a MongoDB unit.
Expand Down

0 comments on commit ca9afc0

Please sign in to comment.