salt.returners.mysql

Return data to a mysql server

maintainer:Dave Boucha <dave@saltstack.com>, Seth House <shouse@saltstack.com>
maturity:new
depends:python-mysqldb
platform:all

To enable this returner the minion will need the python client for mysql installed and the following values configured in the minion or master config, these are the defaults:

mysql.host: 'salt'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306

Use the following mysql database schema:

CREATE DATABASE  `salt`
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

USE `salt`;

--
-- Table structure for table `jids`
--

DROP TABLE IF EXISTS `jids`;
CREATE TABLE `jids` (
  `jid` varchar(255) NOT NULL,
  `load` mediumtext NOT NULL,
  UNIQUE KEY `jid` (`jid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Table structure for table `salt_returns`
--

DROP TABLE IF EXISTS `salt_returns`;
CREATE TABLE `salt_returns` (
  `fun` varchar(50) NOT NULL,
  `jid` varchar(255) NOT NULL,
  `return` mediumtext NOT NULL,
  `id` varchar(255) NOT NULL,
  `success` varchar(10) NOT NULL,
  `full_ret` mediumtext NOT NULL,
  `alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  KEY `id` (`id`),
  KEY `jid` (`jid`),
  KEY `fun` (`fun`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Required python modules: MySQLdb

To use the mysql returner, append '--return mysql' to the salt command. ex:

salt '*' test.ping --return mysql
salt.returners.mysql.get_fun(fun)

Return a dict of the last function called for all minions

salt.returners.mysql.get_jid(jid)

Return the information returned when the specified job id was executed

salt.returners.mysql.get_jids()

Return a list of all job ids

salt.returners.mysql.get_load(jid)

Return the load data that marks a specified jid

salt.returners.mysql.get_minions()

Return a list of minions

salt.returners.mysql.prep_jid(nocache, passed_jid=None)

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

salt.returners.mysql.returner(ret)

Return data to a mysql server

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

Save the load to the specified jid id