{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/16384","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/16384/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/16384/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/16384/events","html_url":"https://github.com/ansible/ansible/issues/16384","id":161498021,"number":16384,"title":"Importing e.g. ansible.inventory has strange terminal side effects","user":{"login":"Julian","id":329822,"avatar_url":"https://avatars.githubusercontent.com/u/329822?v=3","gravatar_id":"","url":"https://api.github.com/users/Julian","html_url":"https://github.com/Julian","followers_url":"https://api.github.com/users/Julian/followers","following_url":"https://api.github.com/users/Julian/following{/other_user}","gists_url":"https://api.github.com/users/Julian/gists{/gist_id}","starred_url":"https://api.github.com/users/Julian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Julian/subscriptions","organizations_url":"https://api.github.com/users/Julian/orgs","repos_url":"https://api.github.com/users/Julian/repos","events_url":"https://api.github.com/users/Julian/events{/privacy}","received_events_url":"https://api.github.com/users/Julian/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-06-21T17:42:25Z","updated_at":"2016-06-21T19:26:29Z","closed_at":"2016-06-21T18:09:28Z","body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\r\n```\r\nansible 2.0.2.0\r\n  config file = /Users/Julian/.config/ansible/config.ini\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\nN/A\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\n`ansible.utils.color` has side effects on import.\r\n\r\nThis can make things as simple as wanting to `import ansible.inventory` throw a traceback:\r\n\r\n```\r\n  File \"floodgate/inventory/ansible.py\", line 3, in <module>\r\n    from ansible.inventory.ini import InventoryParser\r\n  File \"/Users/Julian/.local/share/virtualenvs/ansible/lib/python2.7/site-packages/ansible/inventory/__init__.py\", line 36, in <module>\r\n    from ansible.plugins import vars_loader\r\n  File \"/Users/Julian/.local/share/virtualenvs/ansible/lib/python2.7/site-packages/ansible/plugins/__init__.py\", line 38, in <module>\r\n    from ansible.utils.display import Display\r\n  File \"/Users/Julian/.local/share/virtualenvs/ansible/lib/python2.7/site-packages/ansible/utils/display.py\", line 37, in <module>\r\n    from ansible.utils.color import stringc\r\n  File \"/Users/Julian/.local/share/virtualenvs/ansible/lib/python2.7/site-packages/ansible/utils/color.py\", line 32, in <module>\r\n    curses.setupterm()\r\nTypeError: argument must be an int, or have a fileno() method.\r\n```\r\n\r\nif `sys.stdout` (which is the default for `setupterm`) is not backed by a real file.\r\n\r\n##### EXPECTED RESULTS\r\nNo side effects unless some sort of initialization is run. Just handling the possible exception in that block of `ansible.utils.color` would be an alternate smaller change which would help at least for not crashing."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/227545360","html_url":"https://github.com/ansible/ansible/issues/16384#issuecomment-227545360","issue_url":"https://api.github.com/repos/ansible/ansible/issues/16384","id":227545360,"user":{"login":"Julian","id":329822,"avatar_url":"https://avatars.githubusercontent.com/u/329822?v=3","gravatar_id":"","url":"https://api.github.com/users/Julian","html_url":"https://github.com/Julian","followers_url":"https://api.github.com/users/Julian/followers","following_url":"https://api.github.com/users/Julian/following{/other_user}","gists_url":"https://api.github.com/users/Julian/gists{/gist_id}","starred_url":"https://api.github.com/users/Julian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Julian/subscriptions","organizations_url":"https://api.github.com/users/Julian/orgs","repos_url":"https://api.github.com/users/Julian/repos","events_url":"https://api.github.com/users/Julian/events{/privacy}","received_events_url":"https://api.github.com/users/Julian/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T19:26:29Z","updated_at":"2016-06-21T19:26:29Z","body":"Or more specifically, what public API exists currently for just parsing an inventory file? `ansible --list-hosts` produces not very machine readable output."}}
{"actor":{"display_login":"Julian"}}