Skip to content

Commit f0196ab

Browse files
committed
Prepare for changes of su in util-linux 2.42
With util-linux 2.42 su gets more strict about it's command line. From the release notes: "pass arguments after <user> to shell (by cgoesche)" It is also recommended to use "--login" instead of "-". Could fix https://forum.checkmk.com/t/postgresql-services-disappear-after-updating-util-linux-to-2-42/58816
1 parent 766d128 commit f0196ab

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cmk/plugins/postgres/agents/mk_postgres.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,10 @@ def _run_sql_as_db_user(
793793
# type: (str, str, str, bool, bool) -> str
794794
base_cmd_list = [
795795
"su",
796-
"-",
797-
self.db_user,
798796
"-c",
799797
r"""PGPASSFILE=%s %s -X %s -A0 -F'%s' -f %s""",
798+
"--login",
799+
self.db_user,
800800
]
801801
extra_args += " -U %s" % self.pg_user
802802
extra_args += " -d %s" % self.pg_database
@@ -809,7 +809,7 @@ def _run_sql_as_db_user(
809809
if rows_only:
810810
extra_args += " -t"
811811

812-
base_cmd_list[-1] = base_cmd_list[-1] % (
812+
base_cmd_list[-3] = base_cmd_list[-3] % (
813813
self.pg_passfile,
814814
self.psql_binary_path,
815815
extra_args,

0 commit comments

Comments
 (0)