This is an automated email from the ASF dual-hosted git repository. not-in-ldap pushed a commit to branch validation in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 2898557b8d0cbe30b4429b71ab7910a766deafbe Author: Tristan Maat <[email protected]> AuthorDate: Thu Sep 7 11:04:17 2017 +0100 context.py: Add user config node validations --- buildstream/context.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/buildstream/context.py b/buildstream/context.py index afc46fe..f9c49e0 100644 --- a/buildstream/context.py +++ b/buildstream/context.py @@ -153,9 +153,23 @@ class Context(): # Load default config # defaults = _yaml.load(_site.default_user_config) + _yaml.validate_node(defaults, [ + 'strict', 'sourcedir', + 'builddir', 'artifactdir', + 'logdir', 'scheduler', + 'artifacts', 'logging' + ]) + if config: self.config_origin = os.path.abspath(config) user_config = _yaml.load(config) + _yaml.validate_node(user_config, [ + 'strict', 'sourcedir', + 'builddir', 'artifactdir', + 'logdir', 'scheduler', + 'artifacts', 'logging' + ]) + _yaml.composite(defaults, user_config, typesafe=True) self.strict_build_plan = _yaml.node_get(defaults, bool, 'strict') @@ -171,12 +185,18 @@ class Context(): # Load artifact share configuration artifacts = _yaml.node_get(defaults, Mapping, 'artifacts') + _yaml.validate_node(artifacts, ['pull-url', 'push-url', 'push-port']) self.artifact_pull = _yaml.node_get(artifacts, str, 'pull-url', default_value='') or None self.artifact_push = _yaml.node_get(artifacts, str, 'push-url', default_value='') or None self.artifact_push_port = _yaml.node_get(artifacts, int, 'push-port', default_value=22) # Load logging config logging = _yaml.node_get(defaults, Mapping, 'logging') + _yaml.validate_node(logging, [ + 'key-length', 'verbose', + 'error-lines', 'message-lines', + 'debug', 'element-format' + ]) self.log_key_length = _yaml.node_get(logging, int, 'key-length') self.log_debug = _yaml.node_get(logging, bool, 'debug') self.log_verbose = _yaml.node_get(logging, bool, 'verbose') @@ -186,6 +206,10 @@ class Context(): # Load scheduler config scheduler = _yaml.node_get(defaults, Mapping, 'scheduler') + _yaml.validate_node(scheduler, [ + 'on-error', 'fetchers', 'builders', + 'pushers', 'network-retries' + ]) self.sched_error_action = _yaml.node_get(scheduler, str, 'on-error') self.sched_fetchers = _yaml.node_get(scheduler, int, 'fetchers') self.sched_builders = _yaml.node_get(scheduler, int, 'builders')
