community.postgresql icon indicating copy to clipboard operation
community.postgresql copied to clipboard

feat: ability to alter database-level default privs

Open strafer opened this issue 3 years ago • 5 comments

Now omitting of param 'schema' for default_privs means altering database-level default privs (they will be applied to new objects in any schema).

SUMMARY

I'd tried to set up database-level default privileges by community.postgresql.postgresql_privs module. But it's not possible even without param 'schema'. My changes make it possible: with defined schema privs are altered for this schema, without - privs are altered for entire database (pg_default_acl.defaclnamespace = 0) and will be applied to any new created schema and its inner objects.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION

strafer avatar Jan 20 '22 11:01 strafer

@st-rafer hi, thanks for the PR! I have no time to review it this week and will try to do it at the beginning of the next week. For now:

  1. Be sure your PR does not introduce any breaking changes
  2. Please add a changelog fragment https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment
  3. Add integration tests for your changes, see the content of tests/integration/targets/postgresql_privs

Thoughts on the change from our other contributors would be much appreciated. CC @hunleyd @tcraxs @klando @kostiantyn-nemchenko @MichaelDBA @marcosdiez (if anyone doesn't want me mentioning them, let me know)

Andersson007 avatar Jan 21 '22 09:01 Andersson007

lgtm with a quick scan. will do an actual review once the tests are added

hunleyd avatar Jan 21 '22 16:01 hunleyd

Thanks guys, ansible tests and changelog fragments are unfamiliar to me, I will try to sort it out during this week.

strafer avatar Jan 24 '22 12:01 strafer

@hunleyd thanks! Sounds good, will do the same. @st-rafer cool, thanks! In addition to the mentioned part of the source code, you could use https://github.com/ansible/community-docs/blob/main/integration_tests_quick_start_guide.rst.

Andersson007 avatar Jan 24 '22 12:01 Andersson007

@st-rafer hi, is there a way we can help here?

Andersson007 avatar Mar 10 '22 07:03 Andersson007