Skip to content

Commit 04b0ce5

Browse files
committed
Move snap user to a literal
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
1 parent c80e55f commit 04b0ce5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

single_kernel_postgresql/config/literals.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
MONITORING_USER = "monitoring"
1717
REPLICATION_USER = "replication"
1818
REWIND_USER = "rewind"
19+
SNAP_USER = "_daemon_"
1920
USER = "operator"
2021
SYSTEM_USERS = [MONITORING_USER, REPLICATION_USER, REWIND_USER, USER]

single_kernel_postgresql/utils/filesystem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
import os
66
import pwd
77

8+
from ..config.literals import SNAP_USER
9+
810

911
def change_owner(path: str) -> None:
10-
"""Change the ownership of a file or a directory to the _daemon_ user.
12+
"""Change the ownership of a file or a directory to the snap user.
1113
1214
Args:
1315
path: path to a file or directory.
1416
"""
15-
# Get the uid/gid for the _daemon_ user.
16-
user_database = pwd.getpwnam("_daemon_")
17+
# Get the uid/gid for the snap user.
18+
user_database = pwd.getpwnam(SNAP_USER)
1719
# Set the correct ownership for the file or directory.
1820
os.chown(path, uid=user_database.pw_uid, gid=user_database.pw_gid)

0 commit comments

Comments
 (0)