{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3276","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3276/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3276/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3276/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3276","id":141918495,"number":3276,"title":"mysql_db module fails to report some underlying SQL exceptions when import state is used","user":{"login":"d-lee","id":17225790,"avatar_url":"https://avatars.githubusercontent.com/u/17225790?v=3","gravatar_id":"","url":"https://api.github.com/users/d-lee","html_url":"https://github.com/d-lee","followers_url":"https://api.github.com/users/d-lee/followers","following_url":"https://api.github.com/users/d-lee/following{/other_user}","gists_url":"https://api.github.com/users/d-lee/gists{/gist_id}","starred_url":"https://api.github.com/users/d-lee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-lee/subscriptions","organizations_url":"https://api.github.com/users/d-lee/orgs","repos_url":"https://api.github.com/users/d-lee/repos","events_url":"https://api.github.com/users/d-lee/events{/privacy}","received_events_url":"https://api.github.com/users/d-lee/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/affects_2.0","name":"affects_2.0","color":"5319e7"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-18T16:38:40Z","updated_at":"2016-09-09T18:07:46Z","closed_at":null,"body":"##### Issue Type:\r\n - Bug Report\r\n\r\n##### Component Name:\r\nmysql_db module\r\n\r\n##### Ansible Version:\r\n```ansible 2.0.1.0```\r\n\r\n##### Ansible Configuration:\r\n\r\nDefault\r\n\r\n##### Environment:\r\n\r\nN/A\r\n\r\n##### Summary:\r\n\r\nmysql_db module fails to report underlying SQL exceptions when state is `import`\r\n\r\n##### Steps To Reproduce:\r\n\r\nexecute mysql_db task with state `import`, passing SQL script that contains commands that cause SQL exception, e.g. INSERT into a non-existent table.\r\n\r\n##### Playbook Excerpt:\r\n\r\n```\r\n- name: Insert record\r\n  run_once: true\r\n  delegate_to: localhost\r\n  mysql_db:\r\n    login_host: \"{{ db_host }}\"\r\n    login_port: \"{{ db_port }}\"\r\n    login_user: \"{{ db_user }}\"\r\n    login_password: \"{{ db_pass }}\"\r\n    name: \"{{ db_name }}\"\r\n    state: import\r\n    target: /tmp/insert_record.sql\r\n```\r\n\r\n##### Expected Results:\r\n\r\nmysql_db task should fail and report underlying SQL exception that caused the failure of the task.\r\ne.g.\r\n```\r\n>[Error] Script lines: 5-15 -------------------------\r\n Table 'db.test_table' doesn't exist\r\n```\r\n\r\n##### Actual Results:\r\nmysql_db reports success even though no records were actually inserted due to a SQL exception\r\n\r\n```\r\nTASK [Insert record] ****************************************\r\nok: [127.0.0.1 -> localhost]\r\n```\r\n\r\n##### Note:\r\nPlease note that some exceptions are properly detected. For example syntax errors in DML statements"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/245992955","html_url":"https://github.com/ansible/ansible-modules-core/issues/3276#issuecomment-245992955","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3276","id":245992955,"user":{"login":"Jmainguy","id":1372228,"avatar_url":"https://avatars.githubusercontent.com/u/1372228?v=3","gravatar_id":"","url":"https://api.github.com/users/Jmainguy","html_url":"https://github.com/Jmainguy","followers_url":"https://api.github.com/users/Jmainguy/followers","following_url":"https://api.github.com/users/Jmainguy/following{/other_user}","gists_url":"https://api.github.com/users/Jmainguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Jmainguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jmainguy/subscriptions","organizations_url":"https://api.github.com/users/Jmainguy/orgs","repos_url":"https://api.github.com/users/Jmainguy/repos","events_url":"https://api.github.com/users/Jmainguy/events{/privacy}","received_events_url":"https://api.github.com/users/Jmainguy/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T18:07:46Z","updated_at":"2016-09-09T18:07:46Z","body":"Unable to reproduce on latest devel\r\n\r\n```\r\n[root@centos6 tmp]# ansible localhost -m mysql_db -a \"state=import target=/tmp/pro.sql name=prosody\"\r\n [WARNING]: Host file not found: /etc/ansible/hosts\r\n\r\n [WARNING]: provided hosts list is empty, only localhost is available\r\n\r\nlocalhost | FAILED! => {\r\n    \"changed\": false, \r\n    \"failed\": true, \r\n    \"msg\": \"ERROR 1146 (42S02) at line 51: Table 'prosody.prosdy' doesn't exist\\n\"\r\n}\r\n```\r\nCan you still reproduce on latest devel? if so, can you provide a copy of the .sql file you are using to test."}}
{"actor":{"display_login":"Jmainguy"}}