{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/15329","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/15329/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15329/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/15329/events","html_url":"https://github.com/ansible/ansible/issues/15329","id":146723275,"number":15329,"title":"__init.py__ data check for None","user":{"login":"BobanB","id":17296968,"avatar_url":"https://avatars.githubusercontent.com/u/17296968?v=3","gravatar_id":"","url":"https://api.github.com/users/BobanB","html_url":"https://github.com/BobanB","followers_url":"https://api.github.com/users/BobanB/followers","following_url":"https://api.github.com/users/BobanB/following{/other_user}","gists_url":"https://api.github.com/users/BobanB/gists{/gist_id}","starred_url":"https://api.github.com/users/BobanB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BobanB/subscriptions","organizations_url":"https://api.github.com/users/BobanB/orgs","repos_url":"https://api.github.com/users/BobanB/repos","events_url":"https://api.github.com/users/BobanB/events{/privacy}","received_events_url":"https://api.github.com/users/BobanB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-07T19:41:35Z","updated_at":"2016-04-07T20:08:01Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### ANSIBLE VERSION\r\n```\r\n<!--- Paste verbatim output from “ansible --version” between quotes -->\r\n```\r\nansible 2.0.0.2\r\n\r\n##### CONFIGURATION\r\n<!---\r\nMention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).\r\n--> https://github.com/yhekma/ansible_extra/blob/master/library/db2\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say “N/A” for anything that is not platform-specific.\r\n-->RedHat 7\r\n\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nRunning playbook with db2 action:\r\naction: db2 instance=db2inst1 command='db2 list db directory' outputfile=/tmp/output.txt\r\n\r\ngives error message:\r\nAn exception occurred during task execution. The full traceback is:\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py\", line 114, in run\r\n    self._shared_loader_obj,\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py\", line 119, in run\r\n    res = self._execute()\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py\", line 401, in _execute\r\n    result = self._handler.run(task_vars=variables)\r\n  File \"/usr/lib/python2.7/site-packages/ansible/plugins/action/normal.py\", line 33, in run\r\n    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))\r\n ** File \"/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py\", line 477, in _execute_module\r\n    data['stdout_lines'] = data.get('stdout', u'').splitlines()\r\nAttributeError: 'NoneType' object has no attribute 'splitlines'**\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n--> Mentioned in Summary. DB2 10.5 used.\r\nExample output of the command is documented at\r\nhttps://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001954.html\r\n\r\n```\r\n<!--- Paste example playbooks or commands between quotes -->\r\n```\r\nhttps://github.com/yhekma/ansible_extra/blob/master/library/db2\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\nhttps://github.com/yhekma/ansible_extra/blob/master/library/db2\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nOutput documented at https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001954.html\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with high verbosity (-vvvv) -->\r\nAn exception occurred during task execution. The full traceback is:\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/process/worker.py\", line 114, in run\r\n    self._shared_loader_obj,\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py\", line 119, in run\r\n    res = self._execute()\r\n  File \"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py\", line 401, in _execute\r\n    result = self._handler.run(task_vars=variables)\r\n  File \"/usr/lib/python2.7/site-packages/ansible/plugins/action/normal.py\", line 33, in run\r\n    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))\r\n ** File \"/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py\", line 477, in _execute_module\r\n    data['stdout_lines'] = data.get('stdout', u'').splitlines()\r\nAttributeError: 'NoneType' object has no attribute 'splitlines'**\r\n```\r\n<!--- Paste verbatim command output between quotes -->\r\n```\r\n\r\n```\r\n<!--- Steps to fix the reported issue -->\r\n```\r\n__init__.py line 473 added None check. Haven't checked yet whether it breaks something default.\r\n       if data is not None:\r\n            return data\r\n\r\n        if 'stdout' in data and 'stdout_lines' not in data:\r\n            data['stdout_lines'] = data.get('stdout', u'').splitlines()\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/207069261","html_url":"https://github.com/ansible/ansible/issues/15329#issuecomment-207069261","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15329","id":207069261,"user":{"login":"BobanB","id":17296968,"avatar_url":"https://avatars.githubusercontent.com/u/17296968?v=3","gravatar_id":"","url":"https://api.github.com/users/BobanB","html_url":"https://github.com/BobanB","followers_url":"https://api.github.com/users/BobanB/followers","following_url":"https://api.github.com/users/BobanB/following{/other_user}","gists_url":"https://api.github.com/users/BobanB/gists{/gist_id}","starred_url":"https://api.github.com/users/BobanB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BobanB/subscriptions","organizations_url":"https://api.github.com/users/BobanB/orgs","repos_url":"https://api.github.com/users/BobanB/repos","events_url":"https://api.github.com/users/BobanB/events{/privacy}","received_events_url":"https://api.github.com/users/BobanB/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T20:08:01Z","updated_at":"2016-04-07T20:08:01Z","body":"Was testing looks like the __init__.py is ok. '':  write_to_output(outputfile, out, output_format), gives good result."}}