Skip to content

Conversation

@allartk
Copy link
Contributor

@allartk allartk commented May 20, 2025

SUMMARY

Removing an existing schema in check mode does not report changes.
However, removing a non-existing schema in check mode does.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

postgresql_schema

ADDITIONAL INFORMATION

Example

- name: Remove londiste schema from database
  become: true
  become_user: postgres
  community.postgresql.postgresql_schema:
    name: londiste
    login_db: "{{ item.db }}"
    port: "{{ item.port }}"
    state: absent
    cascade_drop: true
  loop: "{{ londiste_cleanup }}"

@allartk
Copy link
Contributor Author

allartk commented May 20, 2025

PS: could use some help (if the change is correct) with the tests...

@andreasscherbaum
Copy link
Collaborator

There's an assert somewhere in the code, which is failing:

TASK [postgresql_schema : assert] **********************************************
02:23 task path: /root/ansible_collections/community/postgresql/tests/output/.tmp/integration/postgresql_schema-xqby83rh-ÅÑŚÌβŁÈ/tests/integration/targets/postgresql_schema/tasks/postgresql_schema_initial.yml:100
02:23 fatal: [testhost]: FAILED! => {
02:23     "assertion": "result is not changed",
02:23     "changed": false,
02:23     "evaluated_to": false,
02:23     "msg": "Assertion failed"
02:23 }

Copy link
Collaborator

@hunleyd hunleyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a changelog fragment before merging

@Andersson007
Copy link
Collaborator

@allartk thanks for submitting the fix

  1. You need to fix CI as Andreas pointed out, in particular the task tests/integration/targets/postgresql_schema/tasks/postgresql_schema_initial.yml:100
  2. See https://docs.ansible.com/ansible/devel/community/create_pr_quick_start.html how to run tests locally
  3. And the fragments pointed out by Doug

@allartk
Copy link
Contributor Author

allartk commented May 22, 2025

Thanks for the feedback, I'll try to fix, as soon as my schedule allows it.

* AZP: add RHEL 10.0 to devel remote target

* Update README

* fix tests

* fix copy-paste thing
@allartk allartk marked this pull request as draft May 28, 2025 14:35
@allartk allartk marked this pull request as ready for review May 28, 2025 15:08
@allartk allartk requested a review from hunleyd May 28, 2025 15:08
@andreasscherbaum andreasscherbaum merged commit 8b2d17b into ansible-collections:main May 29, 2025
30 checks passed
@allartk allartk deleted the patch-1 branch May 29, 2025 19:55
@Andersson007
Copy link
Collaborator

@allartk thanks for the fix!
@hunleyd @andreasscherbaum thanks for reviewing and merging!
I'll release now, FYI

@Andersson007 Andersson007 added the backport-3 Put it on PR to backport to stable-3 (only bug/doc fixes) label May 30, 2025
@patchback
Copy link

patchback bot commented May 30, 2025

Backport to stable-3: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-3/8b2d17b84bcd7f5459fd050a43e82b01f987d147/pr-858

Backported as #861

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request May 30, 2025
…nt (#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 <aklychko@redhat.com>
(cherry picked from commit 8b2d17b)
Andersson007 added a commit that referenced this pull request May 30, 2025
…nt (#858) (#861)

* 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

---------


(cherry picked from commit 8b2d17b)

Co-authored-by: allartk <allartk@gmail.com>
Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3 Put it on PR to backport to stable-3 (only bug/doc fixes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants