Handle the case where there are no realms registered.

This commit is contained in:
Jake Moshenko 2015-01-05 12:23:54 -05:00
parent b33ee1a474
commit 320ae63ccd

View file

@ -131,10 +131,14 @@ class EphemeralBuilderManager(BaseManager):
@coroutine
def _register_existing_realms(self):
all_realms = yield From(self._etcd_client.read(ETCD_REALM_PREFIX, recursive=True))
for realm in all_realms.children:
if not realm.dir:
self._register_realm(json.loads(realm.value))
try:
all_realms = yield From(self._etcd_client.read(ETCD_REALM_PREFIX, recursive=True))
for realm in all_realms.children:
if not realm.dir:
self._register_realm(json.loads(realm.value))
except KeyError:
# no realms have been registered yet
pass
def initialize(self, manager_config):
logger.debug('Calling initialize')