Merge "Log db sync failures during retry" into main

This commit is contained in:
Zuul 2024-05-22 12:08:09 +00:00 committed by Gerrit Code Review
commit 7970a9171c

View File

@ -675,8 +675,12 @@ class OSBaseOperatorCharmK8S(OSBaseOperatorCharm):
def _retry_db_sync(self, cmd):
container = self.unit.get_container(self.db_sync_container_name)
logging.debug("Running sync: \n%s", cmd)
try:
process = container.exec(cmd, timeout=5 * 60)
out, err = process.wait_output()
except ops.pebble.ExecError as e:
logger.warning(f"DB Sync pebble exec error: {str(e)}")
raise e
if err:
for line in err.splitlines():
logger.warning("DB Sync stderr: %s", line.strip())