Correctly throw an error if a required setting is missing.
authorCarl Hetherington <cth@carlh.net>
Sat, 18 Jun 2016 21:40:01 +0000 (22:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 18 Jun 2016 21:40:01 +0000 (22:40 +0100)
cdist

diff --git a/cdist b/cdist
index cf42ee7578e88c0520af98ca86fa1ef64d537b22..3aa09a3c62fd2e55e4e9a276b55719ab879221f7 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -121,10 +121,10 @@ class Config:
     def get(self, k):
         for o in self.options:
             if o.key == k:
+                if o.value is None:
+                    raise Error('Required setting %s not found' % k)
                 return o.value
 
-        raise Error('Required setting %s not found' % k)
-
     def set(self, k, v):
         for o in self.options:
             o.offer(k, v)