diff options
author | Tomas Sedovic <tomas@sedovic.cz> | 2013-08-08 14:50:22 +0200 |
---|---|---|
committer | Tomas Sedovic <tomas@sedovic.cz> | 2013-08-08 15:29:36 +0200 |
commit | 30148729b06712ba192b56cd1f2b36f1552b7ab5 (patch) | |
tree | 976d7bf683a7f2f882316d4207b6691233fe5880 | |
parent | fed131db5c2ba09fc9c48ea3303d0cba8a9b881e (diff) | |
download | tuskar-ui-30148729b06712ba192b56cd1f2b36f1552b7ab5.tar.gz |
Don't time out when listing unracked nodes
When we don't have Nova baremetal running, the app will die trying to list the
unracked nodes.
Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
-rw-r--r-- | tuskar_ui/api.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tuskar_ui/api.py b/tuskar_ui/api.py index e1b182bb..3546565c 100644 --- a/tuskar_ui/api.py +++ b/tuskar_ui/api.py @@ -23,6 +23,7 @@ from django.conf import settings from django.db.models import Max from django.utils.translation import ugettext_lazy as _ from horizon import exceptions +from requests import ConnectionError from novaclient.v1_1.contrib import baremetal from tuskarclient.v1 import client as tuskar_client @@ -207,8 +208,10 @@ class Node(StringIdAPIResourceWrapper): @classmethod def list_unracked(cls, request): - return [n for n in Node.list(request) if ( - n.rack is None)] + try: + return [n for n in Node.list(request) if (n.rack is None)] + except ConnectionError: + return [] @classmethod def create(cls, request, name, cpus, memory_mb, local_gb, prov_mac_address, |