From 9f739fa8b448085ecac2b2a41bf90a3ec2c5eded Mon Sep 17 00:00:00 2001
From: Imran Iqbal <iqbalmy@hotmail.com>
Date: Tue, 6 Aug 2019 20:54:25 +0100
Subject: [PATCH] feat(yamllint): include for this repo and apply rules
 throughout

* Semi-automated using `ssf-formula` (v0.5.0)
* Fix (or ignore) errors shown below:

```bash
mysql-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:")
./mysql/osfamilymap.yaml
  4:1       warning  missing document start "---"  (document-start)
  5:6       error    syntax error: found character '%' that cannot start any token
  94:17     error    trailing spaces  (trailing-spaces)
  191:89    error    line too long (90 > 88 characters)  (line-length)

./mysql/defaults.yaml
  3:1       warning  missing document start "---"  (document-start)
  7:4       error    syntax error: found character '%' that cannot start any token
  44:89     error    line too long (93 > 88 characters)  (line-length)
  51:89     error    line too long (111 > 88 characters)  (line-length)
  58:89     error    line too long (104 > 88 characters)  (line-length)
  65:89     error    line too long (103 > 88 characters)  (line-length)
  71:89     error    line too long (95 > 88 characters)  (line-length)
  77:89     error    line too long (102 > 88 characters)  (line-length)
  83:89     error    line too long (101 > 88 characters)  (line-length)
  86:89     error    line too long (95 > 88 characters)  (line-length)
  90:89     error    line too long (95 > 88 characters)  (line-length)

./mysql/supported_sections.yaml
  2:2       error    syntax error: found character '%' that cannot start any token

./mysql/osmap.yaml
  4:4       error    syntax error: found character '%' that cannot start any token
  7:89      error    line too long (96 > 88 characters)  (line-length)
  8:89      error    line too long (97 > 88 characters)  (line-length)

pillar.example
  1:1       warning  missing document start "---"  (document-start)
  36:8      error    wrong indentation: expected 8 but found 7  (indentation)
  77:16     warning  truthy value should be one of [false, true]  (truthy)
  80:13     warning  truthy value should be one of [false, true]  (truthy)
  83:13     warning  truthy value should be one of [false, true]  (truthy)
  85:13     warning  truthy value should be one of [false, true]  (truthy)
  89:13     warning  truthy value should be one of [false, true]  (truthy)
  96:13     warning  truthy value should be one of [false, true]  (truthy)
  112:19    warning  truthy value should be one of [false, true]  (truthy)
  117:17    warning  too few spaces before comment  (comments)
  118:12    warning  truthy value should be one of [false, true]  (truthy)
  119:17    warning  truthy value should be one of [false, true]  (truthy)
  130:25    warning  truthy value should be one of [false, true]  (truthy)
  131:19    warning  truthy value should be one of [false, true]  (truthy)
  153:16    warning  truthy value should be one of [false, true]  (truthy)
  166:14    warning  truthy value should be one of [false, true]  (truthy)
  171:18    warning  truthy value should be one of [false, true]  (truthy)
  172:89    error    line too long (93 > 88 characters)  (line-length)
  175:18    warning  truthy value should be one of [false, true]  (truthy)
  176:89    error    line too long (111 > 88 characters)  (line-length)
  179:18    warning  truthy value should be one of [false, true]  (truthy)
  179:26    warning  missing starting space in comment  (comments)
  180:89    error    line too long (104 > 88 characters)  (line-length)
  183:18    warning  truthy value should be one of [false, true]  (truthy)
  183:26    warning  missing starting space in comment  (comments)
  184:89    error    line too long (103 > 88 characters)  (line-length)
  187:18    warning  truthy value should be one of [false, true]  (truthy)
  187:26    warning  missing starting space in comment  (comments)
  188:89    error    line too long (95 > 88 characters)  (line-length)
  191:18    warning  truthy value should be one of [false, true]  (truthy)
  191:26    warning  missing starting space in comment  (comments)
  192:89    error    line too long (102 > 88 characters)  (line-length)
  195:18    warning  truthy value should be one of [false, true]  (truthy)
  195:26    warning  missing starting space in comment  (comments)
  196:89    error    line too long (101 > 88 characters)  (line-length)
  199:18    warning  truthy value should be one of [false, true]  (truthy)
  199:26    warning  missing starting space in comment  (comments)
  200:89    error    line too long (95 > 88 characters)  (line-length)
  203:18    warning  truthy value should be one of [false, true]  (truthy)
  203:26    warning  missing starting space in comment  (comments)
  204:89    error    line too long (95 > 88 characters)  (line-length)
  207:18    warning  truthy value should be one of [false, true]  (truthy)
  207:26    warning  missing starting space in comment  (comments)
  211:18    warning  truthy value should be one of [false, true]  (truthy)
  211:26    warning  missing starting space in comment  (comments)
  214:1     error    too many blank lines (1 > 0)  (empty-lines)

test/salt/pillar/mysql.sls
  1:1       warning  missing document start "---"  (document-start)
  36:8      error    wrong indentation: expected 8 but found 7  (indentation)
  77:16     warning  truthy value should be one of [false, true]  (truthy)
  80:13     warning  truthy value should be one of [false, true]  (truthy)
  82:13     warning  truthy value should be one of [false, true]  (truthy)
  84:13     warning  truthy value should be one of [false, true]  (truthy)
  88:13     warning  truthy value should be one of [false, true]  (truthy)
  95:13     warning  truthy value should be one of [false, true]  (truthy)
  111:19    warning  truthy value should be one of [false, true]  (truthy)
  152:16    warning  truthy value should be one of [false, true]  (truthy)
  165:14    warning  truthy value should be one of [false, true]  (truthy)
  170:18    warning  truthy value should be one of [false, true]  (truthy)
  171:89    error    line too long (93 > 88 characters)  (line-length)
  174:18    warning  truthy value should be one of [false, true]  (truthy)
  175:89    error    line too long (111 > 88 characters)  (line-length)
  178:18    warning  truthy value should be one of [false, true]  (truthy)
  178:26    warning  missing starting space in comment  (comments)
  179:89    error    line too long (104 > 88 characters)  (line-length)
  182:18    warning  truthy value should be one of [false, true]  (truthy)
  182:26    warning  missing starting space in comment  (comments)
  183:89    error    line too long (103 > 88 characters)  (line-length)
  186:18    warning  truthy value should be one of [false, true]  (truthy)
  186:26    warning  missing starting space in comment  (comments)
  187:89    error    line too long (95 > 88 characters)  (line-length)
  190:18    warning  truthy value should be one of [false, true]  (truthy)
  190:26    warning  missing starting space in comment  (comments)
  191:89    error    line too long (102 > 88 characters)  (line-length)
  194:18    warning  truthy value should be one of [false, true]  (truthy)
  194:26    warning  missing starting space in comment  (comments)
  195:89    error    line too long (101 > 88 characters)  (line-length)
  198:18    warning  truthy value should be one of [false, true]  (truthy)
  198:26    warning  missing starting space in comment  (comments)
  199:89    error    line too long (95 > 88 characters)  (line-length)
  202:18    warning  truthy value should be one of [false, true]  (truthy)
  202:26    warning  missing starting space in comment  (comments)
  203:89    error    line too long (95 > 88 characters)  (line-length)
  206:18    warning  truthy value should be one of [false, true]  (truthy)
  206:26    warning  missing starting space in comment  (comments)
  210:18    warning  truthy value should be one of [false, true]  (truthy)
  210:26    warning  missing starting space in comment  (comments)
  213:1     error    too many blank lines (1 > 0)  (empty-lines)
```
---
 .travis.yml                         | 13 +++--
 .yamllint                           | 18 +++++++
 mysql/defaults.yaml                 | 57 +++++++++++----------
 mysql/map.jinja                     | 70 +++++++++++++++++++++-----
 mysql/osfamilymap.yaml              | 56 ++++++---------------
 mysql/osfingermap.yaml              | 67 +++++++++++++++++++++++++
 mysql/osmap.yaml                    | 26 ++--------
 pillar.example                      | 77 +++++++++++++++++------------
 test/integration/default/inspec.yml |  3 ++
 test/salt/pillar/mysql.sls          | 75 ++++++++++++++++------------
 10 files changed, 296 insertions(+), 166 deletions(-)
 create mode 100644 .yamllint
 create mode 100644 mysql/osfingermap.yaml

