summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-04-02 15:25:35 +0200
committerCarl Hetherington <cth@carlh.net>2020-04-02 15:25:35 +0200
commitb55f5b1fe5a331c7d7c289fc315196bc8ac02c3a (patch)
treebdfeafcf547f11e8dd35ce542aa581ce09a51d3e
parent42dbd35840cd734d4b73f0c9d49f401706322938 (diff)
Change option_defaults to being a plain dict rather than a method.
-rwxr-xr-xcdist8
1 files changed, 7 insertions, 1 deletions
diff --git a/cdist b/cdist
index 39568d6..9ce04b4 100755
--- a/cdist
+++ b/cdist
@@ -934,7 +934,13 @@ class Tree(object):
def add_defaults(self, options):
"""Add the defaults from this into a dict options"""
if 'option_defaults' in self.cscript:
- for k, v in self.cscript['option_defaults']().items():
+ from_cscript = self.cscript['option_defaults']
+ if isinstance(from_cscript, dict):
+ defaults_dict = from_cscript
+ else:
+ log("Deprecated cscript option_defaults method; replace with a dict")
+ defaults_dict = from_cscript()
+ for k, v in default_dict.items():
if not k in options:
options[k] = v