Commit 658c5101 authored by Phillip Smyth's avatar Phillip Smyth
Browse files

_project.py: Validate nodes early in Project._load

_project.py: Added validate_nodes() helper function to prevent duplicate lists

element-path was being used before node validation resulting in uncaught errors
parent 7ce6581b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -402,6 +402,18 @@ class Project():
                "Project requested format version {}, but BuildStream {}.{} only supports up until format version {}"
                .format(format_version, major, minor, BST_FORMAT_VERSION))

        _yaml.node_validate(pre_config_node, [
            'format-version',
            'element-path', 'variables',
            'environment', 'environment-nocache',
            'split-rules', 'elements', 'plugins',
            'aliases', 'name',
            'artifacts', 'options',
            'fail-on-overlap', 'shell', 'fatal-warnings',
            '(@)', 'sources',
            'ref-storage', 'sandbox', 'mirrors', 'remote-execution'
        ])

        # FIXME:
        #
        #   Performing this check manually in the absense