diff --git a/.travis.yml b/.travis.yml
index f4d3d87..17291d5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@
 ---
 stages:
   - test
-  - commitlint
+  - lint
   - name: release
     if: branch = master AND type != pull_request
 
@@ -49,16 +49,21 @@ script:
 
 jobs:
   include:
-    # Define the commitlint stage
-    - stage: commitlint
+    # Define the `lint` stage (runs `yamllint` and `commitlint`)
+    - stage: lint
       language: node_js
       node_js: lts/*
       before_install: skip
       script:
+        # Install and run `yamllint`
+        - pip install --user yamllint
+        # yamllint disable-line rule:line-length
+        - yamllint -s . .yamllint pillar.example test/salt/pillar/mysql.sls
+        # Install and run `commitlint`
         - npm install @commitlint/config-conventional -D
         - npm install @commitlint/travis-cli -D
         - commitlint-travis
-    # Define the release stage that runs semantic-release
+    # Define the release stage that runs `semantic-release`
     - stage: release
       language: node_js
       node_js: lts/*
diff --git a/.yamllint b/.yamllint
new file mode 100644
index 0000000..8cee7a4
--- /dev/null
+++ b/.yamllint
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
+# Extend the `default` configuration provided by `yamllint`
+extends: default
+
+# Files to ignore completely
+# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
+# 2. Any YAML files using Jinja (result in `yamllint` syntax errors)
+ignore: |
+  node_modules/
+  mysql/supported_sections.yaml
+
+rules:
+  line-length:
+    # Increase from default of `80`
+    # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
+    max: 88
diff --git a/mysql/defaults.yaml b/mysql/defaults.yaml
index 89c04b2..0e96037 100644
--- a/mysql/defaults.yaml
+++ b/mysql/defaults.yaml
@@ -1,14 +1,10 @@
-# vim: sts=2 ts=2 sw=2 et ai
-#
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 mysql:
   serverpkg: mysql-server
   clientpkg: mysql-client
   service: mysql
-  {%- if grains.pythonversion[0] == 2 %}
-  pythonpkg: python-mysqldb
-  {% else %}
-  pythonpkg: python3-mysqldb
-  {% endif %}
   devpkg: mysql-devel
   debconf_utils: debconf-utils
 
@@ -40,66 +36,77 @@ mysql:
       retries: 2
     products:
       community_server:
-        enabled: True
+        enabled: true
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-8.0.11-macos10.13-x86_64.dmg
         sum: 'md5=602a84390ecf3d82025b1d99fc594124'
-        isapp: False
+        isapp: false
         path: /usr/local/mysql
         app: mysql
       workbench:
-        enabled: True
+        enabled: true
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-workbench-community-8.0.11-rc-macos-x86_64.dmg
         sum: 'md5=37c5ae5bd75a4e1804ae6e0127d68611'
-        isapp: True
+        isapp: true
         path: /Applications/MySQLWorkbench/Contents/Versions/latest
         app: MySQLWorkbench
       cluster:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-macos10.13-x86_64.dmg
         sum: 'md5=0df975908e7d8e4e8c1003d95edf4721'
-        isapp: False
+        isapp: false
         path: /usr/local/mysqlcluster
         app: MySQLCluster
       router:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-router-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=8dd536f2f223933ecbfb8b19e54ee2f6'
-        isapp: False
+        isapp: false
         app: MySQLRouter
       utilities:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-utilities-1.6.5-macos10.12.dmg
         sum: 'md5=4c8e75bb217b8293dcdeb915b649c2c8'
-        isapp: True   ## ??
+        isapp: true   ## ??
         app: MySQLUtilties
       shell:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-shell-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=43db4f0fc39f88c1d7be4a4f52cec363'
-        isapp: True   ## ??
+        isapp: true   ## ??
         app: MySQLShell
       proxy:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-proxy-0.8.5-osx10.7-x86-32bit.tar.gz
         sum: 'md5=107df22412aa8c483d2021e1af24ee22'
       connector:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-connector-nodejs-8.0.11.tar.gz
         sum: 'md5=dece7fe5607918ba68499ef07c31508d'
       forvisualstudio:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-visualstudio-2.0.4-src.zip
         sum: 'md5=fcf39316505ee2921e31a431eae77a9c'
       forexcel:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-excel-1.3.6-src.zip
         sum: 'md5=2cc8b65eb72a1b07a6e4e2665e2a29e3'
       notifier:
-        enabled: False
+        enabled: false
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-notifier-1.1.6-src.zip
         sum: 'md5=349f1994681763fd6626a8ddf6be5363'
 
-  #The following dict names are reserved for pillar data (see pillar.example)
+  # The following dict names are reserved for pillar data (see pillar.example)
   global: {}
   clients: {}
   library: {}
diff --git a/mysql/map.jinja b/mysql/map.jinja
index 5d6bfa8..f4351ac 100644
--- a/mysql/map.jinja
+++ b/mysql/map.jinja
@@ -1,17 +1,61 @@
-{% import_yaml "mysql/defaults.yaml" as defaults %}
-{% import_yaml "mysql/osfamilymap.yaml" as osfamilymap %}
-{% import_yaml "mysql/osmap.yaml" as osmap %}
+# -*- coding: utf-8 -*-
+# vim: ft=jinja
 
-{% set mysql = salt['grains.filter_by'](
-    defaults,
-    merge=salt['grains.filter_by'](
-        osfamilymap,
-        grain='os_family',
+{#- Get the `tplroot` from `tpldir` #}
+{%- set tplroot = tpldir.split('/')[0] %}
+{#- Start imports as #}
+{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
+{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
+{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
+{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
+
+{#- Retrieve the config dict only once #}
+{%- set _config = salt['config.get'](tplroot, default={}) %}
+
+{%- set py_ver_settings = {
+      2: {'pythonpkg': 'python-mysqldb'},
+      3: {'pythonpkg': 'python3-mysqldb'},
+    } %}
+
+{%- set defaults = salt['grains.filter_by'](
+      py_ver_settings,
+      default=grains.pythonversion[0],
+      merge=salt['grains.filter_by'](
+        default_settings,
+        default=tplroot,
         merge=salt['grains.filter_by'](
+          osfamilymap,
+          grain='os_family',
+          merge=salt['grains.filter_by'](
             osmap,
             grain='os',
-            merge=salt['pillar.get']('mysql', {}),
-            ),
-        ),
-    base='mysql',
-) %}
+            merge=salt['grains.filter_by'](
+              osfingermap,
+              grain='osfinger',
+              merge=salt['grains.filter_by'](
+                _config,
+                default='lookup'
+              )
+            )
+          )
+        )
+      )
+    )
+%}
+
+{%- set config = salt['grains.filter_by'](
+      {'defaults': defaults},
+      default='defaults',
+      merge=_config
+    )
+%}
+
+{%- set mysql = config %}
+
+{#- Post-processing for specific non-YAML customisations #}
+{%- if grains.os == 'MacOS' %}
+{%-   set macos_user = salt['pillar.get']('mysql:user', salt['cmd.run']("stat -f '%Su' /dev/console")) %}
+{%-   set macos_group = salt['pillar.get']('mysql:group', salt['cmd.run']("stat -f '%Sg' /dev/console")) %}
+{%-   do mysql.macos.update({'user': macos_user}) %}
+{%-   do mysql.macos.update({'group': macos_group}) %}
+{%- endif %}
diff --git a/mysql/osfamilymap.yaml b/mysql/osfamilymap.yaml
index bde1923..9e032db 100644
--- a/mysql/osfamilymap.yaml
+++ b/mysql/osfamilymap.yaml
@@ -1,15 +1,8 @@
-# vim: sts=2 ts=2 sw=2 et ai
-#
-
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 Debian:
-    {% if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int >= 9 %}
-  serverpkg: mariadb-server
-  service: mariadb
-  clientpkg: mariadb-client
-  devpkg: libmariadbclient-dev
-    {% else %}
   devpkg: libmysqlclient-dev
-    {% endif %}
 
   config:
     sections:
@@ -20,7 +13,7 @@ Debian:
         pid_file: /var/run/mysqld/mysqld.pid
         basedir: /usr
         tmpdir: /tmp
-        lc_messages_dir:  /usr/share/mysql
+        lc_messages_dir: /usr/share/mysql
         skip_external_locking: noarg_present
         bind_address: 127.0.0.1
         key_buffer_size: 16M
@@ -31,9 +24,9 @@ Debian:
         query_cache_size: 16M
         expire_logs_days: 10
         max_binlog_size: 100M
-        #innodb_flush_log_at_trx_commit: 1
-        #innodb_lock_wait_timeout: 50
-        #innodb_file_per_table: noarg_present
+        # innodb_flush_log_at_trx_commit: 1
+        # innodb_lock_wait_timeout: 50
+        # innodb_file_per_table: noarg_present
       mysqldump:
         quick: noarg_present
         quote_names: noarg_present
@@ -42,31 +35,18 @@ Debian:
         key_buffer_size: 16M
     append: |
       !includedir /etc/mysql/conf.d/
-      # {% if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int >= 9 -%}
-      # !includedir /etc/mysql/mariadb.conf.d/
-      # {%- endif %}
 
 RedHat:
-  #https://mariadb.com/blog/rhel7-transition-mysql-mariadb-first-look
-   {%- if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int in [7] %}
-     {% set fork = 'mariadb' %}
-  serverpkg: mariadb-server
-  service: mariadb
-  devpkg: mariadb-devel
-   {%- else %}
-     {% set fork = 'mysql' %}
   service: mysqld
-   {%- endif %}
-
-  clientpkg: {{ fork }}
+  clientpkg: mysql
   pythonpkg: MySQL-python
   config:
     file: /etc/my.cnf
     sections:
       client:
       mysqld_safe:
-        log_error: /var/log/{{ fork }}/mysqld.log
-        pid_file: /var/run/{{ fork }}/mysqld.pid
+        log_error: /var/log/mysql/mysqld.log
+        pid_file: /var/run/mysql/mysqld.pid
       mysqld:
         socket: /var/lib/mysql/mysql.sock
         bind_address: 127.0.0.1
@@ -75,12 +55,7 @@ RedHat:
 Suse:
   serverpkg: mariadb
   clientpkg: mariadb-client
-  {%- if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int == 42 %}
-    # "old" package name up to Leap 42.x
-  pythonpkg: python-PyMySQL
-    {% else %}
   pythonpkg: python2-pymysql
-    {% endif %}
 
   config:
     file: /etc/my.cnf
@@ -91,10 +66,10 @@ Suse:
         port:
         user:
         socket:
-        datadir: 
+        datadir:
         tmpdir:
         innodb_file_format: Barracuda
-        innodb_file_per_table: ON
+        innodb_file_per_table: 'ON'
         server-id: 1
         sql_mode: NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
       mysqld_multi:
@@ -178,7 +153,7 @@ Gentoo:
         default_character_set: utf8
       myisamchk:
         character_sets_dir: /usr/share/mysql/charsets
-        key_buffer: 20M   ##????? key_buffer_size ?
+        key_buffer: 20M   ## ????? key_buffer_size ?
         sort_buffer_size: 20M
         read_buffer: 2M
         write_buffer: 2M
@@ -188,7 +163,8 @@ Gentoo:
         err_log: /var/log/mysql/mysql.err
       mysqld:
         character_set_serverpkg: utf8
-        # note: the gentoo init.d script specifically needs pid-file (dash not underscore)
+        # note: the gentoo init.d script specifically needs pid-file
+        # (dash not underscore)
         pid-file: /var/run/mysqld/mysqld.pid
         log_error: /var/log/mysql/mysqld.err
         basedir: /usr
@@ -217,7 +193,7 @@ Gentoo:
         innodb_lock_wait_timeout: 50
         innodb_file_per_table: noarg_present
       isamchk:
-        key_buffer: 20M   ##????? key_buffer_size ?
+        key_buffer: 20M   ## ????? key_buffer_size ?
         sort_buffer_size: 20M
         read_buffer: 2M
         write_buffer: 2M
diff --git a/mysql/osfingermap.yaml b/mysql/osfingermap.yaml
new file mode 100644
index 0000000..7797a8b
--- /dev/null
+++ b/mysql/osfingermap.yaml
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
+# Debian
+Debian-10:
+  serverpkg: mariadb-server
+  service: mariadb
+  clientpkg: mariadb-client
+  devpkg: libmariadbclient-dev
+  config:
+    append: |
+      !includedir /etc/mysql/conf.d/
+      # !includedir /etc/mysql/mariadb.conf.d/
+Debian-9:
+  serverpkg: mariadb-server
+  service: mariadb
+  clientpkg: mariadb-client
+  devpkg: libmariadbclient-dev
+  config:
+    append: |
+      !includedir /etc/mysql/conf.d/
+      # !includedir /etc/mysql/mariadb.conf.d/
+# Ubuntu
+Ubuntu-18.04:
+  serverpkg: mariadb-server
+  # service: mariadb
+  clientpkg: mariadb-client
+  # devpkg: libmariadbclient-dev
+Ubuntu-16.04:
+  serverpkg: mariadb-server
+  # service: mariadb
+  clientpkg: mariadb-client
+  # devpkg: libmariadbclient-dev
+
+# Redhat
+Redhat-7:
+  # https://mariadb.com/blog/rhel7-transition-mysql-mariadb-first-look
+  serverpkg: mariadb-server
+  service: mariadb
+  clientpkg: mariadb
+  devpkg: mariadb-devel
+  config:
+    sections:
+      mysqld_safe:
+        log_error: /var/log/mariadb/mysqld.log
+        pid_file: /var/run/mariadb/mysqld.pid
+# CentOS
+CentOS Linux-7:
+  # https://mariadb.com/blog/rhel7-transition-mysql-mariadb-first-look
+  serverpkg: mariadb-server
+  service: mariadb
+  clientpkg: mariadb
+  devpkg: mariadb-devel
+  config:
+    sections:
+      mysqld_safe:
+        log_error: /var/log/mariadb/mysqld.log
+        pid_file: /var/run/mariadb/mysqld.pid
+  server_config:
+    sections:
+      mysqld_safe:
+        log_error: /var/log/mariadb/mysqld.log
+        pid_file: /var/run/mariadb/mysqld.pid
+
+# Suse
+Leap-42:
+  pythonpkg: python-PyMySQL
diff --git a/mysql/osmap.yaml b/mysql/osmap.yaml
index 88f1618..c2cf746 100644
--- a/mysql/osmap.yaml
+++ b/mysql/osmap.yaml
@@ -1,13 +1,6 @@
-# vim: ft=sls
-# vim: sts=2 ts=2 sw=2 et ai
-
-  {% if grains.os == 'MacOS' %}
-MacOS:
-  macos:
-    user:  {{ salt['pillar.get']('mysql:user', salt['cmd.run']("stat -f '%Su' /dev/console")) }}
-    group: {{ salt['pillar.get']('mysql:group', salt['cmd.run']("stat -f '%Sg' /dev/console")) }}
-  {% endif %}
-
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 Debian:
   service: mysql
 
@@ -23,22 +16,13 @@ Ubuntu:
       !includedir /etc/mysql/conf.d/
 
 CentOS:
-  # https://mariadb.com/blog/rhel7-transition-mysql-mariadb-first-look
-  {%- if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int in [7] %}
-    {% set fork = 'mariadb' %}
-    {% set service = 'mariadb' %}
-  {%- else %}
-    {% set fork = 'mysql' %}
-    {% set service = 'mysqld' %}
-  {%- endif %}
-
   config_directory: /etc/my.cnf.d/
   server_config:
     file: server.cnf
     sections:
       mysqld_safe:
-        log_error: /var/log/{{ fork }}/mysqld.log
-        pid_file: /var/run/{{ fork }}/mysqld.pid
+        log_error: /var/log/mysql/mysqld.log
+        pid_file: /var/run/mysql/mysqld.pid
       mysqld:
         socket: /var/lib/mysql/mysql.sock
         bind_address: 127.0.0.1
diff --git a/pillar.example b/pillar.example
index 97be825..e2944f9 100644
--- a/pillar.example
+++ b/pillar.example
@@ -1,3 +1,6 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 mysql:
   global:
     client-server:
@@ -33,10 +36,10 @@ mysql:
       binlog_do_db: foo
       auto_increment_increment: 5
       binlog-ignore-db:
-       - mysql
-       - sys
-       - information_schema
-       - performance_schema
+        - mysql
+        - sys
+        - information_schema
+        - performance_schema
     mysql:
       # my.cnf param that not require value
       no-auto-rehash: noarg_present
@@ -74,26 +77,26 @@ mysql:
       collate: utf8_general_ci
     # Delete DB
     - name: obsolete_db
-      present: False
+      present: false
   schema:
     foo:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/foo.schema
     bar:
-      load: False
+      load: false
     baz:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/baz.schema.tmpl
       template: jinja
     qux:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/qux.schema.tmpl
       template: jinja
       context:
         encabulator: Turbo
         girdlespring: differential
     quux:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/qux.schema.tmpl
       template: jinja
       context:
@@ -109,14 +112,14 @@ mysql:
       databases:
         - database: foo
           grants: ['select', 'insert', 'update']
-          escape: True
+          escape: true
         - database: bar
           grants: ['all privileges']
     bob:
       password_hash: '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'
-      host: '%' # Any host
-      ssl: True
-      ssl-X509: True
+      host: '%'  # Any host
+      ssl: true
+      ssl-X509: true
       ssl-SUBJECT: Subject
       ssl-ISSUER: Name
       ssl-CIPHER: Cipher
@@ -127,8 +130,8 @@ mysql:
         # use two '%'
         - database: '`foo\_%%`'
           grants: ['all privileges']
-          grant_option: True
-          escape: False
+          grant_option: true
+          escape: false
         - database: bar
           table: foobar
           grants: ['select', 'insert', 'update', 'delete']
@@ -149,8 +152,8 @@ mysql:
     # Remove a user
     obsoleteuser:
       host: localhost
-      # defaults to True
-      present: False
+      # defaults to true
+      present: false
 
   # Override any names defined in map.jinja
   # serverpkg: mysql-server
@@ -162,53 +165,63 @@ mysql:
 
   # Install MySQL headers
   dev:
-    # Install dev package - defaults to False
-    install: False
+    # Install dev package - defaults to false
+    install: false
 
   macos:
     products:
       community_server:
-        enabled: True    # default
+        enabled: true    # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-8.0.11-macos10.13-x86_64.dmg
         sum: 'md5=602a84390ecf3d82025b1d99fc594124'
       workbench:
-        enabled: True    # default
+        enabled: true    # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-workbench-community-8.0.11-rc-macos-x86_64.dmg
         sum: 'md5=37c5ae5bd75a4e1804ae6e0127d68611'
       cluster:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-macos10.13-x86_64.dmg
         sum: 'md5=0df975908e7d8e4e8c1003d95edf4721'
       router:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-router-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=8dd536f2f223933ecbfb8b19e54ee2f6'
       utilities:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-utilities-1.6.5-macos10.12.dmg
         sum: 'md5=4c8e75bb217b8293dcdeb915b649c2c8'
       shell:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-shell-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=43db4f0fc39f88c1d7be4a4f52cec363'
       proxy:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-proxy-0.8.5-osx10.7-x86-32bit.tar.gz
         sum: 'md5=107df22412aa8c483d2021e1af24ee22'
       connector:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-connector-nodejs-8.0.11.tar.gz
         sum: 'md5=dece7fe5607918ba68499ef07c31508d'
       forvisualstudio:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-visualstudio-2.0.4-src.zip
         sum: 'md5=fcf39316505ee2921e31a431eae77a9c'
       forexcel:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-excel-1.3.6-src.zip
         sum: 'md5=2cc8b65eb72a1b07a6e4e2665e2a29e3'
       notifier:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-notifier-1.1.6-src.zip
         sum: 'md5=349f1994681763fd6626a8ddf6be5363'
-
diff --git a/test/integration/default/inspec.yml b/test/integration/default/inspec.yml
index e8225c4..37a67a2 100644
--- a/test/integration/default/inspec.yml
+++ b/test/integration/default/inspec.yml
@@ -1,3 +1,6 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 name: default
 title: mysql formula
 maintainer: SaltStack Formulas
diff --git a/test/salt/pillar/mysql.sls b/test/salt/pillar/mysql.sls
index 458fa06..17a3124 100644
--- a/test/salt/pillar/mysql.sls
+++ b/test/salt/pillar/mysql.sls
@@ -1,3 +1,6 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
 mysql:
   global:
     client-server:
@@ -33,10 +36,10 @@ mysql:
       binlog_do_db: foo
       auto_increment_increment: 5
       binlog-ignore-db:
-       - mysql
-       - sys
-       - information_schema
-       - performance_schema
+        - mysql
+        - sys
+        - information_schema
+        - performance_schema
     mysql:
       # my.cnf param that not require value
       no-auto-rehash: noarg_present
@@ -74,25 +77,25 @@ mysql:
       collate: utf8_general_ci
     # Delete DB
     - name: obsolete_db
-      present: False
+      present: false
   schema:
     foo:
-      load: False
+      load: false
     bar:
-      load: False
+      load: false
     baz:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/baz.schema.tmpl
       template: jinja
     qux:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/qux.schema.tmpl
       template: jinja
       context:
         encabulator: Turbo
         girdlespring: differential
     quux:
-      load: True
+      load: true
       source: salt://{{ tpldir }}/files/qux.schema.tmpl
       template: jinja
       context:
@@ -108,14 +111,14 @@ mysql:
       databases:
         - database: foo
           grants: ['select', 'insert', 'update']
-          escape: True
+          escape: true
         - database: bar
           grants: ['all privileges']
     # bob:
     #   password_hash: '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'
     #   host: '%' # Any host
-    #   ssl: True
-    #   ssl-X509: True
+    #   ssl: true
+    #   ssl-X509: true
     #   ssl-SUBJECT: Subject
     #   ssl-ISSUER: Name
     #   ssl-CIPHER: Cipher
@@ -126,8 +129,8 @@ mysql:
     #     # use two '%'
     #     - database: '`foo\_%%`'
     #       grants: ['all privileges']
-    #       grant_option: True
-    #       escape: False
+    #       grant_option: true
+    #       escape: false
     #     - database: bar
     #       table: foobar
     #       grants: ['select', 'insert', 'update', 'delete']
@@ -148,8 +151,8 @@ mysql:
     # Remove a user
     obsoleteuser:
       host: localhost
-      # defaults to True
-      present: False
+      # defaults to true
+      present: false
 
   # Override any names defined in map.jinja
   # serverpkg: mysql-server
@@ -161,53 +164,63 @@ mysql:
 
   # Install MySQL headers
   dev:
-    # Install dev package - defaults to False
-    install: False
+    # Install dev package - defaults to false
+    install: false
 
   macos:
     products:
       community_server:
-        enabled: True    # default
+        enabled: true    # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-8.0.11-macos10.13-x86_64.dmg
         sum: 'md5=602a84390ecf3d82025b1d99fc594124'
       workbench:
-        enabled: True    # default
+        enabled: true    # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-workbench-community-8.0.11-rc-macos-x86_64.dmg
         sum: 'md5=37c5ae5bd75a4e1804ae6e0127d68611'
       cluster:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-cluster-gpl-7.6.6-macos10.13-x86_64.dmg
         sum: 'md5=0df975908e7d8e4e8c1003d95edf4721'
       router:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-router-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=8dd536f2f223933ecbfb8b19e54ee2f6'
       utilities:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-utilities-1.6.5-macos10.12.dmg
         sum: 'md5=4c8e75bb217b8293dcdeb915b649c2c8'
       shell:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-shell-8.0.11-macos10.13-x86-64bit.dmg
         sum: 'md5=43db4f0fc39f88c1d7be4a4f52cec363'
       proxy:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-proxy-0.8.5-osx10.7-x86-32bit.tar.gz
         sum: 'md5=107df22412aa8c483d2021e1af24ee22'
       connector:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-connector-nodejs-8.0.11.tar.gz
         sum: 'md5=dece7fe5607918ba68499ef07c31508d'
       forvisualstudio:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-visualstudio-2.0.4-src.zip
         sum: 'md5=fcf39316505ee2921e31a431eae77a9c'
       forexcel:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-for-excel-1.3.6-src.zip
         sum: 'md5=2cc8b65eb72a1b07a6e4e2665e2a29e3'
       notifier:
-        enabled: False  #default
+        enabled: false  # default
+        # yamllint disable-line rule:line-length
         url: https://downloads.mysql.com/archives/get/file/mysql-notifier-1.1.6-src.zip
         sum: 'md5=349f1994681763fd6626a8ddf6be5363'
-
-- 
GitLab