From 320ae63ccdbc96fa68ee2e4d8073be039027e861 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 5 Jan 2015 12:23:54 -0500 Subject: [PATCH] Handle the case where there are no realms registered. --- buildman/manager/ephemeral.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buildman/manager/ephemeral.py b/buildman/manager/ephemeral.py index 701465c3f..aa9bb7193 100644 --- a/buildman/manager/ephemeral.py +++ b/buildman/manager/ephemeral.py @@ -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')