postgresql-charms-single-kernel 0.0.1__py3-none-any.whl → 16.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {postgresql_charms_single_kernel-0.0.1.dist-info → postgresql_charms_single_kernel-16.0.0.dist-info}/METADATA +1 -1
- postgresql_charms_single_kernel-16.0.0.dist-info/RECORD +11 -0
- single_kernel_postgresql/config/literals.py +4 -0
- single_kernel_postgresql/utils/filesystem.py +20 -0
- single_kernel_postgresql/utils/postgresql.py +7 -1
- postgresql_charms_single_kernel-0.0.1.dist-info/RECORD +0 -10
- {postgresql_charms_single_kernel-0.0.1.dist-info → postgresql_charms_single_kernel-16.0.0.dist-info}/WHEEL +0 -0
- {postgresql_charms_single_kernel-0.0.1.dist-info → postgresql_charms_single_kernel-16.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: postgresql-charms-single-kernel
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 16.0.0
|
|
4
4
|
Summary: Shared and reusable code for PostgreSQL-related charms
|
|
5
5
|
Author-email: Canonical Data Platform <data-platform@lists.launchpad.net>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
single_kernel_postgresql/__init__.py,sha256=F57JUcML43xgR0kpj9csryZkAoDSBPLLRjzSTHPaTd4,116
|
|
2
|
+
single_kernel_postgresql/abstract_charm.py,sha256=grlJCmpz8rq7_NKVkyuoK7_8I2r6DRkh5DhbtyPWna8,792
|
|
3
|
+
single_kernel_postgresql/config/__init__.py,sha256=k9Ud5ZZNd3l0nn8xi8AIlT45oZk8hJ542BjAFGDJzuc,140
|
|
4
|
+
single_kernel_postgresql/config/literals.py,sha256=4EpAnoxCEMfOCPpFD5dyAU_0h2OwAHgEX9OjTWNcaQg,527
|
|
5
|
+
single_kernel_postgresql/utils/__init__.py,sha256=VwAEW3wYjs99q38bid47aS6Os4s3catK4H5HfdPkp94,121
|
|
6
|
+
single_kernel_postgresql/utils/filesystem.py,sha256=CJ2iXqFPKM0NfqqZSTDlENOrM0RW7rmTmcuzwV0bR9A,552
|
|
7
|
+
single_kernel_postgresql/utils/postgresql.py,sha256=DX97VTTU73lgxe-XD1vDt72Eflxr5_sfDwRdqJf32ZE,74505
|
|
8
|
+
postgresql_charms_single_kernel-16.0.0.dist-info/METADATA,sha256=ITQ_tJx-VDpTAaNp3-GkLClq1zmK2NBUd-WIRD3MkPQ,484
|
|
9
|
+
postgresql_charms_single_kernel-16.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
postgresql_charms_single_kernel-16.0.0.dist-info/top_level.txt,sha256=fH85HKyfDV3--1JuYe-rWJmN5XTlXVXGOBO5iNA36Rk,25
|
|
11
|
+
postgresql_charms_single_kernel-16.0.0.dist-info/RECORD,,
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
This module should contain the literals used in the charms (paths, enums, etc).
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
# Permissions.
|
|
9
|
+
POSTGRESQL_STORAGE_PERMISSIONS = 0o700
|
|
10
|
+
|
|
8
11
|
# Relations.
|
|
9
12
|
PEER = "database-peers"
|
|
10
13
|
|
|
@@ -13,5 +16,6 @@ BACKUP_USER = "backup"
|
|
|
13
16
|
MONITORING_USER = "monitoring"
|
|
14
17
|
REPLICATION_USER = "replication"
|
|
15
18
|
REWIND_USER = "rewind"
|
|
19
|
+
SNAP_USER = "_daemon_"
|
|
16
20
|
USER = "operator"
|
|
17
21
|
SYSTEM_USERS = [MONITORING_USER, REPLICATION_USER, REWIND_USER, USER]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 Canonical Ltd.
|
|
2
|
+
# See LICENSE file for licensing details.
|
|
3
|
+
"""Filesystem utilities."""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import pwd
|
|
7
|
+
|
|
8
|
+
from ..config.literals import SNAP_USER
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def change_owner(path: str) -> None:
|
|
12
|
+
"""Change the ownership of a file or a directory to the snap user.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
path: path to a file or directory.
|
|
16
|
+
"""
|
|
17
|
+
# Get the uid/gid for the snap user.
|
|
18
|
+
user_database = pwd.getpwnam(SNAP_USER)
|
|
19
|
+
# Set the correct ownership for the file or directory.
|
|
20
|
+
os.chown(path, uid=user_database.pw_uid, gid=user_database.pw_gid)
|
|
@@ -20,6 +20,7 @@ Any charm using this library should import the `psycopg2` or `psycopg2-binary` d
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
import logging
|
|
23
|
+
import os
|
|
23
24
|
from collections import OrderedDict
|
|
24
25
|
from typing import Dict, List, Optional, Set, Tuple
|
|
25
26
|
|
|
@@ -27,7 +28,8 @@ import psycopg2
|
|
|
27
28
|
from ops import ConfigData
|
|
28
29
|
from psycopg2.sql import SQL, Identifier, Literal
|
|
29
30
|
|
|
30
|
-
from ..config.literals import BACKUP_USER, SYSTEM_USERS
|
|
31
|
+
from ..config.literals import BACKUP_USER, POSTGRESQL_STORAGE_PERMISSIONS, SYSTEM_USERS
|
|
32
|
+
from .filesystem import change_owner
|
|
31
33
|
|
|
32
34
|
# Groups to distinguish HBA access
|
|
33
35
|
ACCESS_GROUP_IDENTITY = "identity_access"
|
|
@@ -1071,6 +1073,10 @@ class PostgreSQL:
|
|
|
1071
1073
|
cursor = connection.cursor()
|
|
1072
1074
|
|
|
1073
1075
|
if temp_location is not None:
|
|
1076
|
+
# Fix permissions on the temporary tablespace location when a reboot happens and tmpfs is being used.
|
|
1077
|
+
change_owner(temp_location)
|
|
1078
|
+
os.chmod(temp_location, POSTGRESQL_STORAGE_PERMISSIONS)
|
|
1079
|
+
|
|
1074
1080
|
cursor.execute("SELECT TRUE FROM pg_tablespace WHERE spcname='temp';")
|
|
1075
1081
|
if cursor.fetchone() is None:
|
|
1076
1082
|
cursor.execute(f"CREATE TABLESPACE temp LOCATION '{temp_location}';")
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
single_kernel_postgresql/__init__.py,sha256=F57JUcML43xgR0kpj9csryZkAoDSBPLLRjzSTHPaTd4,116
|
|
2
|
-
single_kernel_postgresql/abstract_charm.py,sha256=grlJCmpz8rq7_NKVkyuoK7_8I2r6DRkh5DhbtyPWna8,792
|
|
3
|
-
single_kernel_postgresql/config/__init__.py,sha256=k9Ud5ZZNd3l0nn8xi8AIlT45oZk8hJ542BjAFGDJzuc,140
|
|
4
|
-
single_kernel_postgresql/config/literals.py,sha256=2McbLq3gCSFEXXgBYu52nYLb-RS088sNMYO4JZFWMSY,449
|
|
5
|
-
single_kernel_postgresql/utils/__init__.py,sha256=VwAEW3wYjs99q38bid47aS6Os4s3catK4H5HfdPkp94,121
|
|
6
|
-
single_kernel_postgresql/utils/postgresql.py,sha256=_N9y_fcr2l8tNscfgZ5dYnWFMp8NvV9bydFmEUmntsY,74191
|
|
7
|
-
postgresql_charms_single_kernel-0.0.1.dist-info/METADATA,sha256=NMis-jmTpyfdIF2MJwaglMCVKJpXxamP47YKw4FLQeU,483
|
|
8
|
-
postgresql_charms_single_kernel-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
postgresql_charms_single_kernel-0.0.1.dist-info/top_level.txt,sha256=fH85HKyfDV3--1JuYe-rWJmN5XTlXVXGOBO5iNA36Rk,25
|
|
10
|
-
postgresql_charms_single_kernel-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|