From e9d52cb97d619a76355c5aa1d03b733c125c0f22 Mon Sep 17 00:00:00 2001 From: Maximilian Meister Date: Thu, 3 May 2018 15:52:23 +0200 Subject: [PATCH] enable passing a unix_socket for mysql returners (bsc#1091371) quick fix for: https://bugzilla.suse.com/show_bug.cgi?id=1091371 the upstream patch will go through some bigger refactoring of the mysql drivers to be cleaner this patch should only be temporary and can be dropped again once the refactor is done upstream Signed-off-by: Maximilian Meister --- salt/returners/mysql.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/returners/mysql.py b/salt/returners/mysql.py index 67b44004ac..a220f11465 100644 --- a/salt/returners/mysql.py +++ b/salt/returners/mysql.py @@ -17,6 +17,7 @@ config. These are the defaults: mysql.pass: 'salt' mysql.db: 'salt' mysql.port: 3306 + mysql.unix_socket: '/tmp/mysql.sock' SSL is optional. The defaults are set to None. If you do not want to use SSL, either exclude these options or set them to None. @@ -42,6 +43,7 @@ optional. The following ssl options are simply for illustration purposes: alternative.mysql.ssl_ca: '/etc/pki/mysql/certs/localhost.pem' alternative.mysql.ssl_cert: '/etc/pki/mysql/certs/localhost.crt' alternative.mysql.ssl_key: '/etc/pki/mysql/certs/localhost.key' + alternative.mysql.unix_socket: '/tmp/mysql.sock' Should you wish the returner data to be cleaned out every so often, set `keep_jobs_seconds` to the number of hours for the jobs to live in the @@ -197,6 +199,7 @@ def _get_options(ret=None): "ssl_ca": None, "ssl_cert": None, "ssl_key": None, + "unix_socket": "/tmp/mysql.sock", } attrs = { @@ -208,6 +211,7 @@ def _get_options(ret=None): "ssl_ca": "ssl_ca", "ssl_cert": "ssl_cert", "ssl_key": "ssl_key", + "unix_socket": "unix_socket", } _options = salt.returners.get_returner_options( @@ -266,6 +270,7 @@ def _get_serv(ret=None, commit=False): db=_options.get("db"), port=_options.get("port"), ssl=ssl_options, + unix_socket=_options.get("unix_socket"), ) try: -- 2.39.2