{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/17369","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/17369/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/17369/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/17369/events","html_url":"https://github.com/ansible/ansible/issues/17369","id":174820740,"number":17369,"title":"ansible crashes if cwd has been removed","user":{"login":"dpkp","id":843444,"avatar_url":"https://avatars.githubusercontent.com/u/843444?v=3","gravatar_id":"","url":"https://api.github.com/users/dpkp","html_url":"https://github.com/dpkp","followers_url":"https://api.github.com/users/dpkp/followers","following_url":"https://api.github.com/users/dpkp/following{/other_user}","gists_url":"https://api.github.com/users/dpkp/gists{/gist_id}","starred_url":"https://api.github.com/users/dpkp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpkp/subscriptions","organizations_url":"https://api.github.com/users/dpkp/orgs","repos_url":"https://api.github.com/users/dpkp/repos","events_url":"https://api.github.com/users/dpkp/events{/privacy}","received_events_url":"https://api.github.com/users/dpkp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"mscherer","id":230335,"avatar_url":"https://avatars.githubusercontent.com/u/230335?v=3","gravatar_id":"","url":"https://api.github.com/users/mscherer","html_url":"https://github.com/mscherer","followers_url":"https://api.github.com/users/mscherer/followers","following_url":"https://api.github.com/users/mscherer/following{/other_user}","gists_url":"https://api.github.com/users/mscherer/gists{/gist_id}","starred_url":"https://api.github.com/users/mscherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscherer/subscriptions","organizations_url":"https://api.github.com/users/mscherer/orgs","repos_url":"https://api.github.com/users/mscherer/repos","events_url":"https://api.github.com/users/mscherer/events{/privacy}","received_events_url":"https://api.github.com/users/mscherer/received_events","type":"User","site_admin":false},"assignees":[{"login":"mscherer","id":230335,"avatar_url":"https://avatars.githubusercontent.com/u/230335?v=3","gravatar_id":"","url":"https://api.github.com/users/mscherer","html_url":"https://github.com/mscherer","followers_url":"https://api.github.com/users/mscherer/followers","following_url":"https://api.github.com/users/mscherer/following{/other_user}","gists_url":"https://api.github.com/users/mscherer/gists{/gist_id}","starred_url":"https://api.github.com/users/mscherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscherer/subscriptions","organizations_url":"https://api.github.com/users/mscherer/orgs","repos_url":"https://api.github.com/users/mscherer/repos","events_url":"https://api.github.com/users/mscherer/events{/privacy}","received_events_url":"https://api.github.com/users/mscherer/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-09-02T18:27:06Z","updated_at":"2016-09-06T02:46:47Z","closed_at":"2016-09-06T02:46:47Z","body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\ncore\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\r\n```\r\nansible 2.2.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\nNone\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\nos.getcwd raises OSError if the current working directory no longer exists. Ansible checks the cwd for an optional ansible.cfg file. Currently ansible does not catch the OSError and instead crashes. I think the correct behavior, since the cwd config file is optional, would be to ignore this error.\r\n\r\n##### STEPS TO REPRODUCE\r\n```\r\nvirtualenv venv\r\nvenv/bin/pip install ansible\r\nmkdir foo\r\ncd foo\r\nrmdir $(pwd)\r\n../venv/bin/ansible --version\r\n```\r\n\r\n##### EXPECTED RESULTS\r\n```\r\nansible 2.2.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n\r\n##### ACTUAL RESULTS\r\n```\r\nTraceback (most recent call last):\r\n  File \"../venv/bin/ansible\", line 44, in <module>\r\n    import ansible.constants as C\r\n  File \"/Users/dpowers/Code/ansible/venv/lib/python2.7/site-packages/ansible/constants.py\", line 128, in <module>\r\n    p, CONFIG_FILE = load_config_file()\r\n  File \"/Users/dpowers/Code/ansible/venv/lib/python2.7/site-packages/ansible/constants.py\", line 115, in load_config_file\r\n    path1 = os.getcwd() + \"/ansible.cfg\"\r\nOSError: [Errno 2] No such file or directory\r\n```"}}
{"actor":{"display_login":"bcoca"}}