salt.thorium.reg

Populate and manage the Thorium register.

Thorium formulas usually start here. The reg states collect fields from matching events and store them in memory so later check, calc, or action states can make decisions based on more than one event.

salt.thorium.reg.clear(name)

Clear the namespace from the register

USAGE:

clearns:
  reg.clear:
    - name: myregister
salt.thorium.reg.delete(name)

Delete the namespace from the register

USAGE:

deletens:
  reg.delete:
    - name: myregister
salt.thorium.reg.list_(name, add, match, stamp=False, prune=0)

Add the specified values to the named list.

If stamp is True, then the timestamp from the event will also be added if prune is set to an integer higher than 0, then only the last prune values will be kept in the list.

Use this form when you want a recent history of matching events rather than a de-duplicated set.

USAGE:

foo:
  reg.list:
    - add: bar
    - match: my/custom/event
    - stamp: True

deploy_failures:
  reg.list:
    - add:
      - id
      - reason
    - match: acme/deploy/failed
    - stamp: True
    - prune: 10
salt.thorium.reg.mean(name, add, match)

Accept a numeric value from the matched events and store a running average of the values in the given register. If the specified value is not numeric it will be skipped

USAGE:

foo:
  reg.mean:
    - add: data_field
    - match: my/custom/event
salt.thorium.reg.set_(name, add, match)

Add a value to the named set.

Use this when you want a unique collection of values, such as the set of minion IDs or object names seen in matching events.

USAGE:

foo:
  reg.set:
    - add: bar
    - match: my/custom/event

seen_minions:
  reg.set:
    - add: id
    - match: acme/custom/event