salt.returners.sqlite3

Insert minion return data into a sqlite3 database

maintainer:Mickey Malone <mickey.malone@gmail.com>
maturity:New
depends:None
platform:All

Sqlite3 is a serverless database that lives in a single file. In order to use this returner the database file must exist, have the appropriate schema defined, and be accessible to the user whom the minion process is running as. This returner requires the following values configured in the master or minion config:

returner.sqlite3.database: /usr/lib/salt/salt.db
returner.sqlite3.timeout: 5.0

Alternative configuration values can be used by prefacing the configuration. Any values not found in the alternative configuration will be pulled from the default location:

alternative.returner.sqlite3.database: /usr/lib/salt/salt.db
alternative.returner.sqlite3.timeout: 5.0

Use the commands to create the sqlite3 database and tables:

sqlite3 /usr/lib/salt/salt.db << EOF
--
-- Table structure for table 'jids'
--

CREATE TABLE jids (
  jid TEXT PRIMARY KEY,
  load TEXT NOT NULL
  );

--
-- Table structure for table 'salt_returns'
--

CREATE TABLE salt_returns (
  fun TEXT KEY,
  jid TEXT KEY,
  id TEXT KEY,
  fun_args TEXT,
  date TEXT NOT NULL,
  full_ret TEXT NOT NULL,
  success TEXT NOT NULL
  );
EOF

To use the sqlite returner, append '--return sqlite3' to the salt command.

salt '*' test.ping --return sqlite3

To use the alternative configuration, append '--return_config alternative' to the salt command.

New in version 2015.5.0.

salt '*' test.ping --return sqlite3 --return_config alternative
salt.returners.sqlite3_return.get_fun(fun)

Return a dict of the last function called for all minions

salt.returners.sqlite3_return.get_jid(jid)

Return the information returned from a specified jid

salt.returners.sqlite3_return.get_jids()

Return a list of all job ids

salt.returners.sqlite3_return.get_load(jid)

Return the load from a specified jid

salt.returners.sqlite3_return.get_minions()

Return a list of minions

salt.returners.sqlite3_return.prep_jid(nocache=False, passed_jid=None)

Do any work necessary to prepare a JID, including sending a custom id

salt.returners.sqlite3_return.returner(ret)

Insert minion return data into the sqlite3 database

salt.returners.sqlite3_return.save_load(jid, load)

Save the load to the specified jid