Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 803 Bytes

parseyaml.markdown

File metadata and controls

43 lines (32 loc) · 803 Bytes
layout title published
default
parseyaml
true

[%CFEngine_function_prototype(yaml_data)%]

Description: Parses YAML data directly from an inlined string and returns the result as a data variable

[%CFEngine_function_attributes(yaml_data)%]

Please note that it's usually most convenient to use single quotes for the string (CFEngine allows both types of quotes around a string).

Example:

vars:

  "loadthis"

  data =>  parseyaml('
- arrayentry1
- arrayentry2
- key1: 1
  key2: 2
');

  # inline syntax since 3.7
  # note the --- preamble is required with inline data
  "loadthis_inline"

  data =>  '---
- arrayentry1
- arrayentry2
- key1: 1
  key2: 2
';

See also: readjson(), readyaml(), mergedata(), Inline YAML and JSON data, and data documentation.