Locu/chronology — pull request #356 by joshblum (2014-12-20 22:43:07+00:00)
Title: Avoid KeyError when value is an empty dictionary

@usmanm would know best why this is happening, but the test suite was failing since `value` is sometimes an empty dictionary. The bug was hard to reproduce -- after a few initial runs it wouldn't turn up, even after restarting the es server. Here is the traceback when it does fail:

```
======================================================================
ERROR: test_rollover (test_elasticsearch.TestElasticSearchBackend)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/joshblum/chronology/kronos/tests/storage/elasticsearch/test_elasticsearch.py", line 106, in test_rollover
events = self.get('test_rollover', 0, 1)
File "/home/joshblum/chronology/kronos/tests/server.py", line 67, in get
buffered=True)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 772, in post
return self.open(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 736, in open
response = self.run_wsgi_app(environ, buffered=buffered)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 659, in run_wsgi_app
rv = run_wsgi_app(self.application, environ, buffered=buffered)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 862, in run_wsgi_app
app_iter = list(app_iter)
File "/home/joshblum/chronology/kronos/kronos/app.py", line 187, in get_events
for event in events:
File "/home/joshblum/chronology/kronos/kronos/storage/elasticsearch/client.py", line 302, in _retrieve
end_time)
File "/home/joshblum/chronology/kronos/kronos/storage/elasticsearch/client.py", line 178, in get_aliases
aliases.update(value['aliases'])
KeyError: 'aliases'
```

Could it be a race when rolling over?