Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE test custom image #569

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import json
import logging
import os
import pathlib
import pwd
import re
import shutil
Expand Down Expand Up @@ -1142,7 +1143,7 @@ def start_stop_pgbackrest_service(self) -> bool:

snap_cache = snap.SnapCache()
charmed_postgresql_snap = snap_cache["charmed-postgresql"]
if not charmed_postgresql_snap.present:
if not pathlib.Path("snap_installed").exists():
logger.error("Cannot start/stop service, snap is not yet installed.")
return False

Expand Down
6 changes: 5 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import json
import logging
import os
import pathlib
import platform
import re
import subprocess
import sys
import time
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Literal, Optional, Set, Tuple, get_args
Expand Down Expand Up @@ -873,6 +875,8 @@ def _on_install(self, event: InstallEvent) -> None:
except snap.SnapError:
self.unit.status = BlockedStatus("failed to install snap packages")
return
time.sleep(60)
pathlib.Path("snap_installed").touch()

cache = snap.SnapCache()
postgres_snap = cache[POSTGRESQL_SNAP_NAME]
Expand Down Expand Up @@ -1596,7 +1600,7 @@ def _is_workload_running(self) -> bool:
"""Returns whether the workload is running (in an active state)."""
snap_cache = snap.SnapCache()
charmed_postgresql_snap = snap_cache["charmed-postgresql"]
if not charmed_postgresql_snap.present:
if not pathlib.Path("snap_installed").exists():
return False

return charmed_postgresql_snap.services["patroni"]["active"]
Expand Down
Loading