{"action":"reopened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/37506","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/37506/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/37506/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/37506/events","html_url":"https://github.com/saltstack/salt/issues/37506","id":187647210,"number":37506,"title":"states.postgresql_database.absent reports DB in use as \"not present\"","user":{"login":"eliasp","id":48491,"avatar_url":"https://avatars.githubusercontent.com/u/48491?v=3","gravatar_id":"","url":"https://api.github.com/users/eliasp","html_url":"https://github.com/eliasp","followers_url":"https://api.github.com/users/eliasp/followers","following_url":"https://api.github.com/users/eliasp/following{/other_user}","gists_url":"https://api.github.com/users/eliasp/gists{/gist_id}","starred_url":"https://api.github.com/users/eliasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliasp/subscriptions","organizations_url":"https://api.github.com/users/eliasp/orgs","repos_url":"https://api.github.com/users/eliasp/repos","events_url":"https://api.github.com/users/eliasp/events{/privacy}","received_events_url":"https://api.github.com/users/eliasp/received_events","type":"User","site_admin":false},"labels":[{"id":41387723,"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":227621234,"url":"https://api.github.com/repos/saltstack/salt/labels/Carbon","name":"Carbon","color":"fbca04","default":false},{"id":41387994,"url":"https://api.github.com/repos/saltstack/salt/labels/Medium%20Severity","name":"Medium Severity","color":"fad8c7","default":false},{"id":194766324,"url":"https://api.github.com/repos/saltstack/salt/labels/P4","name":"P4","color":"031a39","default":false},{"id":220527153,"url":"https://api.github.com/repos/saltstack/salt/labels/RIoT","name":"RIoT","color":"fef2c0","default":false},{"id":41387450,"url":"https://api.github.com/repos/saltstack/salt/labels/State%20Module","name":"State Module","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":3214,"closed_issues":4173,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2016-11-15T16:09:32Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-11-07T08:02:53Z","updated_at":"2016-11-15T16:09:32Z","closed_at":null,"body":"### Description of Issue/Question\r\n\r\nWhen trying to remove a DB which is in use using `postgresql_database.absent` the resulting error message wrongly indicates the DB wouldn't be present instead of it being \"in use\".\r\n\r\n### Setup\r\n\r\nMake sure to have a PostgreSQL DB setup and in use.\r\n\r\n### Steps to Reproduce Issue\r\n\r\n\r\nTry to remove an existing (and used) PostgreSQL DB using: `salt-call --local state.single postgres_database.absent name=test_api_38c0f0cb`\r\n\r\nThe log output clearly shows the discrepancy between what's actually happening (`ERROR:  database \"test_api_38c0f0cb\" is being accessed by other users`) and what Salt is reporting (`Database test_api_38c0f0cb is not present, so it cannot be removed`):\r\n\r\n```\r\n# salt-call --local state.single postgres_database.absent name=test_api_38c0f0cb\r\n[INFO    ] Loading fresh modules for state activity\r\n[INFO    ] Running state [test_api_38c0f0cb] at time 07:58:12.303656\r\n[INFO    ] Executing state postgres_database.absent for test_api_38c0f0cb\r\n[INFO    ] Executing command ['/usr/bin/psql', '--no-align', '--no-readline', '--no-psqlrc', '--no-password', '--dbname', 'postgres', '-v', 'datestyle=ISO,MDY', '-c', 'COPY (SELECT datname as \"Name\", pga.rolname as \"Owner\", pg_encoding_to_char(encoding) as \"Encoding\", datcollate as \"Collate\", datctype as \"Ctype\", datacl as \"Access privileges\", spcname as \"Tablespace\" FROM pg_database pgd, pg_roles pga, pg_tablespace pgts WHERE pga.oid = pgd.datdba AND pgts.oid = pgd.dattablespace) TO STDOUT WITH CSV HEADER'] as user 'postgres' in directory '/var/lib/postgresql'\r\n[INFO    ] Executing command ['/usr/bin/psql', '--no-align', '--no-readline', '--no-psqlrc', '--no-password', '--dbname', 'postgres', '-c', 'DROP DATABASE \"test_api_38c0f0cb\"'] as user 'postgres' in directory '/var/lib/postgresql'\r\n[ERROR   ] Command '['/usr/bin/psql', '--no-align', '--no-readline', '--no-psqlrc', '--no-password', '--dbname', 'postgres', '-c', 'DROP DATABASE \"test_api_38c0f0cb\"']' failed with return code: 1\r\n[ERROR   ] stderr: ERROR:  database \"test_api_38c0f0cb\" is being accessed by other users\r\nDETAIL:  There are 2 other sessions using the database.\r\n[ERROR   ] retcode: 1\r\n[ERROR   ] Error connecting to Postgresql server\r\n[INFO    ] Database test_api_38c0f0cb is not present, so it cannot be removed\r\n[INFO    ] Completed state [test_api_38c0f0cb] at time 07:58:17.479731 duration_in_ms=5176.075\r\nlocal:\r\n----------\r\n          ID: test_api_38c0f0cb\r\n    Function: postgres_database.absent\r\n      Result: True\r\n     Comment: Database test_api_38c0f0cb is not present, so it cannot be removed\r\n     Started: 07:58:12.303656\r\n    Duration: 5176.075 ms\r\n     Changes:   \r\n\r\nSummary for local\r\n------------\r\nSucceeded: 1\r\nFailed:    0\r\n------------\r\nTotal states run:     1\r\nTotal run time:   5.176 s\r\n```\r\n\r\n### Versions Report\r\n```\r\n    Salt Version:\r\n               Salt: 2016.3.4\r\n     \r\n    Dependency Versions:\r\n               cffi: Not Installed\r\n           cherrypy: Not Installed\r\n           dateutil: 2.2\r\n              gitdb: Not Installed\r\n          gitpython: Not Installed\r\n              ioflo: Not Installed\r\n             Jinja2: 2.7.3\r\n            libgit2: Not Installed\r\n            libnacl: Not Installed\r\n           M2Crypto: Not Installed\r\n               Mako: Not Installed\r\n       msgpack-pure: Not Installed\r\n     msgpack-python: 0.4.2\r\n       mysql-python: 1.2.3\r\n          pycparser: Not Installed\r\n           pycrypto: 2.6.1\r\n             pygit2: Not Installed\r\n             Python: 2.7.9 (default, Jun 29 2016, 13:08:31)\r\n       python-gnupg: Not Installed\r\n             PyYAML: 3.11\r\n              PyZMQ: 14.4.0\r\n               RAET: Not Installed\r\n              smmap: Not Installed\r\n            timelib: Not Installed\r\n            Tornado: 4.2.1\r\n                ZMQ: 4.0.5\r\n     \r\n    System Versions:\r\n               dist: debian 8.6 \r\n            machine: x86_64\r\n            release: 3.16.0-4-amd64\r\n             system: Linux\r\n            version: debian 8.6 \r\n```"}}
{"actor":{"display_login":"rallytime"}}