22.15.1.1. salt.serializers

22.15.1.1.1. salt.utils.aggregation

This library allows to introspect dataset and aggregate nodes when it is instructed.

Note

The following examples with be expressed in YAML for convenience sake:

  • !aggr-scalar will refer to Scalar python function
  • !aggr-map will refer to Map python object
  • !aggr-seq will refer for Sequence python object

22.15.1.1.1.1. How to instructs merging

This yaml document have duplicate keys:

foo: !aggr-scalar first
foo: !aggr-scalar second
bar: !aggr-map {first: foo}
bar: !aggr-map {second: bar}
baz: !aggr-scalar 42

but tagged values instruct salt that overlapping values they can be merged together:

foo: !aggr-seq [first, second]
bar: !aggr-map {first: foo, second: bar}
baz: !aggr-seq [42]

22.15.1.1.1.2. Default merge strategy is keep untouched

For example, this yaml document have still duplicate keys, but does not instruct aggregation:

foo: first
foo: second
bar: {first: foo}
bar: {second: bar}
baz: 42

So the late found values prevail:

foo: second
bar: {second: bar}
baz: 42

22.15.1.1.1.3. Limitations

Aggregation is permitted between tagged objects that share the same type. If not, the default merge strategy prevails.

For example, these examples:

foo: {first: value}
foo: !aggr-map {second: value}

bar: !aggr-map {first: value}
bar: 42

baz: !aggr-seq [42]
baz: [fail]

qux: 42
qux: !aggr-scalar fail

are interpreted like this:

foo: !aggr-map{second: value}

bar: 42

baz: [fail]

qux: !aggr-seq [fail]

22.15.1.1.1.4. Introspection

TODO: write this part

salt.utils.aggregation.aggregate(obj_a, obj_b, level=False, map_class=<class 'salt.utils.aggregation.Map'>, sequence_class=<class 'salt.utils.aggregation.Sequence'>)

Merge obj_b into obj_a.

>>> aggregate('first', 'second', True) == ['first', 'second']
True
class salt.utils.aggregation.Aggregate

Aggregation base.

class salt.utils.aggregation.Map(*args, **kwds)

Map aggregation.

salt.utils.aggregation.Scalar(obj)

Shortcut for Sequence creation

>>> Scalar('foo') == Sequence(['foo'])
True
class salt.utils.aggregation.Sequence

Sequence aggregation.

Docs for previous releases are available on salt.rtfd.org.

Latest Salt release: 2014.1.13

Try the shiny new release candidate of Salt, v2014.7.0rc6! More info here.

Table Of Contents

Previous topic

22.15. Salt code and internals

Next topic

22.15.1.2. Exceptions

SaltStack News

Upcoming SaltStack events, webinars and local meet ups and user groups.