Open srkunze opened 5 years ago
Hey @srkunze let's see if we can group all this information into a single ticket and identify what issues are going on with this module. I don't want to close tickets that identify issues and definitely don't want duplicates for sake of confusion.
Whatever you find is best. These tickets describe different situations, saltstack can be in. :-)
Also different salt states are concerned.
Okay, thanks for clearing that up. I did re-read through them and see that they are for different outcomes but it appears that, in general, the error codes do need a bit more verbose information.
I'll write this down to investigate this and the other related issues later this week, but I'll follow up Friday in either case to make sure we're on the same page about these 3 issues.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
not stale
Thank you for updating this issue. It is no longer marked as stale.
Alright another part of the issue to illustrate the behavior:
11:08:47 ----------
11:08:47 ID: database__ensure
11:08:47 Function: postgres_database.present
11:08:47 Name: mysystem
11:08:47 Result: True
11:08:47 Comment: Database mysystem is already present
11:08:47 Started: 11:08:32.564474
11:08:47 Duration: 81.264 ms
11:08:47 Changes:
11:08:47 ----------
11:08:47 ID: database_absent
11:08:47 Function: postgres_database.absent
11:08:47 Name: mysystem
11:08:47 Result: True
11:08:47 Comment: Database mysystem is not present, so it cannot be removed
11:08:47 Started: 11:08:32.647191
11:08:47 Duration: 5185.282 ms
database__ensure:
postgres_database.present:
- name: {{ system.database }}
database_absent:
postgres_database.absent:
- name: {{ system.database }}
- require:
- database__ensure
postgres:~> dropdb mysystem
dropdb: Deletion of the database failed: ERROR: database "mysystem" is being accessed by other users
DETAIL: There is 1 other session using the database.
Our current work-around according to https://dba.stackexchange.com/questions/11893/force-drop-db-while-others-may-be-connected
my_database_absent:
cmd.run:
- name: psql -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '{{ system.database }}'" && dropdb {{ system.database }}
- runas: postgres
- check_cmd:
- "! psql {{ system.database }} -c ''"
In PostgreSQL 13 there will be: ''DROP DATABASE mydb FORCE"
Similar to #54470 and #54469
This time:
Output of salt is SUCCESS
This should definitely lead to an error and a comment that the server is down.