consul

Minion data cache plugin for Consul key/value data store.

Added in version 2016.11.2.

Changed in version 3005: Timestamp/cache updated support added.

depends:

python-consul >= 0.2.0

It is up to the system administrator to set up and configure the Consul infrastructure. All is needed for this plugin is a working Consul agent with a read-write access to the key-value store.

The related documentation can be found in the Consul documentation.

To enable this cache plugin, the master will need the python client for Consul installed. This can be easily installed with pip:

pip install python-consul

Optionally, depending on the Consul agent configuration, the following values could be set in the master config. These are the defaults:

consul.host: 127.0.0.1
consul.port: 8500
consul.token: None
consul.scheme: http
consul.consistency: default
consul.dc: dc1
consul.verify: True
consul.timestamp_suffix: .tstamp  # Added in 3005.0

In order to bring the cache APIs into conformity, in 3005.0 timestamp information gets stored as a separate {key}.tstamp key/value. If your existing functionality depends on being able to store normal keys with the .tstamp suffix, override the consul.timestamp_suffix default config.

Related docs could be found in the python-consul documentation.

To use the consul as a minion data cache backend, set the master cache config value to consul:

cache: consul
saltext.consul.cache.consul.__virtual__()[source]

Confirm this python-consul package is installed

saltext.consul.cache.consul.store(bank, key, data)[source]

Store a key value.

saltext.consul.cache.consul.fetch(bank, key)[source]

Fetch a key value.

saltext.consul.cache.consul.flush(bank, key=None)[source]

Remove the key from the cache bank with all the key content.

saltext.consul.cache.consul.list_(bank)[source]

Return an iterable object containing all entries stored in the specified bank.

saltext.consul.cache.consul.contains(bank, key)[source]

Checks if the specified bank contains the specified key.

saltext.consul.cache.consul.updated(bank, key)[source]

Return the Unix Epoch timestamp of when the key was last updated. Return None if key is not found.