Skip to content
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
2 changes: 1 addition & 1 deletion src/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def configure_patroni_on_unit(self):

# Expected permission
# Replicas refuse to start with the default permissions
os.chmod(POSTGRESQL_DATA_PATH, 0o750) # noqa: S103
os.chmod(POSTGRESQL_DATA_PATH, 0o700)

def _change_owner(self, path: str) -> None:
"""Change the ownership of a file or a directory to the postgres user.
Expand Down
2 changes: 1 addition & 1 deletion src/relations/async_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def _reinitialise_pgdata(self) -> None:
) from e
os.mkdir(POSTGRESQL_DATA_PATH)
# Expected permissions
os.chmod(POSTGRESQL_DATA_PATH, 0o750) # noqa: S103
os.chmod(POSTGRESQL_DATA_PATH, 0o700)
self.charm._patroni._change_owner(POSTGRESQL_DATA_PATH)

@property
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def test_configure_patroni_on_unit(peers_ips, patroni):

_open.assert_called_once_with(CREATE_CLUSTER_CONF_PATH, "a")
_chmod.assert_called_once_with(
"/var/snap/charmed-postgresql/common/var/lib/postgresql", 488
"/var/snap/charmed-postgresql/common/var/lib/postgresql", 448
)


Expand Down
Loading