summaryrefslogtreecommitdiff
path: root/src/buildstream/_workspaces.py
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-09 14:22:35 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:02 +0000
commitfcef3658433f74a2f396ed353bb3534f0001f3d8 (patch)
treea3c74347254332f06583fbdc1c6a6fc4411d21aa /src/buildstream/_workspaces.py
parentf6616bc9d51a791aba1e177c61e27f768bebd9cb (diff)
downloadbuildstream-fcef3658433f74a2f396ed353bb3534f0001f3d8.tar.gz
_yaml: add 'get_mapping()' to MappingNode
This allows to get a mapping node from another 'MappingNode', replacing 'node_get(my_mapping, key, type=dict)' Also changes all places where 'node_get' was called like that by the new API.
Diffstat (limited to 'src/buildstream/_workspaces.py')
-rw-r--r--src/buildstream/_workspaces.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/buildstream/_workspaces.py b/src/buildstream/_workspaces.py
index 9fbfb7e63..1adc52ac2 100644
--- a/src/buildstream/_workspaces.py
+++ b/src/buildstream/_workspaces.py
@@ -606,8 +606,7 @@ class Workspaces():
}
elif 1 <= version <= BST_WORKSPACE_FORMAT_VERSION:
- workspaces = _yaml.node_get(workspaces, dict, "workspaces",
- default_value=_yaml.new_empty_node())
+ workspaces = workspaces.get_mapping("workspaces", default={})
res = {element: self._load_workspace(node)
for element, node in _yaml.node_items(workspaces)}
@@ -635,7 +634,7 @@ class Workspaces():
'path': _yaml.node_get(node, str, 'path'),
'last_successful': _yaml.node_get(node, str, 'last_successful', default_value=None),
'running_files': _yaml.node_sanitize(
- _yaml.node_get(node, dict, 'running_files', default_value=None),
+ node.get_mapping('running_files', default=None),
dict_type=dict),
}
return Workspace.from_dict(self._toplevel_project, dictionary)