forked from saltstack-formulas/mysql-formula
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request saltstack-formulas#225 from myii/chore/standardise…
…-structure feat(yamllint): include for this repo and apply rules throughout
- Loading branch information
Showing
10 changed files
with
296 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.