New in version 3006.0.

Implements keyvalue serializer which can be used for serializing or deserializing any file which defines keys and values separated by a common set of characters, such environment files, which are in "KEY=value" format.


param line_ending:

String representation of LF or CRLF to be used for serialization to a file. Defaults to \r\n on Windows and \n on other operating systems.

param quoting:

Boolean flag to determine if values should be quoted (True) during serialization or dequoted (False) during deserialization. Defaults to None (no action).

param separator:

String representing the character(s) used when concatenating or reading key/value pairs. Defaults to =.

A dataset such as:

foo: bar
wang: chung


- [foo, bar]
- [wang, chung]

can be represented as:

exception salt.serializers.keyvalue.DeserializationError(message, line_num=None, buf='', marker='    <======================', trace=None)

Raised when stream of string failed to be deserialized

exception salt.serializers.keyvalue.SerializationError(message='')

Raised when stream of string failed to be serialized


Remove extra quotes around a string.

salt.serializers.keyvalue.deserialize(stream_or_string, **options)

Deserialize any string or stream like object into a Python data structure.

  • stream_or_string -- stream or string to deserialize.

  • options -- options given to the function


Wraps a text around quotes.

{% set my_text = 'my_text' %}
{{ my_text | quote }}

will be rendered as:

salt.serializers.keyvalue.serialize(obj, **options)

Serialize Python data to environment file.

  • obj -- the data structure to serialize

  • options -- options given to the function