{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12708","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12708/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12708/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12708/events","html_url":"https://github.com/ansible/ansible/issues/12708","id":110927067,"number":12708,"title":"[v2] AttributeError: 'CacheModule' object has no attribute '_display'","user":{"login":"mgedmin","id":159967,"avatar_url":"https://avatars.githubusercontent.com/u/159967?v=3","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-12T08:11:51Z","updated_at":"2015-10-12T13:50:38Z","closed_at":null,"body":"**Issue Type**: Bug Report\r\n**Ansible Version**:\r\n```\r\nansible 2.0.0 (devel eb60ce1b6e) last updated 2015/10/12 09:17:27 (GMT +300)\r\n  lib/ansible/modules/core: (detached HEAD 92d25017ed) last updated 2015/10/12 09:17:45 (GMT +300)\r\n  lib/ansible/modules/extras: (detached HEAD 205115ea1f) last updated 2015/10/12 09:17:45 (GMT +300)\r\n```\r\n**Summary**:\r\nI was testing a custom module, and this happened:\r\n\r\n```\r\n$ ANSIBLE_CONFIG=vagrant.cfg ansible-playbook test-changelog.yml \r\n\r\nPLAY ***************************************************************************\r\n\r\nTASK [changelog msg=one append=no] *********************************************\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/multiprocessing/queues.py\", line 264, in _feed\r\n    send(obj)\r\n  File \"/home/mg/src/ansible/lib/ansible/vars/__init__.py\", line 94, in __getstate__\r\n    fact_cache = self._fact_cache.copy(),\r\n  File \"/home/mg/src/ansible/lib/ansible/plugins/cache/__init__.py\", line 63, in copy\r\n    return dict(self)\r\n  File \"/home/mg/src/ansible/lib/ansible/plugins/cache/__init__.py\", line 44, in __getitem__\r\n    return self._plugin.get(key)\r\n  File \"/home/mg/src/ansible/lib/ansible/plugins/cache/jsonfile.py\", line 72, in get\r\n    self._display.warning(\"error while trying to write to %s : %s\" % (cachefile, str(e)))\r\nAttributeError: 'CacheModule' object has no attribute '_display'\r\n```\r\n\r\nAt that point ansible-playbook hangs until I hit ^C.\r\n\r\n**Steps to Reproduce**:\r\n\r\n1. Create an `ansible.cfg`:\r\n```ini\r\n[defaults]\r\ngathering = smart\r\nfact_caching = jsonfile\r\nfact_caching_connection = .cache/facts/\r\nfact_caching_timeout = 86400\r\n```\r\n2. Create a playbook `test.yml`:\r\n```yaml\r\n- hosts: localhost\r\n  tasks:\r\n    - debug: msg=\"hello\"\r\n```\r\n3. Create an empty cache file (or any other error condition, e.g. a read-only `.cache` directory)\r\n```\r\n$ mkdir -p .cache/facts\r\n$ echo > .cache/facts/localhost\r\n```\r\n4. Run `ansible-playbook test.yml`\r\n\r\n**Expected Results**:\r\n\r\nEither the empty cache file is ignored, or there's an error saying that the cache file is corrupt.\r\n\r\n**Actual Results**:\r\n\r\n```\r\nPLAY ***************************************************************************\r\nUnexpected Exception: 'CacheModule' object has no attribute '_display'\r\nto see the full traceback, use -vvv\r\n```\r\n\r\n(there was no hang with this reproducible example)"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/147405188","html_url":"https://github.com/ansible/ansible/issues/12708#issuecomment-147405188","issue_url":"https://api.github.com/repos/ansible/ansible/issues/12708","id":147405188,"user":{"login":"mgedmin","id":159967,"avatar_url":"https://avatars.githubusercontent.com/u/159967?v=3","gravatar_id":"","url":"https://api.github.com/users/mgedmin","html_url":"https://github.com/mgedmin","followers_url":"https://api.github.com/users/mgedmin/followers","following_url":"https://api.github.com/users/mgedmin/following{/other_user}","gists_url":"https://api.github.com/users/mgedmin/gists{/gist_id}","starred_url":"https://api.github.com/users/mgedmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgedmin/subscriptions","organizations_url":"https://api.github.com/users/mgedmin/orgs","repos_url":"https://api.github.com/users/mgedmin/repos","events_url":"https://api.github.com/users/mgedmin/events{/privacy}","received_events_url":"https://api.github.com/users/mgedmin/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T13:50:37Z","updated_at":"2015-10-12T13:50:37Z","body":"git bisect blames commit 851ed45bbf76b74083a0f7e409811418d45ca217 for the broken cache error handling code."}}