Skip to content

Commit 356e6fa

Browse files
authored
postgresql_privs: fails with type=default_privs, privs=ALL, objs=ALL_DEFAULT (#374)
1 parent 0992000 commit 356e6fa

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- postgresql_privs - fails with ``type=default_privs``, ``privs=ALL``, ``objs=ALL_DEFAULT`` (https://github.com/ansible-collections/community.postgresql/issues/373).

plugins/modules/postgresql_privs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,7 @@ def main():
11751175

11761176
elif p.type == 'default_privs':
11771177
if p.objs == 'ALL_DEFAULT':
1178+
VALID_DEFAULT_OBJS.pop('SCHEMAS')
11781179
objs = frozenset(VALID_DEFAULT_OBJS.keys())
11791180
else:
11801181
objs = frozenset(obj.upper() for obj in p.objs.split(','))

tests/integration/targets/postgresql_privs/tasks/postgresql_privs_general.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,22 @@
15441544
that:
15451545
- result is not changed
15461546

1547+
- name: Test community.postgresql issue 373
1548+
become: yes
1549+
become_user: "{{ pg_user }}"
1550+
postgresql_privs:
1551+
login_user: "{{ pg_user }}"
1552+
login_db: "{{ db_name }}"
1553+
roles: "{{ db_user3 }}"
1554+
objs: ALL_DEFAULT
1555+
type: default_privs
1556+
privs: ALL
1557+
register: result
1558+
1559+
- assert:
1560+
that:
1561+
- result is changed
1562+
15471563
# Cleanup
15481564
- name: Remove privs
15491565
become: true

0 commit comments

Comments
 (0)