Skip to content

Commit 6c6b26d

Browse files
authored
[DPE-7594] Add custom users to pg_hba filter (#1041)
* Add custom users to pg_hba filter * Remove in repo cla-check
1 parent ce9ea11 commit 6c6b26d

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

.github/workflows/cla-check.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

lib/charms/postgresql_k8s/v0/postgresql.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
# Increment this PATCH version before using `charmcraft publish-lib` or reset
3737
# to 0 if you are raising the major API version
38-
LIBPATCH = 54
38+
LIBPATCH = 55
3939

4040
# Groups to distinguish HBA access
4141
ACCESS_GROUP_IDENTITY = "identity_access"
@@ -267,7 +267,8 @@ def create_database(
267267
raise PostgreSQLCreateDatabaseError() from e
268268

269269
# Enable preset extensions
270-
self.enable_disable_extensions(dict.fromkeys(plugins, True), database)
270+
if plugins:
271+
self.enable_disable_extensions(dict.fromkeys(plugins, True), database)
271272

272273
def create_user(
273274
self,

src/charm.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,9 +2326,16 @@ def relations_user_databases_map(self) -> dict:
23262326
})
23272327
return user_database_map
23282328
try:
2329-
for user in sorted(
2330-
self.postgresql.list_users_from_relation(current_host=self.is_connectivity_enabled)
2331-
):
2329+
for user in self.postgresql.list_users(current_host=self.is_connectivity_enabled):
2330+
if user in (
2331+
"backup",
2332+
"monitoring",
2333+
"operator",
2334+
"postgres",
2335+
"replication",
2336+
"rewind",
2337+
):
2338+
continue
23322339
user_database_map[user] = ",".join(
23332340
self.postgresql.list_accessible_databases_for_user(
23342341
user, current_host=self.is_connectivity_enabled

0 commit comments

Comments
 (0)