diff options
author | Benjamin Schubert <contact@benschubert.me> | 2019-06-10 07:51:57 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-15 14:14:02 +0000 |
commit | 38671fb53f4522d046bed94699db8cc344ac2862 (patch) | |
tree | dc75c432d897d393d3a568290d45d762c7bde093 /src/buildstream/_workspaces.py | |
parent | fcef3658433f74a2f396ed353bb3534f0001f3d8 (diff) | |
download | buildstream-38671fb53f4522d046bed94699db8cc344ac2862.tar.gz |
_yaml: Add 'as_str()' on ScalarNode and 'get_scalar()' on MappingNode
- 'get_scalar()' allows retrieving a scalar node from a mapping.
- 'as_str()' casts a ScalarNode into a string (thus removing the node
information).
Both together, those replace 'node_get(mapping, key, type=str)' but
also allow retrieving the 'Node' itself, which will allow in the future
lazier provenance computation.
Diffstat (limited to 'src/buildstream/_workspaces.py')
-rw-r--r-- | src/buildstream/_workspaces.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/_workspaces.py b/src/buildstream/_workspaces.py index 1adc52ac2..a4f7abc76 100644 --- a/src/buildstream/_workspaces.py +++ b/src/buildstream/_workspaces.py @@ -631,8 +631,8 @@ class Workspaces(): def _load_workspace(self, node): dictionary = { 'prepared': _yaml.node_get(node, bool, 'prepared', default_value=False), - 'path': _yaml.node_get(node, str, 'path'), - 'last_successful': _yaml.node_get(node, str, 'last_successful', default_value=None), + 'path': node.get_str('path'), + 'last_successful': node.get_str('last_successful', default=None), 'running_files': _yaml.node_sanitize( node.get_mapping('running_files', default=None), dict_type=dict), |