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
commit0ca0b25605ebf943945690ef151e6fae6e917edb (patch)
treebdfeafcf547f11e8dd35ce542aa581ce09a51d3e
parent7fe1f1ecd84caa3a7c3b82f8b21d5fca790888e6 (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