From 9662e02eb79f598ad5eb50358bb91b9df9c53c64 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 31 Dec 2019 13:50:56 +0100 Subject: [PATCH] Allow to not have keys in etcd --- uncloud/settings/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uncloud/settings/__init__.py b/uncloud/settings/__init__.py index 90b938c..629660e 100644 --- a/uncloud/settings/__init__.py +++ b/uncloud/settings/__init__.py @@ -115,7 +115,13 @@ class Settings(object): ) def __getitem__(self, key): - self.read_values_from_etcd() + # Allow failing to read from etcd if we have + # it locally + try: + self.read_values_from_etcd() + except KeyError as e: + pass + return self.config_parser[key]