{"action":"created","issue":{"url":"https://api.github.com/repos/deis/deis/issues/2865","labels_url":"https://api.github.com/repos/deis/deis/issues/2865/labels{/name}","comments_url":"https://api.github.com/repos/deis/deis/issues/2865/comments","events_url":"https://api.github.com/repos/deis/deis/issues/2865/events","html_url":"https://github.com/deis/deis/pull/2865","id":53726514,"number":2865,"title":"fix(controller): Ignore KeyError","user":{"login":"duanhongyi","id":548686,"avatar_url":"https://avatars.githubusercontent.com/u/548686?v=3","gravatar_id":"","url":"https://api.github.com/users/duanhongyi","html_url":"https://github.com/duanhongyi","followers_url":"https://api.github.com/users/duanhongyi/followers","following_url":"https://api.github.com/users/duanhongyi/following{/other_user}","gists_url":"https://api.github.com/users/duanhongyi/gists{/gist_id}","starred_url":"https://api.github.com/users/duanhongyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duanhongyi/subscriptions","organizations_url":"https://api.github.com/users/duanhongyi/orgs","repos_url":"https://api.github.com/users/duanhongyi/repos","events_url":"https://api.github.com/users/duanhongyi/events{/privacy}","received_events_url":"https://api.github.com/users/duanhongyi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mboersma","id":73019,"avatar_url":"https://avatars.githubusercontent.com/u/73019?v=3","gravatar_id":"","url":"https://api.github.com/users/mboersma","html_url":"https://github.com/mboersma","followers_url":"https://api.github.com/users/mboersma/followers","following_url":"https://api.github.com/users/mboersma/following{/other_user}","gists_url":"https://api.github.com/users/mboersma/gists{/gist_id}","starred_url":"https://api.github.com/users/mboersma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboersma/subscriptions","organizations_url":"https://api.github.com/users/mboersma/orgs","repos_url":"https://api.github.com/users/mboersma/repos","events_url":"https://api.github.com/users/mboersma/events{/privacy}","received_events_url":"https://api.github.com/users/mboersma/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-01-08T08:38:42Z","updated_at":"2015-01-09T01:16:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/deis/deis/pulls/2865","html_url":"https://github.com/deis/deis/pull/2865","diff_url":"https://github.com/deis/deis/pull/2865.diff","patch_url":"https://github.com/deis/deis/pull/2865.patch"},"body":"\r\n1、Execute the following command: `deis apps`,Then the output：\r\n\r\n=== Apps\r\ndockerfile-test\r\ncelery\r\n\r\n\r\n2、Execute the following command:`deis apps:destroy --app=celery --confirm=celery`,Then the output：\r\n\r\nDestroying celery... \r\n500 INTERNAL SERVER ERROR\r\n\r\n3、Execute the following command:`deisctl journal controller`,Then the output：\r\n\r\nJan 08 07:43:54 deis-3 sh[21544]: response = handler(request, *args, **kwargs)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/app/api/views.py\", line 220, in destroy\r\nJan 08 07:43:54 deis-3 sh[21544]: obj.delete()\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/app/api/models.py\", line 147, in delete\r\nJan 08 07:43:54 deis-3 sh[21544]: return super(App, self).delete(*args, **kwargs)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 695, in delete\r\nJan 08 07:43:54 deis-3 sh[21544]: collector.delete()\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/django/db/models/deletion.py\", line 282, in delete\r\nJan 08 07:43:54 deis-3 sh[21544]: sender=model, instance=obj, using=self.using\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py\", line 185, in send\r\nJan 08 07:43:54 deis-3 sh[21544]: response = receiver(signal=self, sender=sender, **named)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/app/api/models.py\", line 866, in _etcd_purge_app\r\nJan 08 07:43:54 deis-3 sh[21544]: _etcd_client.delete('/deis/services/{}'.format(appname), dir=True, recursive=True)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/etcd/client.py\", line 389, in delete\r\nJan 08 07:43:54 deis-3 sh[21544]: self.key_endpoint + key, self._MDELETE, params=kwds)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/etcd/client.py\", line 582, in api_execute\r\nJan 08 07:43:54 deis-3 sh[21544]: return self._handle_server_response(response)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/etcd/client.py\", line 598, in _handle_server_response\r\nJan 08 07:43:54 deis-3 sh[21544]: etcd.EtcdError.handle(**r)\r\nJan 08 07:43:54 deis-3 sh[21544]: File \"/usr/local/lib/python2.7/dist-packages/etcd/__init__.py\", line 142, in handle\r\nJan 08 07:43:54 deis-3 sh[21544]: raise exc(msg)\r\nJan 08 07:43:54 deis-3 sh[21544]: KeyError: 'Key not found : /deis/services/celery'\r\nJan 08 07:43:54 deis-3 sh[21544]: 172.17.8.101 \"DELETE /v1/apps/celery HTTP/1.0\" 500 - \"python-requests/2.4.3 CPython/2.7.8 Linux/3.16.0-28-generic\"\r\n\r\n4、Conclusion\r\n\r\nSome special cases can lead to etcd key creation failed,Suggest ignoring some KeyError exception"},"comment":{"url":"https://api.github.com/repos/deis/deis/issues/comments/69279583","html_url":"https://github.com/deis/deis/pull/2865#issuecomment-69279583","issue_url":"https://api.github.com/repos/deis/deis/issues/2865","id":69279583,"user":{"login":"bacongobbler","id":1360539,"avatar_url":"https://avatars.githubusercontent.com/u/1360539?v=3","gravatar_id":"","url":"https://api.github.com/users/bacongobbler","html_url":"https://github.com/bacongobbler","followers_url":"https://api.github.com/users/bacongobbler/followers","following_url":"https://api.github.com/users/bacongobbler/following{/other_user}","gists_url":"https://api.github.com/users/bacongobbler/gists{/gist_id}","starred_url":"https://api.github.com/users/bacongobbler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bacongobbler/subscriptions","organizations_url":"https://api.github.com/users/bacongobbler/orgs","repos_url":"https://api.github.com/users/bacongobbler/repos","events_url":"https://api.github.com/users/bacongobbler/events{/privacy}","received_events_url":"https://api.github.com/users/bacongobbler/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T01:16:47Z","updated_at":"2015-01-09T01:16:47Z","body":"I agree. It should still delete the application, even if we fail to delete the key for whatever reason. It's cleanup more than anything.\r\n\r\ncode LGTM from my point of view, though I'd remove the misleading commends in the code (I can't think of a way that _etcd_publish_key() would be skipped unless you can reproduce the effect)."}}