diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-11-02 17:03:44 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-11-30 17:48:56 +0000 |
commit | 3f559f2a295fd903f72e553485d781e01a1784e6 (patch) | |
tree | e9e48f9a7f6664723f3816265556ac56a457b362 /buildstream/_options | |
parent | 05e94fa0f5342d91233e5aa2dd978cfa42b8a2f9 (diff) | |
download | buildstream-3f559f2a295fd903f72e553485d781e01a1784e6.tar.gz |
Issue #142: Ensure we don't append provenances twice
Diffstat (limited to 'buildstream/_options')
-rw-r--r-- | buildstream/_options/optionpool.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/buildstream/_options/optionpool.py b/buildstream/_options/optionpool.py index 41990ce4a..f38682aec 100644 --- a/buildstream/_options/optionpool.py +++ b/buildstream/_options/optionpool.py @@ -233,12 +233,19 @@ class OptionPool(): expression, value = tuples[0] try: - if self.evaluate(expression): - _yaml.composite(node, value) + apply_fragment = self.evaluate(expression) except LoadError as e: # Prepend the provenance of the error raise LoadError(e.reason, "{}: {}".format(p, e)) from e + if not hasattr(value, 'get'): + raise LoadError(LoadErrorReason.ILLEGAL_COMPOSITE, + "{}: Only values of type 'dict' can be composed.".format(p)) + + # Apply the yaml fragment if its condition evaluates to true + if apply_fragment: + _yaml.composite(node, value) + return True return False |