From 1db1287fab534f981b23103030d044871cedcd2b Mon Sep 17 00:00:00 2001 From: David Boucha Date: Thu, 22 Nov 2012 22:30:34 -0700 Subject: [PATCH] Add MySQL to list of returners. Add MySQL to list of returners. Improve formatting of docstring so it looks better in the actual documentation. Add python module requirement --- doc/ref/returners/all/index.rst | 1 + .../returners/all/salt.returners.mysql.rst | 6 ++ salt/returners/{mysql_return.py => mysql.py} | 61 ++++++++++--------- 3 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 doc/ref/returners/all/salt.returners.mysql.rst rename salt/returners/{mysql_return.py => mysql.py} (80%) diff --git a/doc/ref/returners/all/index.rst b/doc/ref/returners/all/index.rst index ebb31f6173..2e626e82e6 100644 --- a/doc/ref/returners/all/index.rst +++ b/doc/ref/returners/all/index.rst @@ -14,3 +14,4 @@ Full list of builtin returner modules cassandra_return mongo_return redis_return + mysql diff --git a/doc/ref/returners/all/salt.returners.mysql.rst b/doc/ref/returners/all/salt.returners.mysql.rst new file mode 100644 index 0000000000..1961c6dfd4 --- /dev/null +++ b/doc/ref/returners/all/salt.returners.mysql.rst @@ -0,0 +1,6 @@ +==================== +salt.returners.mysql +==================== + +.. automodule:: salt.returners.mysql + :members: diff --git a/salt/returners/mysql_return.py b/salt/returners/mysql.py similarity index 80% rename from salt/returners/mysql_return.py rename to salt/returners/mysql.py index d52fef96bc..36b718f8b0 100644 --- a/salt/returners/mysql_return.py +++ b/salt/returners/mysql.py @@ -3,7 +3,7 @@ Return data to a mysql server 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: +config, these are the defaults:: mysql.host: 'salt' mysql.user: 'salt' @@ -11,42 +11,43 @@ config, these are the defaults: mysql.db: 'salt' mysql.port: 3306 -Use the following mysql database schema: +Use the following mysql database schema:: -CREATE DATABASE `salt` - DEFAULT CHARACTER SET utf8 - DEFAULT COLLATE utf8_general_ci; + CREATE DATABASE `salt` + DEFAULT CHARACTER SET utf8 + DEFAULT COLLATE utf8_general_ci; -USE `salt`; + USE `salt`; --- --- Table structure for table `jids` --- + -- + -- Table structure for table `jids` + -- -DROP TABLE IF EXISTS `jids`; -CREATE TABLE `jids` ( - `jid` varchar(255) NOT NULL, - `load` varchar(65000) NOT NULL, - UNIQUE KEY `jid` (`jid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + DROP TABLE IF EXISTS `jids`; + CREATE TABLE `jids` ( + `jid` varchar(255) NOT NULL, + `load` varchar(65000) NOT NULL, + UNIQUE KEY `jid` (`jid`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- --- Table structure for table `salt_returns` --- + -- + -- Table structure for table `salt_returns` + -- -DROP TABLE IF EXISTS `salt_returns`; -CREATE TABLE `salt_returns` ( - `fun` varchar(50) NOT NULL, - `jid` varchar(200) NOT NULL, - `return` mediumtext NOT NULL, - `id` varchar(255) NOT NULL, - `success` varchar(10) NOT NULL, - `full_ret` mediumtext NOT NULL, - KEY `id` (`id`), - KEY `jid` (`jid`), - KEY `fun` (`fun`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; + DROP TABLE IF EXISTS `salt_returns`; + CREATE TABLE `salt_returns` ( + `fun` varchar(50) NOT NULL, + `jid` varchar(200) NOT NULL, + `return` mediumtext NOT NULL, + `id` varchar(255) NOT NULL, + `success` varchar(10) NOT NULL, + `full_ret` mediumtext NOT NULL, + KEY `id` (`id`), + KEY `jid` (`jid`), + KEY `fun` (`fun`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +Required python modules: MySQLdb ''' # Import python libs