Skip to content
Merged
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
964 changes: 532 additions & 432 deletions poetry.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ requires-poetry = ">=2.0.0"

[tool.poetry.dependencies]
python = "^3.10"
ops = "^2.18.1"
boto3 = "^1.37.22"
ops = "^2.20.0"
boto3 = "^1.38.0"
pgconnstr = "^1.0.1"
requests = "^2.32.3"
tenacity = "^9.0.0"
tenacity = "^9.1.2"
psycopg2 = "^2.9.10"
pydantic = "^1.10.21"
jinja2 = "^3.1.5"
jinja2 = "^3.1.6"
pysyncobj = "^0.3.14"
psutil = "^7.0.0"

Expand All @@ -40,7 +40,7 @@ opentelemetry-exporter-otlp-proto-http = "1.21.0"
optional = true

[tool.poetry.group.format.dependencies]
ruff = "^0.9.6"
ruff = "^0.11.6"

[tool.poetry.group.lint]
optional = true
Expand All @@ -52,8 +52,8 @@ codespell = "^2.4.1"
optional = true

[tool.poetry.group.unit.dependencies]
coverage = {extras = ["toml"], version = "^7.6.12"}
pytest = "^8.3.4"
coverage = {extras = ["toml"], version = "^7.8.0"}
pytest = "^8.3.5"
pytest-asyncio = "*"
parameterized = "^0.9.0"
jsonschema = "^4.23.0"
Expand All @@ -62,16 +62,16 @@ jsonschema = "^4.23.0"
optional = true

[tool.poetry.group.integration.dependencies]
pytest = "^8.3.4"
pytest-operator = "^0.40.0"
pytest = "^8.3.5"
pytest-operator = "^0.42.0"
# renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940
juju = "<=3.6.1.0"
juju = "<=3.6.1.1"
boto3 = "*"
tenacity = "*"
landscape-api-py3 = "^0.9.0"
mailmanclient = "^3.3.5"
psycopg2-binary = "^2.9.10"
allure-pytest = "^2.13.5"
allure-pytest = "^2.14.0"
allure-pytest-default-results = "^0.1.2"

# Testing tools configuration
Expand Down
9 changes: 4 additions & 5 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,9 +1078,9 @@ def _on_install(self, event: InstallEvent) -> None:
# This is needed due to https://bugs.launchpad.net/snapd/+bug/2011581.
try:
# Input is hardcoded
subprocess.check_call("mkdir -p /home/snap_daemon".split()) # noqa: S603
subprocess.check_call("chown snap_daemon:snap_daemon /home/snap_daemon".split()) # noqa: S603
subprocess.check_call("usermod -d /home/snap_daemon snap_daemon".split()) # noqa: S603
subprocess.check_call(["mkdir", "-p", "/home/snap_daemon"]) # noqa: S607
subprocess.check_call(["chown", "snap_daemon:snap_daemon", "/home/snap_daemon"]) # noqa: S607
subprocess.check_call(["usermod", "-d", "/home/snap_daemon", "snap_daemon"]) # noqa: S607
except subprocess.CalledProcessError:
logger.exception("Unable to create snap_daemon home dir")

Expand Down Expand Up @@ -1933,8 +1933,7 @@ def _reboot_on_detached_storage(self, event: EventBase) -> None:
logger.error("Data directory not attached. Reboot unit.")
self.unit.status = WaitingStatus("Data directory not attached")
with contextlib.suppress(subprocess.CalledProcessError):
# Call is constant
subprocess.check_call(["/usr/bin/systemctl", "reboot"]) # noqa: S603
subprocess.check_call(["/usr/bin/systemctl", "reboot"])

def _restart(self, event: RunWithLock) -> None:
"""Restart PostgreSQL."""
Expand Down
3 changes: 1 addition & 2 deletions src/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,5 +1067,4 @@ def update_patroni_restart_condition(self, new_condition: str) -> None:
logger.debug(f"new patroni service file: {new_patroni_service}")
with open(PATRONI_SERVICE_DEFAULT_PATH, "w") as patroni_service_file:
patroni_service_file.write(new_patroni_service)
# Input is hardcoded
subprocess.run(["/bin/systemctl", "daemon-reload"]) # noqa: S603
subprocess.run(["/bin/systemctl", "daemon-reload"])
3 changes: 1 addition & 2 deletions src/rotate_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def start_log_rotation(self):

logging.info("Starting rotate logs process")

# Input is generated by the charm
pid = subprocess.Popen( # noqa: S603
pid = subprocess.Popen(
["/usr/bin/python3", "scripts/rotate_logs.py"],
# File should not close
stdout=open(LOG_FILE_PATH, "a"), # noqa: SIM115
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def test_execute_command(harness):
patch("pwd.getpwnam") as _getpwnam,
):
# Test when the command fails.
command = "rm -r /var/lib/postgresql/data/pgdata".split()
command = ["rm", "-r", "/var/lib/postgresql/data/pgdata"]
_run.return_value = CompletedProcess(command, 1, b"", b"fake stderr")
assert harness.charm.backup._execute_command(command) == (1, "", "fake stderr")
_run.assert_called_once_with(
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def test_on_install(harness):
pg_snap.alias.assert_any_call("patronictl")

assert _check_call.call_count == 3
_check_call.assert_any_call("mkdir -p /home/snap_daemon".split())
_check_call.assert_any_call("chown snap_daemon:snap_daemon /home/snap_daemon".split())
_check_call.assert_any_call("usermod -d /home/snap_daemon snap_daemon".split())
_check_call.assert_any_call(["mkdir", "-p", "/home/snap_daemon"])
_check_call.assert_any_call(["chown", "snap_daemon:snap_daemon", "/home/snap_daemon"])
_check_call.assert_any_call(["usermod", "-d", "/home/snap_daemon", "snap_daemon"])

# Assert the status set by the event handler.
assert isinstance(harness.model.unit.status, WaitingStatus)
Expand Down