postgresql-charms-single-kernel 0.0.1__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/METADATA +13 -0
- postgresql_charms_single_kernel-0.0.1.dist-info/RECORD +10 -0
- postgresql_charms_single_kernel-0.0.1.dist-info/WHEEL +5 -0
- postgresql_charms_single_kernel-0.0.1.dist-info/top_level.txt +1 -0
- single_kernel_postgresql/__init__.py +3 -0
- single_kernel_postgresql/abstract_charm.py +26 -0
- single_kernel_postgresql/config/__init__.py +3 -0
- single_kernel_postgresql/config/literals.py +17 -0
- single_kernel_postgresql/utils/__init__.py +3 -0
- single_kernel_postgresql/utils/postgresql.py +1793 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: postgresql-charms-single-kernel
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Shared and reusable code for PostgreSQL-related charms
|
|
5
|
+
Author-email: Canonical Data Platform <data-platform@lists.launchpad.net>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
+
Requires-Python: <4.0,>=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# postgresql-single-kernel-library
|
|
@@ -0,0 +1,10 @@
|
|
|
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,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
single_kernel_postgresql
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright 2025 Canonical Ltd.
|
|
2
|
+
# See LICENSE file for licensing details.
|
|
3
|
+
"""Skeleton for the abstract charm."""
|
|
4
|
+
|
|
5
|
+
from ops.charm import CharmBase
|
|
6
|
+
|
|
7
|
+
from .config.literals import SYSTEM_USERS, USER
|
|
8
|
+
from .utils.postgresql import PostgreSQL
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AbstractPostgreSQLCharm(CharmBase):
|
|
12
|
+
"""An abstract PostgreSQL charm."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, *args):
|
|
15
|
+
super().__init__(*args)
|
|
16
|
+
|
|
17
|
+
self.postgresql = PostgreSQL(
|
|
18
|
+
primary_host="localhost",
|
|
19
|
+
current_host="localhost",
|
|
20
|
+
user=USER,
|
|
21
|
+
# The password is hardcoded because this is an abstract charm and
|
|
22
|
+
# it meant to be used only in unit tests.
|
|
23
|
+
password="test-password", # noqa S106
|
|
24
|
+
database="test-database",
|
|
25
|
+
system_users=SYSTEM_USERS,
|
|
26
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 Canonical Ltd.
|
|
2
|
+
# See LICENSE file for licensing details.
|
|
3
|
+
"""Literal string for the different charms.
|
|
4
|
+
|
|
5
|
+
This module should contain the literals used in the charms (paths, enums, etc).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Relations.
|
|
9
|
+
PEER = "database-peers"
|
|
10
|
+
|
|
11
|
+
# Users.
|
|
12
|
+
BACKUP_USER = "backup"
|
|
13
|
+
MONITORING_USER = "monitoring"
|
|
14
|
+
REPLICATION_USER = "replication"
|
|
15
|
+
REWIND_USER = "rewind"
|
|
16
|
+
USER = "operator"
|
|
17
|
+
SYSTEM_USERS = [MONITORING_USER, REPLICATION_USER, REWIND_USER, USER]
|