-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] postgres_privileges.present not idempotent for functions #59585
Comments
A query like this would get you the ACL info from postgres 12 SELECT p.proacl
FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
WHERE n.nspname = 'pg_catalog' AND p.oid::regprocedure::text = 'pg_ls_dir(text,boolean,boolean)' Note you have to parse out the Getting a list of roles with execute permissions out of that in an SQL query is very complex. Doing it in python is probably prefered. Or directly query for the intended role: SELECT p.proacl ~ 'rewind_user=X/postgres'::aclitem AS granted
FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
WHERE n.nspname = 'pg_catalog' AND p.oid::regprocedure::text = 'pg_ls_dir(text,boolean,boolean)' However, that will give an error if the role does not exist. It may also not work if the grantor ( |
Is there any update on this by any chance? |
In general, |
I understand postgres entities aren't easy to manage. I was really just wondering if there was any progress on this or if there is a workaround maybe? |
The workaround I use is to add state requisites so it only runs when a user is created. |
Oh you're right. My state only failed the second time I ran it. Well, that works for me for now. |
@anilsil why did you change this to low severity. It's certainly not a cosmetic issue. |
Description
Using
postgres_privileges.present
to grant permissions on functions isn't idempotent when following the conventions in the postgres documentation (e.g. https://www.postgresql.org/docs/12/app-pgrewind.html#id-1.9.5.9.8)It seems it's constructing an invalid query to try to get the current status:
Setup
Steps to Reproduce the behavior
Apply the state multiple times.
Expected behavior
Should only execute the first time.
Versions Report
PostgreSQL: 12.6-0ubuntu0.20.04.1
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
Also the documentation of the state doesn't list
function
as a valid type, but the module documentation does.The text was updated successfully, but these errors were encountered: