# Buggy code
def handle(domain):
    domain = domain["DomainName"]
    if re.match(filter, domain):
        details = cmd_es("describe-elasticsearch-domain --domain-name %s" % domain, env)
        details = json.loads(details)["DomainStatus"]
        arn = details["ARN"]
        es = ElasticSearch(arn)
        es.endpoint = details["Endpoint"]
        result.append(es)
        pool[arn] = es


# Traceback (KeyError)
2017-10-11T05:49:47:INFO:werkzeug: 192.168.99.1 - - [11/Oct/2017 05:49:47] "GET / HTTP/1.1" 200 -
2017-10-11T05:49:47:INFO:werkzeug: 192.168.99.1 - - [11/Oct/2017 05:49:47] "GET //192.168.99.103:8080/swagger.json HTTP/1.1" 200 -
2017-10-11T05:49:48:INFO:werkzeug: 192.168.99.1 - - [11/Oct/2017 05:49:48] "GET /img/localstack_icon.png HTTP/1.1" 200 -
2017-10-11T05:49:49:INFO:werkzeug: 192.168.99.1 - - [11/Oct/2017 05:49:49] "POST /graph HTTP/1.1" 500 -
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/code/localstack/localstack/dashboard/api.py", line 37, in get_graph
graph = infra.get_graph(name_filter=data['nameFilter'], env=env)
File "/opt/code/localstack/localstack/dashboard/infra.py", line 432, in get_graph
domains = get_elasticsearch_domains(name_filter, pool=pool, env=env)
File "/opt/code/localstack/localstack/dashboard/infra.py", line 312, in get_elasticsearch_domains
parallelize(handle, out['DomainNames'])
File "/opt/code/localstack/localstack/utils/common.py", line 698, in parallelize
result = pool.map(func, list)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get
raise self._value
KeyError: 'Endpoint'

# Fixed code
def handle(domain):
    domain = domain["DomainName"]
    if re.match(filter, domain):
        details = cmd_es("describe-elasticsearch-domain --domain-name %s" % domain, env)
        details = json.loads(details)["DomainStatus"]
        arn = details["ARN"]
        es = ElasticSearch(arn)
        es.endpoint = details.get("Endpoint", "n/a")
        result.append(es)
        pool[arn] = es