Skip to content

Commit 437e1c6

Browse files
committed
(PDB-5559) Grant read user to write user
To ensure old report partitions are removed promptly without blocking commands and queries the write user needs the ability to cancel running puppetdb queries. To do that the write user needs to be granted the read user role.
1 parent 68a140b commit 437e1c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

manifests/database/postgresql.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,12 @@
9999
password_hash => postgresql::postgresql_password($read_database_username, $read_database_password),
100100
database_owner => $database_username
101101
}
102+
103+
-> postgresql_psql { "grant ${read_database_username} role to ${database_username}":
104+
db => $database_name,
105+
command => "GRANT \"${read_database_username}\" TO \"${database_username}\"",
106+
unless => "SELECT oid, rolname FROM pg_roles WHERE
107+
pg_has_role( '${database_username}', oid, 'member') and rolname = '${read_database_username}'";
108+
}
102109
}
103110
}

0 commit comments

Comments
 (0)