Skip to content

Commit 8b2d17b

Browse files
fix: report change in check mode when schema exists and state is absent (#858)
* fix: report change in check mode when schema exists and state is absent * AZP: add RHEL 10.0 to devel remote target (#859) * AZP: add RHEL 10.0 to devel remote target * Update README --------- Co-authored-by: Andrew Klychkov <[email protected]>
1 parent 8bd69d2 commit 8b2d17b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- postgresql_schema - change reported in check_mode was negated. Now it reports a change when removing an existing schema (https://github.com/ansible-collections/community.postgresql/pull/858)

plugins/modules/postgresql_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def main():
288288
try:
289289
if module.check_mode:
290290
if state == "absent":
291-
changed = not schema_exists(cursor, schema)
291+
changed = schema_exists(cursor, schema)
292292
elif state == "present":
293293
changed = not schema_matches(cursor, schema, owner, comment)
294294
module.exit_json(changed=changed, schema=schema)

tests/integration/targets/postgresql_schema/tasks/postgresql_schema_initial.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
# Checks
100100
- assert:
101101
that:
102-
- result is not changed
102+
- result is changed
103103

104104
- name: Check that the new schema "acme" still exists
105105
become: true

0 commit comments

Comments
 (0)