diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..42a5375 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: Commitlint +'on': [pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v1 diff --git a/.gitignore b/.gitignore index 7715275..6995110 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,122 @@ -*.pyc -*~ -Gemfile.lock -.kitchen/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a packager +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.kitchen +.kitchen.local.yml +kitchen.local.yml +junit-*.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# Bundler +.bundle/ + +# copied `.md` files used for conversion to `.rst` using `m2r` +docs/*.md + +# Vim +*.sw? + +## Collected when centralising formulas (check and sort) +# `collectd-formula` +.pytest_cache/ +/.idea/ +Dockerfile.*_* +ignore/ +tmp/ diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml deleted file mode 100644 index f6c458a..0000000 --- a/.kitchen.docker.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -driver: - name: docker - hostname: salt-formula.ci.local - use_sudo: true - require_chef_omnibus: false diff --git a/.kitchen.yml b/.kitchen.yml deleted file mode 100644 index b7ac9f4..0000000 --- a/.kitchen.yml +++ /dev/null @@ -1,31 +0,0 @@ -<% -require 'yaml' - -formula = YAML.load_file('FORMULA') -formula_name = formula['name'] -%> ---- -verifier: - name: inspec - -platforms: - - name: ubuntu-16.04 - - name: ubuntu-18.04 - - name: debian-9 - - name: centos-7 - -provisioner: - name: salt_solo - salt_install: bootstrap - salt_bootstrap_url: https://bootstrap.saltstack.com - salt_version: latest - salt_pillar_root: pillar.example - log_level: <%= ENV['SALT_DEBUG_LEVEL'] || 'info' %> - formula: <%= formula_name %> - state_top: - base: - '*': - - <%= formula_name %> - -suites: - - name: default diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0efdb51 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +default_stages: [commit] +repos: + - repo: https://github.com/dafyddj/commitlint-pre-commit-hook + rev: v2.3.0 + hooks: + - id: commitlint + name: Check commit message using commitlint + description: Lint commit message against @commitlint/config-conventional rules + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + - id: commitlint-travis + stages: [manual] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + always_run: true + - repo: https://github.com/adithyabsk/mirrors-rubocop + rev: v0.91.0 + hooks: + - id: rubocop + name: Check Ruby files with rubocop + args: [--debug] + always_run: true + pass_filenames: false + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 2.1.3 + hooks: + - id: shellcheck + name: Check shell scripts with shellcheck + files: ^.*\.(sh|bash|ksh)$ + types: [] + args: [] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.23.0 + hooks: + - id: yamllint + name: Check YAML syntax with yamllint + args: [--strict, '.'] + always_run: true + pass_filenames: false + - repo: https://github.com/warpnet/salt-lint + rev: v0.3.0 + hooks: + - id: salt-lint + name: Check Salt files using salt-lint + files: ^.*\.(sls|jinja|j2|tmpl|tst)$ + - repo: https://github.com/myint/rstcheck + rev: 3f929574 + hooks: + - id: rstcheck + name: Check reST files using rstcheck + exclude: 'docs/CHANGELOG.rst' + args: [--report=warning] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 0000000..05856dc --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,3 @@ +[rstcheck] +report=error +ignore_language=rst diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..7fd75ac --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# General overrides used across formulas in the org +Layout/LineLength: + # Increase from default of `80` + # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) + Max: 88 +Metrics/BlockLength: + ExcludedMethods: + - control + - describe + # Increase from default of `25` + Max: 30 + +# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` diff --git a/.salt-lint b/.salt-lint new file mode 100644 index 0000000..5fc3906 --- /dev/null +++ b/.salt-lint @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +exclude_paths: [] +rules: {} +skip_list: + # TODO: Formula-specific override to remove eventually + # A lot of attention is going to be needed to resolve the existing long lines + - 204 # Lines should be no longer that 160 chars + # Using `salt-lint` for linting other files as well, such as Jinja macros/templates + - 205 # Use ".sls" as a Salt State file extension + # Skipping `207` and `208` because `210` is sufficient, at least for the time-being + # I.e. Allows 3-digit unquoted codes to still be used, such as `644` and `755` + - 207 # File modes should always be encapsulated in quotation marks + - 208 # File modes should always contain a leading zero +tags: [] +verbosity: 1 diff --git a/.travis.yml b/.travis.yml index 37ac9e4..64cb372 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,143 @@ -language: ruby +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +## Machine config +os: 'linux' +arch: 'amd64' +dist: 'bionic' +version: '~> 1.0' -rvm: - - 2.2.5 +## Language and cache config +language: 'ruby' +cache: 'bundler' -sudo: required -services: docker - -env: - matrix: - - INSTANCE=default-ubuntu-1604 - - INSTANCE=default-ubuntu-1804 - - INSTANCE=default-debian-9 - - INSTANCE=centos-7 - -# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142455888 -before_script: sudo iptables -L DOCKER || sudo iptables -N DOCKER - -install: - # setup ci for test formula - - export BUNDLE_GEMFILE=$PWD/Gemfile - - bundle install +## Services config +services: + - docker +## Script to run for the test stage script: - # Run unit tests - - KITCHEN_LOCAL_YAML=.kitchen.docker.yml bundle exec kitchen verify ${INSTANCE} + - bin/kitchen verify "${INSTANCE}" + +## Stages and jobs matrix +stages: + - test + - name: 'release' + if: 'branch = master AND type != pull_request' +jobs: + include: + ## Define the test stage that runs the linters (and testing matrix, if applicable) + + # Run all of the linters in a single job + - language: 'node_js' + node_js: 'lts/*' + env: 'Lint' + name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' + before_install: 'skip' + script: + # Install and run `salt-lint` + - pip install --user salt-lint + - git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst' + | xargs salt-lint + # Install and run `yamllint` + # Need at least `v1.17.0` for the `yaml-files` setting + - pip install --user yamllint>=1.17.0 + - yamllint -s . + # Install and run `rubocop` + - gem install rubocop + - rubocop -d + # Run `shellcheck` (already pre-installed in Travis) + - shellcheck --version + - git ls-files -- '*.sh' '*.bash' '*.ksh' + | xargs shellcheck + # Install and run `commitlint` + - npm i -D @commitlint/config-conventional + @commitlint/travis-cli + - commitlint-travis + + # Run `pre-commit` linters in a single job + - language: 'python' + env: 'Lint_pre-commit' + name: 'Lint: pre-commit' + before_install: 'skip' + cache: + directories: + - $HOME/.cache/pre-commit + script: + # Install and run `pre-commit` + - pip install pre-commit==2.7.1 + - pre-commit run --all-files --color always --verbose + - pre-commit run --color always --hook-stage manual --verbose commitlint-travis + + ## Define the rest of the matrix based on Kitchen testing + # Make sure the instances listed below match up with + # the `platforms` defined in `kitchen.yml` + - env: INSTANCE=default-debian-10-master-py3 + - env: INSTANCE=default-ubuntu-2004-master-py3 + # - env: INSTANCE=default-ubuntu-1804-master-py3 + # - env: INSTANCE=default-centos-8-master-py3 + # - env: INSTANCE=default-fedora-32-master-py3 + # - env: INSTANCE=default-fedora-31-master-py3 + # - env: INSTANCE=default-opensuse-leap-152-master-py3 + # - env: INSTANCE=default-amazonlinux-2-master-py3 + # - env: INSTANCE=default-debian-10-3000-3-py3 + - env: INSTANCE=default-debian-9-3000-3-py3 + - env: INSTANCE=default-ubuntu-1804-3000-3-py3 + # - env: INSTANCE=default-centos-8-3000-3-py3 + # - env: INSTANCE=default-centos-7-3000-3-py3 + # - env: INSTANCE=default-fedora-31-3000-3-py3 + # - env: INSTANCE=default-opensuse-leap-152-3000-3-py3 + # - env: INSTANCE=default-amazonlinux-2-3000-3-py3 + # - env: INSTANCE=default-ubuntu-1804-3000-3-py2 + # - env: INSTANCE=default-ubuntu-1604-3000-3-py2 + # - env: INSTANCE=default-arch-base-latest-3000-3-py2 + # - env: INSTANCE=default-debian-10-2019-2-py3 + # - env: INSTANCE=default-debian-9-2019-2-py3 + # - env: INSTANCE=default-ubuntu-1804-2019-2-py3 + - env: INSTANCE=default-ubuntu-1604-2019-2-py3 + # - env: INSTANCE=default-centos-8-2019-2-py3 + # - env: INSTANCE=default-centos-7-2019-2-py3 + # - env: INSTANCE=default-fedora-31-2019-2-py3 + # - env: INSTANCE=default-opensuse-leap-152-2019-2-py3 + # - env: INSTANCE=default-amazonlinux-2-2019-2-py3 + # - env: INSTANCE=default-centos-6-2019-2-py2 + # - env: INSTANCE=default-amazonlinux-1-2019-2-py2 + # - env: INSTANCE=default-arch-base-latest-2019-2-py2 + + ## Define the release stage that runs `semantic-release` + - stage: 'release' + language: 'node_js' + node_js: 'lts/*' + env: 'Release' + name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA' + before_install: 'skip' + script: + # Update `AUTHORS.md` + - export MAINTAINER_TOKEN=${GH_TOKEN} + - go get github.com/myii/maintainer + - maintainer contributor + + # Install all dependencies required for `semantic-release` + - npm i -D @semantic-release/changelog@3 + @semantic-release/exec@3 + @semantic-release/git@7 + deploy: + provider: 'script' + # Opt-in to `dpl v2` to complete the Travis build config validation (beta) + # * https://docs.travis-ci.com/user/build-config-validation + # Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default + edge: true + # Run `semantic-release` + script: 'npx semantic-release@15.14' + +# Notification options: `always`, `never` or `change` +notifications: + webhooks: + if: 'repo = saltstack-formulas/mysql-formula' + urls: + - https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fmysql-formula&ignore_pull_requests=true + on_success: always # default: always + on_failure: always # default: always + on_start: always # default: never + on_cancel: always # default: always + on_error: always # default: always diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..1d467f2 --- /dev/null +++ b/.yamllint @@ -0,0 +1,38 @@ +# -*- 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 SLS files under directory `test/`, which are actually state files +# 3. Any YAML files under directory `.kitchen/`, introduced during local testing +# 4. Any YAML files using Jinja (result in `yamllint` syntax errors) +ignore: | + node_modules/ + test/**/states/**/*.sls + .kitchen/ + mysql/supported_sections.yaml + +yaml-files: + # Default settings + - '*.yaml' + - '*.yml' + - .salt-lint + - .yamllint + # SaltStack Formulas additional settings + - '*.example' + - test/**/*.sls + +rules: + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + line-length: + # Increase from default of `80` + # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) + max: 88 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..4f86729 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,88 @@ +# Authors + +This list is sorted by the number of commits per contributor in _descending_ order. + +Avatar|Contributor|Contributions +:-:|---|:-: +@myii|[@myii](https://github.com/myii)|65 +@gravyboat|[@gravyboat](https://github.com/gravyboat)|38 +@aboe76|[@aboe76](https://github.com/aboe76)|37 +@nmadhok|[@nmadhok](https://github.com/nmadhok)|28 +@whiteinge|[@whiteinge](https://github.com/whiteinge)|27 +@noelmcloughlin|[@noelmcloughlin](https://github.com/noelmcloughlin)|18 +@alxwr|[@alxwr](https://github.com/alxwr)|14 +@cheuschober|[@cheuschober](https://github.com/cheuschober)|11 +@babilen5|[@babilen5](https://github.com/babilen5)|11 +@pprkut|[@pprkut](https://github.com/pprkut)|9 +@techhat|[@techhat](https://github.com/techhat)|7 +@roock|[@roock](https://github.com/roock)|6 +@Routhinator|[@Routhinator](https://github.com/Routhinator)|5 +@puneetk|[@puneetk](https://github.com/puneetk)|5 +@davidjb|[@davidjb](https://github.com/davidjb)|5 +@xenophonf|[@xenophonf](https://github.com/xenophonf)|4 +@thatch45|[@thatch45](https://github.com/thatch45)|4 +@toanju|[@toanju](https://github.com/toanju)|4 +@tiger-seo|[@tiger-seo](https://github.com/tiger-seo)|4 +@gtmanfred|[@gtmanfred](https://github.com/gtmanfred)|4 +@alexhayes|[@alexhayes](https://github.com/alexhayes)|3 +@alfonsfoubert|[@alfonsfoubert](https://github.com/alfonsfoubert)|3 +@cboltz|[@cboltz](https://github.com/cboltz)|3 +@pcdummy|[@pcdummy](https://github.com/pcdummy)|3 +@sticky-note|[@sticky-note](https://github.com/sticky-note)|3 +@amontalban|[@amontalban](https://github.com/amontalban)|2 +@iggy|[@iggy](https://github.com/iggy)|2 +@ogabrielsantos|[@ogabrielsantos](https://github.com/ogabrielsantos)|2 +@kaharlichenko|[@kaharlichenko](https://github.com/kaharlichenko)|2 +@javierbertoli|[@javierbertoli](https://github.com/javierbertoli)|2 +@neuhalje|[@neuhalje](https://github.com/neuhalje)|2 +@stp-ip|[@stp-ip](https://github.com/stp-ip)|2 +@RonWilliams|[@RonWilliams](https://github.com/RonWilliams)|2 +@ross-p|[@ross-p](https://github.com/ross-p)|2 +@sray|[@sray](https://github.com/sray)|2 +@tomasfejfar|[@tomasfejfar](https://github.com/tomasfejfar)|2 +@vschum|[@vschum](https://github.com/vschum)|2 +@madflojo|[@madflojo](https://github.com/madflojo)|2 +@UtahDave|[@UtahDave](https://github.com/UtahDave)|2 +@daks|[@daks](https://github.com/daks)|2 +@nesteves|[@nesteves](https://github.com/nesteves)|2 +@1exx|[@1exx](https://github.com/1exx)|1 +@aaronm-cloudtek|[@aaronm-cloudtek](https://github.com/aaronm-cloudtek)|1 +@Achimh3011|[@Achimh3011](https://github.com/Achimh3011)|1 +@asenci|[@asenci](https://github.com/asenci)|1 +@word|[@word](https://github.com/word)|1 +@arthurlogilab|[@arthurlogilab](https://github.com/arthurlogilab)|1 +@johnklehm|[@johnklehm](https://github.com/johnklehm)|1 +@tardypad|[@tardypad](https://github.com/tardypad)|1 +@dosercz|[@dosercz](https://github.com/dosercz)|1 +@sivir|[@sivir](https://github.com/sivir)|1 +@terminalmage|[@terminalmage](https://github.com/terminalmage)|1 +@replicant0wnz|[@replicant0wnz](https://github.com/replicant0wnz)|1 +@GeJ|[@GeJ](https://github.com/GeJ)|1 +@imran1008|[@imran1008](https://github.com/imran1008)|1 +@JubbaSmail|[@JubbaSmail](https://github.com/JubbaSmail)|1 +@h4ck3rm1k3|[@h4ck3rm1k3](https://github.com/h4ck3rm1k3)|1 +@dijit|[@dijit](https://github.com/dijit)|1 +@joejulian|[@joejulian](https://github.com/joejulian)|1 +@stromnet|[@stromnet](https://github.com/stromnet)|1 +@thejcannon|[@thejcannon](https://github.com/thejcannon)|1 +@TaiSHiNet|[@TaiSHiNet](https://github.com/TaiSHiNet)|1 +@mkotsbak|[@mkotsbak](https://github.com/mkotsbak)|1 +@miska|[@miska](https://github.com/miska)|1 +@natehouk|[@natehouk](https://github.com/natehouk)|1 +@phil-lavin|[@phil-lavin](https://github.com/phil-lavin)|1 +@S-Wilhelm|[@S-Wilhelm](https://github.com/S-Wilhelm)|1 +@Cottser|[@Cottser](https://github.com/Cottser)|1 +@soniah|[@soniah](https://github.com/soniah)|1 +@tony|[@tony](https://github.com/tony)|1 +@wido|[@wido](https://github.com/wido)|1 +@Yoda-BZH|[@Yoda-BZH](https://github.com/Yoda-BZH)|1 +@abednarik|[@abednarik](https://github.com/abednarik)|1 +@jam13|[@jam13](https://github.com/jam13)|1 +@getSurreal|[@getSurreal](https://github.com/getSurreal)|1 +@slawekp|[@slawekp](https://github.com/slawekp)|1 +@tsia|[@tsia](https://github.com/tsia)|1 +@zhujinhe|[@zhujinhe](https://github.com/zhujinhe)|1 + +--- + +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2020-08-27. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e91df14 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,172 @@ +# Changelog + +## [0.54.2](https://github.com/saltstack-formulas/mysql-formula/compare/v0.54.1...v0.54.2) (2020-08-27) + + +### Bug Fixes + +* **indent:** properly indent file.directory block ([7791268](https://github.com/saltstack-formulas/mysql-formula/commit/7791268d133d557d21414365db59dc14c8f97f74)), closes [#250](https://github.com/saltstack-formulas/mysql-formula/issues/250) + +## [0.54.1](https://github.com/saltstack-formulas/mysql-formula/compare/v0.54.0...v0.54.1) (2020-08-24) + + +### Bug Fixes + +* **freebsd:** upgrade to mysql57-server ([ec68199](https://github.com/saltstack-formulas/mysql-formula/commit/ec681995b4f7e23a8dbec63809d3704f19ec9299)) + +# [0.54.0](https://github.com/saltstack-formulas/mysql-formula/compare/v0.53.0...v0.54.0) (2020-07-10) + + +### Continuous Integration + +* **kitchen:** use `saltimages` Docker Hub where available [skip ci] ([b37a8a7](https://github.com/saltstack-formulas/mysql-formula/commit/b37a8a7c970cb30ed18f04c4103c5f553557699d)) + + +### Features + +* **socket_authentication:** allow unix_socket authentication ([8eccd5a](https://github.com/saltstack-formulas/mysql-formula/commit/8eccd5a68cadde02f54467a7fb9e370d2ee7d574)) + +# [0.53.0](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.7...v0.53.0) (2020-06-01) + + +### Continuous Integration + +* **kitchen+travis:** use latest pre-salted images ([7ea518a](https://github.com/saltstack-formulas/mysql-formula/commit/7ea518a3919f1a59bc6ae821bc0df7577629059a)) +* **travis:** add notifications => zulip [skip ci] ([8adfc4b](https://github.com/saltstack-formulas/mysql-formula/commit/8adfc4bb4fbb49548cf46d277a0403b89c180b1a)) + + +### Features + +* **focal:** add settings for `ubuntu-20.04` ([0d77164](https://github.com/saltstack-formulas/mysql-formula/commit/0d77164f394909ec371f39cb41a4920c82e75052)) + +## [0.52.7](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.6...v0.52.7) (2020-05-19) + + +### Bug Fixes + +* **osfamilymap.yaml:** update SUSE defaults ([8ee79a7](https://github.com/saltstack-formulas/mysql-formula/commit/8ee79a7bb03488e4c3632a1dcfe143696a11aad5)) + + +### Continuous Integration + +* **gemfile.lock:** add to repo with updated `Gemfile` [skip ci] ([9e9fa3e](https://github.com/saltstack-formulas/mysql-formula/commit/9e9fa3e3d15e25ad22f75eae61af4883c79b7c0f)) +* **kitchen+travis:** remove `master-py2-arch-base-latest` [skip ci] ([c1dddc3](https://github.com/saltstack-formulas/mysql-formula/commit/c1dddc3a8d561847094bbe23fe2c764c8fdf79de)) +* **workflows/commitlint:** add to repo [skip ci] ([b4c6570](https://github.com/saltstack-formulas/mysql-formula/commit/b4c65702b91e8813741bf72008e41d1d8dfc735d)) + +## [0.52.6](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.5...v0.52.6) (2020-04-17) + + +### Bug Fixes + +* **reload-modules:** do `reload_modules` on py module installation ([2b6e704](https://github.com/saltstack-formulas/mysql-formula/commit/2b6e704c96d0373aadb56f90d758c960f538abdb)) + + +### Continuous Integration + +* **gemfile:** restrict `train` gem version until upstream fix [skip ci] ([04f75a7](https://github.com/saltstack-formulas/mysql-formula/commit/04f75a7a3b43de9425a8f36dc202b7ecf0c4f856)) +* **kitchen:** avoid using bootstrap for `master` instances [skip ci] ([ef7a2ce](https://github.com/saltstack-formulas/mysql-formula/commit/ef7a2ce2d857dd271ec0704ab951c8337cb6b64e)) +* **travis:** use `major.minor` for `semantic-release` version [skip ci] ([b4f5f79](https://github.com/saltstack-formulas/mysql-formula/commit/b4f5f79781631d7d31061b880df3066ac5bc5860)) + +## [0.52.5](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.4...v0.52.5) (2019-12-10) + + +### Bug Fixes + +* **db_load:** preserve space between -h and -p on the db load `cmd.wait` ([a05f263](https://github.com/saltstack-formulas/mysql-formula/commit/a05f263f4b9eac52a5854fd57a6a24f997ccb291)) + +## [0.52.4](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.3...v0.52.4) (2019-12-03) + + +### Styles + +* remove previous line from jinja directives ([ec0e2a7](https://github.com/saltstack-formulas/mysql-formula/commit/ec0e2a765a587d0df94b0afb9f7a4ef78a5319ab)) + +## [0.52.3](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.2...v0.52.3) (2019-12-03) + + +### Bug Fixes + +* **mac_shortcut.sh:** fix `shellcheck` errors ([7b309f8](https://github.com/saltstack-formulas/mysql-formula/commit/7b309f8da272ebdcb36dbfa7619a0fc9872a79a7)) +* **release.config.js:** use full commit hash in commit link [skip ci] ([3f51b8b](https://github.com/saltstack-formulas/mysql-formula/commit/3f51b8bbc231a7455e6763b415221abff636d8a2)) + + +### Continuous Integration + +* **kitchen:** use `debian-10-master-py3` instead of `develop` [skip ci] ([5efe938](https://github.com/saltstack-formulas/mysql-formula/commit/5efe9387fde63e0c09d99d5771f3b623fb934242)) +* **kitchen:** use `develop` image until `master` is ready (`amazonlinux`) [skip ci] ([63bfb4a](https://github.com/saltstack-formulas/mysql-formula/commit/63bfb4a0f25b62bdc45c1738d438ce5ec64f2183)) +* **kitchen+travis:** upgrade matrix after `2019.2.2` release [skip ci] ([27ac5a3](https://github.com/saltstack-formulas/mysql-formula/commit/27ac5a3f684325a8e15736bb85d4774807061534)) +* **travis:** apply changes from build config validation [skip ci] ([d520848](https://github.com/saltstack-formulas/mysql-formula/commit/d520848c815a9c2815ee3f1943e3e3962a26c7cf)) +* **travis:** opt-in to `dpl v2` to complete build config validation [skip ci] ([1a8d914](https://github.com/saltstack-formulas/mysql-formula/commit/1a8d914fbd5e43f78ee2334b9c5ccd51ee65ad57)) +* **travis:** quote pathspecs used with `git ls-files` [skip ci] ([3fb5a82](https://github.com/saltstack-formulas/mysql-formula/commit/3fb5a82de66dda9a05decc5ee7263729ef913533)) +* **travis:** run `shellcheck` during lint job [skip ci] ([0931835](https://github.com/saltstack-formulas/mysql-formula/commit/0931835f1cfc77022a43242bd3ab04cbed2a3a02)) +* **travis:** update `salt-lint` config for `v0.0.10` [skip ci] ([1512279](https://github.com/saltstack-formulas/mysql-formula/commit/1512279c2eac26638720461cc7e847d93d2c77d6)) +* **travis:** use build config validation (beta) [skip ci] ([40d4b97](https://github.com/saltstack-formulas/mysql-formula/commit/40d4b9763f252f5811d31b2b2df156260bde2b6d)) + + +### Documentation + +* **contributing:** remove to use org-level file instead [skip ci] ([6afcc80](https://github.com/saltstack-formulas/mysql-formula/commit/6afcc80396dc4ec2044d8611f18a6ed9075c6a52)) +* **readme:** update link to `CONTRIBUTING` [skip ci] ([01f25a3](https://github.com/saltstack-formulas/mysql-formula/commit/01f25a3ebfbf59d1db2bec73bc5fef9d8bcafd7e)) + + +### Performance Improvements + +* **travis:** improve `salt-lint` invocation [skip ci] ([1980c63](https://github.com/saltstack-formulas/mysql-formula/commit/1980c634b9021c7d29be914bd2a63ddf3c31c8ad)) + +## [0.52.2](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.1...v0.52.2) (2019-10-11) + + +### Bug Fixes + +* **rubocop:** add fixes using `rubocop --safe-auto-correct` ([](https://github.com/saltstack-formulas/mysql-formula/commit/fca3b04)) + + +### Continuous Integration + +* merge travis matrix, add `salt-lint` & `rubocop` to `lint` job ([](https://github.com/saltstack-formulas/mysql-formula/commit/b2b8863)) +* **travis:** merge `rubocop` linter into main `lint` job ([](https://github.com/saltstack-formulas/mysql-formula/commit/26dc562)) + +## [0.52.1](https://github.com/saltstack-formulas/mysql-formula/compare/v0.52.0...v0.52.1) (2019-10-10) + + +### Bug Fixes + +* **server.sls:** fix `salt-lint` errors ([](https://github.com/saltstack-formulas/mysql-formula/commit/764dd0c)) +* **user.sls:** fix `salt-lint` errors ([](https://github.com/saltstack-formulas/mysql-formula/commit/a014e55)) + + +### Continuous Integration + +* **kitchen:** change `log_level` to `debug` instead of `info` ([](https://github.com/saltstack-formulas/mysql-formula/commit/75fd8dc)) +* **kitchen:** install required packages to bootstrapped `opensuse` [skip ci] ([](https://github.com/saltstack-formulas/mysql-formula/commit/8b89ebc)) +* **kitchen:** use bootstrapped `opensuse` images until `2019.2.2` [skip ci] ([](https://github.com/saltstack-formulas/mysql-formula/commit/4bdaab7)) +* **platform:** add `arch-base-latest` (commented out for now) [skip ci] ([](https://github.com/saltstack-formulas/mysql-formula/commit/5c20c9b)) +* **yamllint:** add rule `empty-values` & use new `yaml-files` setting ([](https://github.com/saltstack-formulas/mysql-formula/commit/2322ff6)) +* merge travis matrix, add `salt-lint` & `rubocop` to `lint` job ([](https://github.com/saltstack-formulas/mysql-formula/commit/00494d5)) +* use `dist: bionic` & apply `opensuse-leap-15` SCP error workaround ([](https://github.com/saltstack-formulas/mysql-formula/commit/05b1cef)) + +# [0.52.0](https://github.com/saltstack-formulas/mysql-formula/compare/v0.51.0...v0.52.0) (2019-08-17) + + +### Features + +* **yamllint:** include for this repo and apply rules throughout ([9f739fa](https://github.com/saltstack-formulas/mysql-formula/commit/9f739fa)) + +# [0.51.0](https://github.com/saltstack-formulas/mysql-formula/compare/v0.50.0...v0.51.0) (2019-08-08) + + +### Bug Fixes + +* **connector:** fix typos (connnector) and missing `enabled` ([bdee94a](https://github.com/saltstack-formulas/mysql-formula/commit/bdee94a)) + + +### Features + +* **linux:** archlinux support (no osmajorrelase grain) ([4b4ad88](https://github.com/saltstack-formulas/mysql-formula/commit/4b4ad88)) + +# [0.50.0](https://github.com/saltstack-formulas/mysql-formula/compare/v0.49.0...v0.50.0) (2019-07-12) + + +### Features + +* **semantic-release:** implement for this formula ([1d2e2f5](https://github.com/saltstack-formulas/mysql-formula/commit/1d2e2f5)) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..f993894 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,47 @@ +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners + +# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence +# ************************************************************************** +# *** NO GLOBAL OWNER(S) SPECIFIED *** +# *** Ideally this will be defined for a healthy, well-maintained repo *** +# ************************************************************************** +# FILE PATTERN OWNER(S) +* @NONE + +# SECTION: Owner(s) for specific directories +# FILE PATTERN OWNER(S) + +# SECTION: Owner(s) for files/directories related to `semantic-release` +# FILE PATTERN OWNER(S) +/.github/workflows/ @saltstack-formulas/ssf +/bin/install-hooks @saltstack-formulas/ssf +/bin/kitchen @saltstack-formulas/ssf +/docs/AUTHORS.rst @saltstack-formulas/ssf +/docs/CHANGELOG.rst @saltstack-formulas/ssf +/docs/TOFS_pattern.rst @saltstack-formulas/ssf +/mysql/libsaltcli.jinja @saltstack-formulas/ssf +/mysql/libtofs.jinja @saltstack-formulas/ssf +/test/integration/**/inspec.yml @saltstack-formulas/ssf +/test/integration/**/README.md @saltstack-formulas/ssf +/.gitignore @saltstack-formulas/ssf +/.cirrus.yml @saltstack-formulas/ssf +/.pre-commit-config.yaml @saltstack-formulas/ssf +/.rstcheck.cfg @saltstack-formulas/ssf +/.rubocop.yml @saltstack-formulas/ssf +/.salt-lint @saltstack-formulas/ssf +/.travis.yml @saltstack-formulas/ssf +/.yamllint @saltstack-formulas/ssf +/AUTHORS.md @saltstack-formulas/ssf +/CHANGELOG.md @saltstack-formulas/ssf +/CODEOWNERS @saltstack-formulas/ssf +/commitlint.config.js @saltstack-formulas/ssf +/FORMULA @saltstack-formulas/ssf +/Gemfile @saltstack-formulas/ssf +/Gemfile.lock @saltstack-formulas/ssf +/kitchen.yml @saltstack-formulas/ssf +/pre-commit_semantic-release.sh @saltstack-formulas/ssf +/release-rules.js @saltstack-formulas/ssf +/release.config.js @saltstack-formulas/ssf + +# SECTION: Owner(s) for specific files +# FILE PATTERN OWNER(S) diff --git a/FORMULA b/FORMULA index ebf0129..bfb2e55 100644 --- a/FORMULA +++ b/FORMULA @@ -1,8 +1,9 @@ name: mysql os: RedHat, CentOS, Debian, Ubuntu, Suse, Gentoo, FreeBSD os_family: RedHat, Debian, Suse, Gentoo, FreeBSD -version: 201507 +version: 0.54.2 release: 1 minimum_version: 2015.8 summary: Formula for installing MySQL description: Formula for installing MySQL database client and/or server +top_level_dir: mysql diff --git a/Gemfile b/Gemfile index f74e267..82c4a31 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,12 @@ +# frozen_string_literal: true + source 'https://rubygems.org' -gem 'codeclimate-test-reporter', group: :test, require: nil -gem 'rake' -gem 'berkshelf', '~> 4.0' - -group :integration do - gem 'test-kitchen' - gem 'kitchen-salt' - gem 'kitchen-inspec' -end - -group :docker do - gem 'kitchen-docker' -end - -# vi: set ft=ruby : -gem "kitchen-vagrant" +# Use the latest version of `inspec` prior to `4.23.4`, which introduces a +# regression where the diff isn't displayed when comparing using `eq`. +gem 'inspec', '~> 4.22.22' +# Install the `kitchen-docker` gem from GitHub because the latest version +# currently available (`2.10.0`) doesn't include a recent fix for Gentoo. +gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker', ref: '41e80fe' +gem 'kitchen-inspec', '>= 2.2.1' +gem 'kitchen-salt', '>= 0.6.3' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..19bf26d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,530 @@ +GIT + remote: https://github.com/test-kitchen/kitchen-docker.git + revision: 41e80fed3a7cc86323e19c16a5a340cebf7e5848 + ref: 41e80fe + specs: + kitchen-docker (2.10.0) + test-kitchen (>= 1.0.0) + +GEM + remote: https://rubygems.org/ + specs: + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + aws-eventstream (1.1.0) + aws-partitions (1.386.0) + aws-sdk-apigateway (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-apigatewayv2 (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-athena (1.33.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-autoscaling (1.22.0) + aws-sdk-core (~> 3, >= 3.52.1) + aws-sigv4 (~> 1.1) + aws-sdk-budgets (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudformation (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudfront (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsm (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsmv2 (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudtrail (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatch (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatchlogs (1.38.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codecommit (1.40.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codedeploy (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codepipeline (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-configservice (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-core (3.109.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-costandusagereportservice (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-dynamodb (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ec2 (1.202.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecr (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecs (1.70.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-efs (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-eks (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticache (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticbeanstalk (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancing (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancingv2 (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticsearchservice (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-firehose (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-guardduty (1.42.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-iam (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kafka (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kinesis (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kms (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-lambda (1.51.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-organizations (1.17.0) + aws-sdk-core (~> 3, >= 3.39.0) + aws-sigv4 (~> 1.0) + aws-sdk-rds (1.104.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-redshift (1.50.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53 (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53domains (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53resolver (1.21.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.83.1) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.1) + aws-sdk-securityhub (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ses (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sms (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sns (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sqs (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ssm (1.95.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.2.2) + aws-eventstream (~> 1, >= 1.0.2) + azure_graph_rbac (0.17.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_key_vault (0.17.6) + ms_rest_azure (~> 0.12.0) + azure_mgmt_resources (0.18.0) + ms_rest_azure (~> 0.12.0) + azure_mgmt_security (0.18.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_storage (0.22.0) + ms_rest_azure (~> 0.12.0) + bcrypt_pbkdf (1.0.1) + builder (3.2.4) + chef-config (16.6.14) + addressable + chef-utils (= 16.6.14) + fuzzyurl + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) + tomlrb (~> 1.2) + chef-telemetry (1.0.14) + chef-config + concurrent-ruby (~> 1.0) + ffi-yajl (~> 2.2) + chef-utils (16.6.14) + coderay (1.1.3) + concurrent-ruby (1.1.7) + declarative (0.0.20) + declarative-option (0.1.0) + diff-lcs (1.4.4) + docker-api (2.0.0) + excon (>= 0.47.0) + multi_json + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + ecma-re-validator (0.2.1) + regexp_parser (~> 1.2) + ed25519 (1.2.4) + erubi (1.9.0) + excon (0.78.0) + faraday (0.17.3) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday_middleware (0.12.2) + faraday (>= 0.7.4, < 1.0) + ffi (1.13.1) + ffi-yajl (2.3.4) + libyajl2 (~> 1.2) + fuzzyurl (0.9.0) + google-api-client (0.44.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.12) + googleauth (0.13.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.14) + gssapi (1.3.0) + ffi (>= 1.0.1) + gyoku (1.3.1) + builder (>= 2.1.2) + hana (1.3.6) + hashie (3.6.0) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + inifile (3.0.0) + inspec (4.22.22) + faraday_middleware (~> 0.12.2) + inspec-core (= 4.22.22) + train (~> 3.0) + train-aws (~> 0.1) + train-habitat (~> 0.1) + train-winrm (~> 0.2) + inspec-core (4.22.22) + addressable (~> 2.4) + chef-telemetry (~> 1.0) + faraday (>= 0.9.0) + hashie (~> 3.4) + json_schemer (>= 0.2.1, < 0.2.12) + license-acceptance (>= 0.2.13, < 2.0) + method_source (>= 0.8, < 2.0) + mixlib-log (~> 3.0) + multipart-post (~> 2.0) + parallel (~> 1.9) + parslet (~> 1.5) + pry (~> 0.13) + rspec (~> 3.9) + rspec-its (~> 1.2) + rubyzip (~> 1.2, >= 1.2.2) + semverse (~> 3.0) + sslshake (~> 1.2) + thor (>= 0.20, < 2.0) + tomlrb (~> 1.2.0) + train-core (~> 3.0) + tty-prompt (~> 0.17) + tty-table (~> 0.10) + jmespath (1.4.0) + json (2.3.1) + json_schemer (0.2.11) + ecma-re-validator (~> 0.2) + hana (~> 1.3) + regexp_parser (~> 1.5) + uri_template (~> 0.7) + jwt (2.2.2) + kitchen-inspec (2.2.1) + hashie (~> 3.4) + inspec (>= 2.2.64, < 5.0) + test-kitchen (>= 2.7, < 3) + kitchen-salt (0.6.3) + hashie (>= 3.5) + test-kitchen (>= 1.4) + libyajl2 (1.2.0) + license-acceptance (1.0.19) + pastel (~> 0.7) + tomlrb (~> 1.2) + tty-box (~> 0.3) + tty-prompt (~> 0.18) + little-plugger (1.1.4) + logging (2.3.0) + little-plugger (~> 1.1) + multi_json (~> 1.14) + memoist (0.16.2) + method_source (1.0.0) + mini_mime (1.0.2) + minitest (5.14.2) + mixlib-config (3.0.9) + tomlrb + mixlib-install (3.12.3) + mixlib-shellout + mixlib-versioning + thor + mixlib-log (3.0.9) + mixlib-shellout (3.1.6) + chef-utils + mixlib-versioning (1.2.12) + ms_rest (0.7.6) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + timeliness (~> 0.3.10) + ms_rest_azure (0.12.0) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + faraday-cookie_jar (~> 0.0.6) + ms_rest (~> 0.7.6) + multi_json (1.15.0) + multipart-post (2.1.1) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + net-ssh-gateway (2.0.0) + net-ssh (>= 4.0.0) + nori (2.6.0) + os (1.1.1) + parallel (1.19.2) + parslet (1.8.2) + pastel (0.8.0) + tty-color (~> 0.5) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) + regexp_parser (1.8.2) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.9.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.4) + rubyntlm (0.6.2) + rubyzip (1.3.0) + semverse (3.0.0) + signet (0.14.0) + addressable (~> 2.3) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + sslshake (1.3.1) + strings (0.2.0) + strings-ansi (~> 0.2) + unicode-display_width (~> 1.5) + unicode_utils (~> 1.4) + strings-ansi (0.2.0) + test-kitchen (2.7.2) + bcrypt_pbkdf (~> 1.0) + ed25519 (~> 1.2) + license-acceptance (>= 1.0.11, < 3.0) + mixlib-install (~> 3.6) + mixlib-shellout (>= 1.2, < 4.0) + net-scp (>= 1.1, < 4.0) + net-ssh (>= 2.9, < 7.0) + net-ssh-gateway (>= 1.2, < 3.0) + thor (>= 0.19, < 2.0) + winrm (~> 2.0) + winrm-elevated (~> 1.0) + winrm-fs (~> 1.1) + thor (1.0.1) + thread_safe (0.3.6) + timeliness (0.3.10) + tomlrb (1.2.9) + train (3.3.27) + activesupport (>= 5.2.4.3, < 6.0.0) + azure_graph_rbac (~> 0.16) + azure_mgmt_key_vault (~> 0.17) + azure_mgmt_resources (~> 0.15) + azure_mgmt_security (~> 0.18) + azure_mgmt_storage (~> 0.18) + docker-api (>= 1.26, < 3.0) + google-api-client (>= 0.23.9, < 0.44.1) + googleauth (>= 0.6.6, < 0.13.1) + inifile (~> 3.0) + train-core (= 3.3.27) + train-winrm (~> 0.2) + train-aws (0.1.18) + aws-sdk-apigateway (~> 1.0) + aws-sdk-apigatewayv2 (~> 1.0) + aws-sdk-athena (~> 1.0) + aws-sdk-autoscaling (~> 1.22.0) + aws-sdk-budgets (~> 1.0) + aws-sdk-cloudformation (~> 1.0) + aws-sdk-cloudfront (~> 1.0) + aws-sdk-cloudhsm (~> 1.0) + aws-sdk-cloudhsmv2 (~> 1.0) + aws-sdk-cloudtrail (~> 1.8) + aws-sdk-cloudwatch (~> 1.13) + aws-sdk-cloudwatchlogs (~> 1.13) + aws-sdk-codecommit (~> 1.0) + aws-sdk-codedeploy (~> 1.0) + aws-sdk-codepipeline (~> 1.0) + aws-sdk-configservice (~> 1.21) + aws-sdk-core (~> 3.0) + aws-sdk-costandusagereportservice (~> 1.6) + aws-sdk-dynamodb (~> 1.31) + aws-sdk-ec2 (~> 1.70) + aws-sdk-ecr (~> 1.18) + aws-sdk-ecs (~> 1.30) + aws-sdk-efs (~> 1.0) + aws-sdk-eks (~> 1.9) + aws-sdk-elasticache (~> 1.0) + aws-sdk-elasticbeanstalk (~> 1.0) + aws-sdk-elasticloadbalancing (~> 1.8) + aws-sdk-elasticloadbalancingv2 (~> 1.0) + aws-sdk-elasticsearchservice (~> 1.0) + aws-sdk-firehose (~> 1.0) + aws-sdk-guardduty (~> 1.31) + aws-sdk-iam (~> 1.13) + aws-sdk-kafka (~> 1.0) + aws-sdk-kinesis (~> 1.0) + aws-sdk-kms (~> 1.13) + aws-sdk-lambda (~> 1.0) + aws-sdk-organizations (~> 1.17.0) + aws-sdk-rds (~> 1.43) + aws-sdk-redshift (~> 1.0) + aws-sdk-route53 (~> 1.0) + aws-sdk-route53domains (~> 1.0) + aws-sdk-route53resolver (~> 1.0) + aws-sdk-s3 (~> 1.30) + aws-sdk-securityhub (~> 1.0) + aws-sdk-ses (~> 1.0) + aws-sdk-sms (~> 1.0) + aws-sdk-sns (~> 1.9) + aws-sdk-sqs (~> 1.10) + aws-sdk-ssm (~> 1.0) + train-core (3.3.27) + addressable (~> 2.5) + ffi (!= 1.13.0) + json (>= 1.8, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + net-scp (>= 1.2, < 4.0) + net-ssh (>= 2.9, < 7.0) + train-habitat (0.2.13) + train-winrm (0.2.11) + winrm (~> 2.0) + winrm-elevated (~> 1.2.2) + winrm-fs (~> 1.0) + tty-box (0.6.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-cursor (~> 0.7) + tty-color (0.5.2) + tty-cursor (0.7.1) + tty-prompt (0.22.0) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.8.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) + tzinfo (1.2.7) + thread_safe (~> 0.1) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) + unicode-display_width (1.7.0) + unicode_utils (1.4.0) + uri_template (0.7.0) + winrm (2.3.5) + builder (>= 2.1.2) + erubi (~> 1.8) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0, >= 0.6.1) + winrm-elevated (1.2.2) + erubi (~> 1.8) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.3.3) + erubi (~> 1.8) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 1.1) + winrm (~> 2.0) + wisper (2.0.1) + +PLATFORMS + ruby + +DEPENDENCIES + inspec (~> 4.22.22) + kitchen-docker! + kitchen-inspec (>= 2.2.1) + kitchen-salt (>= 0.6.3) + +BUNDLED WITH + 2.1.2 diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 2a6eafb..0000000 --- a/Rakefile +++ /dev/null @@ -1,31 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'bundler/setup' - -Rake::TestTask.new do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - -desc 'Run Test Kitchen integration tests' -namespace :integration do - desc 'Run integration tests with kitchen-docker' - task :docker do - require 'kitchen' - Kitchen.logger = Kitchen.default_file_logger - @loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml') - Kitchen::Config.new(loader: @loader).instances.each do |instance| - instance.test(:always) - end - end -end - -task default: :test - -begin - require 'kitchen/rake_tasks' - Kitchen::RakeTasks.new -rescue LoadError - puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] -end diff --git a/bin/install-hooks b/bin/install-hooks new file mode 100755 index 0000000..840bb6c --- /dev/null +++ b/bin/install-hooks @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +set -o nounset # Treat unset variables as an error and immediately exit +set -o errexit # If a command fails exit the whole script + +if [ "${DEBUG:-false}" = "true" ]; then + set -x # Run the entire script in debug mode +fi + +if ! command -v pre-commit >/dev/null 2>&1; then + echo "pre-commit not found: please install or check your PATH" >&2 + echo "See https://pre-commit.com/#installation" >&2 + exit 1 +fi + +pre-commit install --install-hooks +pre-commit install --hook-type commit-msg --install-hooks diff --git a/bin/kitchen b/bin/kitchen new file mode 100755 index 0000000..dcfdb4c --- /dev/null +++ b/bin/kitchen @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'kitchen' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort( + 'Your `bin/bundle` was not generated by Bundler, '\ + 'so this binstub cannot run. Replace `bin/bundle` by running '\ + '`bundle binstubs bundler --force`, then run this command again.' + ) + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('test-kitchen', 'kitchen') diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..4eb37f4 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'body-max-line-length': [2, 'always', 120], + 'footer-max-line-length': [2, 'always', 120], + 'header-max-length': [2, 'always', 72], + }, +}; diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst new file mode 100644 index 0000000..66c7b62 --- /dev/null +++ b/docs/AUTHORS.rst @@ -0,0 +1,254 @@ +.. role:: raw-html-m2r(raw) + :format: html + + +Authors +======= + +This list is sorted by the number of commits per contributor in *descending* order. + +.. list-table:: + :header-rows: 1 + + * - Avatar + - Contributor + - Contributions + * - :raw-html-m2r:`@myii` + - `@myii `_ + - 65 + * - :raw-html-m2r:`@gravyboat` + - `@gravyboat `_ + - 38 + * - :raw-html-m2r:`@aboe76` + - `@aboe76 `_ + - 37 + * - :raw-html-m2r:`@nmadhok` + - `@nmadhok `_ + - 28 + * - :raw-html-m2r:`@whiteinge` + - `@whiteinge `_ + - 27 + * - :raw-html-m2r:`@noelmcloughlin` + - `@noelmcloughlin `_ + - 18 + * - :raw-html-m2r:`@alxwr` + - `@alxwr `_ + - 14 + * - :raw-html-m2r:`@cheuschober` + - `@cheuschober `_ + - 11 + * - :raw-html-m2r:`@babilen5` + - `@babilen5 `_ + - 11 + * - :raw-html-m2r:`@pprkut` + - `@pprkut `_ + - 9 + * - :raw-html-m2r:`@techhat` + - `@techhat `_ + - 7 + * - :raw-html-m2r:`@roock` + - `@roock `_ + - 6 + * - :raw-html-m2r:`@Routhinator` + - `@Routhinator `_ + - 5 + * - :raw-html-m2r:`@puneetk` + - `@puneetk `_ + - 5 + * - :raw-html-m2r:`@davidjb` + - `@davidjb `_ + - 5 + * - :raw-html-m2r:`@xenophonf` + - `@xenophonf `_ + - 4 + * - :raw-html-m2r:`@thatch45` + - `@thatch45 `_ + - 4 + * - :raw-html-m2r:`@toanju` + - `@toanju `_ + - 4 + * - :raw-html-m2r:`@tiger-seo` + - `@tiger-seo `_ + - 4 + * - :raw-html-m2r:`@gtmanfred` + - `@gtmanfred `_ + - 4 + * - :raw-html-m2r:`@alexhayes` + - `@alexhayes `_ + - 3 + * - :raw-html-m2r:`@alfonsfoubert` + - `@alfonsfoubert `_ + - 3 + * - :raw-html-m2r:`@cboltz` + - `@cboltz `_ + - 3 + * - :raw-html-m2r:`@pcdummy` + - `@pcdummy `_ + - 3 + * - :raw-html-m2r:`@sticky-note` + - `@sticky-note `_ + - 3 + * - :raw-html-m2r:`@amontalban` + - `@amontalban `_ + - 2 + * - :raw-html-m2r:`@iggy` + - `@iggy `_ + - 2 + * - :raw-html-m2r:`@ogabrielsantos` + - `@ogabrielsantos `_ + - 2 + * - :raw-html-m2r:`@kaharlichenko` + - `@kaharlichenko `_ + - 2 + * - :raw-html-m2r:`@javierbertoli` + - `@javierbertoli `_ + - 2 + * - :raw-html-m2r:`@neuhalje` + - `@neuhalje `_ + - 2 + * - :raw-html-m2r:`@stp-ip` + - `@stp-ip `_ + - 2 + * - :raw-html-m2r:`@RonWilliams` + - `@RonWilliams `_ + - 2 + * - :raw-html-m2r:`@ross-p` + - `@ross-p `_ + - 2 + * - :raw-html-m2r:`@sray` + - `@sray `_ + - 2 + * - :raw-html-m2r:`@tomasfejfar` + - `@tomasfejfar `_ + - 2 + * - :raw-html-m2r:`@vschum` + - `@vschum `_ + - 2 + * - :raw-html-m2r:`@madflojo` + - `@madflojo `_ + - 2 + * - :raw-html-m2r:`@UtahDave` + - `@UtahDave `_ + - 2 + * - :raw-html-m2r:`@daks` + - `@daks `_ + - 2 + * - :raw-html-m2r:`@nesteves` + - `@nesteves `_ + - 2 + * - :raw-html-m2r:`@1exx` + - `@1exx `_ + - 1 + * - :raw-html-m2r:`@aaronm-cloudtek` + - `@aaronm-cloudtek `_ + - 1 + * - :raw-html-m2r:`@Achimh3011` + - `@Achimh3011 `_ + - 1 + * - :raw-html-m2r:`@asenci` + - `@asenci `_ + - 1 + * - :raw-html-m2r:`@word` + - `@word `_ + - 1 + * - :raw-html-m2r:`@arthurlogilab` + - `@arthurlogilab `_ + - 1 + * - :raw-html-m2r:`@johnklehm` + - `@johnklehm `_ + - 1 + * - :raw-html-m2r:`@tardypad` + - `@tardypad `_ + - 1 + * - :raw-html-m2r:`@dosercz` + - `@dosercz `_ + - 1 + * - :raw-html-m2r:`@sivir` + - `@sivir `_ + - 1 + * - :raw-html-m2r:`@terminalmage` + - `@terminalmage `_ + - 1 + * - :raw-html-m2r:`@replicant0wnz` + - `@replicant0wnz `_ + - 1 + * - :raw-html-m2r:`@GeJ` + - `@GeJ `_ + - 1 + * - :raw-html-m2r:`@imran1008` + - `@imran1008 `_ + - 1 + * - :raw-html-m2r:`@JubbaSmail` + - `@JubbaSmail `_ + - 1 + * - :raw-html-m2r:`@h4ck3rm1k3` + - `@h4ck3rm1k3 `_ + - 1 + * - :raw-html-m2r:`@dijit` + - `@dijit `_ + - 1 + * - :raw-html-m2r:`@joejulian` + - `@joejulian `_ + - 1 + * - :raw-html-m2r:`@stromnet` + - `@stromnet `_ + - 1 + * - :raw-html-m2r:`@thejcannon` + - `@thejcannon `_ + - 1 + * - :raw-html-m2r:`@TaiSHiNet` + - `@TaiSHiNet `_ + - 1 + * - :raw-html-m2r:`@mkotsbak` + - `@mkotsbak `_ + - 1 + * - :raw-html-m2r:`@miska` + - `@miska `_ + - 1 + * - :raw-html-m2r:`@natehouk` + - `@natehouk `_ + - 1 + * - :raw-html-m2r:`@phil-lavin` + - `@phil-lavin `_ + - 1 + * - :raw-html-m2r:`@S-Wilhelm` + - `@S-Wilhelm `_ + - 1 + * - :raw-html-m2r:`@Cottser` + - `@Cottser `_ + - 1 + * - :raw-html-m2r:`@soniah` + - `@soniah `_ + - 1 + * - :raw-html-m2r:`@tony` + - `@tony `_ + - 1 + * - :raw-html-m2r:`@wido` + - `@wido `_ + - 1 + * - :raw-html-m2r:`@Yoda-BZH` + - `@Yoda-BZH `_ + - 1 + * - :raw-html-m2r:`@abednarik` + - `@abednarik `_ + - 1 + * - :raw-html-m2r:`@jam13` + - `@jam13 `_ + - 1 + * - :raw-html-m2r:`@getSurreal` + - `@getSurreal `_ + - 1 + * - :raw-html-m2r:`@slawekp` + - `@slawekp `_ + - 1 + * - :raw-html-m2r:`@tsia` + - `@tsia `_ + - 1 + * - :raw-html-m2r:`@zhujinhe` + - `@zhujinhe `_ + - 1 + + +---- + +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2020-08-27. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst new file mode 100644 index 0000000..4cef594 --- /dev/null +++ b/docs/CHANGELOG.rst @@ -0,0 +1,212 @@ + +Changelog +========= + +`0.54.2 `_ (2020-08-27) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **indent:** properly indent file.directory block (\ `7791268 `_\ ), closes `#250 `_ + +`0.54.1 `_ (2020-08-24) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **freebsd:** upgrade to mysql57-server (\ `ec68199 `_\ ) + +`0.54.0 `_ (2020-07-10) +---------------------------------------------------------------------------------------------------------- + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **kitchen:** use ``saltimages`` Docker Hub where available [skip ci] (\ `b37a8a7 `_\ ) + +Features +^^^^^^^^ + + +* **socket_authentication:** allow unix_socket authentication (\ `8eccd5a `_\ ) + +`0.53.0 `_ (2020-06-01) +---------------------------------------------------------------------------------------------------------- + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **kitchen+travis:** use latest pre-salted images (\ `7ea518a `_\ ) +* **travis:** add notifications => zulip [skip ci] (\ `8adfc4b `_\ ) + +Features +^^^^^^^^ + + +* **focal:** add settings for ``ubuntu-20.04`` (\ `0d77164 `_\ ) + +`0.52.7 `_ (2020-05-19) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **osfamilymap.yaml:** update SUSE defaults (\ `8ee79a7 `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **gemfile.lock:** add to repo with updated ``Gemfile`` [skip ci] (\ `9e9fa3e `_\ ) +* **kitchen+travis:** remove ``master-py2-arch-base-latest`` [skip ci] (\ `c1dddc3 `_\ ) +* **workflows/commitlint:** add to repo [skip ci] (\ `b4c6570 `_\ ) + +`0.52.6 `_ (2020-04-17) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **reload-modules:** do ``reload_modules`` on py module installation (\ `2b6e704 `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **gemfile:** restrict ``train`` gem version until upstream fix [skip ci] (\ `04f75a7 `_\ ) +* **kitchen:** avoid using bootstrap for ``master`` instances [skip ci] (\ `ef7a2ce `_\ ) +* **travis:** use ``major.minor`` for ``semantic-release`` version [skip ci] (\ `b4f5f79 `_\ ) + +`0.52.5 `_ (2019-12-10) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **db_load:** preserve space between -h and -p on the db load ``cmd.wait`` (\ `a05f263 `_\ ) + +`0.52.4 `_ (2019-12-03) +---------------------------------------------------------------------------------------------------------- + +Styles +^^^^^^ + + +* remove previous line from jinja directives (\ `ec0e2a7 `_\ ) + +`0.52.3 `_ (2019-12-03) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **mac_shortcut.sh:** fix ``shellcheck`` errors (\ `7b309f8 `_\ ) +* **release.config.js:** use full commit hash in commit link [skip ci] (\ `3f51b8b `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **kitchen:** use ``debian-10-master-py3`` instead of ``develop`` [skip ci] (\ `5efe938 `_\ ) +* **kitchen:** use ``develop`` image until ``master`` is ready (\ ``amazonlinux``\ ) [skip ci] (\ `63bfb4a `_\ ) +* **kitchen+travis:** upgrade matrix after ``2019.2.2`` release [skip ci] (\ `27ac5a3 `_\ ) +* **travis:** apply changes from build config validation [skip ci] (\ `d520848 `_\ ) +* **travis:** opt-in to ``dpl v2`` to complete build config validation [skip ci] (\ `1a8d914 `_\ ) +* **travis:** quote pathspecs used with ``git ls-files`` [skip ci] (\ `3fb5a82 `_\ ) +* **travis:** run ``shellcheck`` during lint job [skip ci] (\ `0931835 `_\ ) +* **travis:** update ``salt-lint`` config for ``v0.0.10`` [skip ci] (\ `1512279 `_\ ) +* **travis:** use build config validation (beta) [skip ci] (\ `40d4b97 `_\ ) + +Documentation +^^^^^^^^^^^^^ + + +* **contributing:** remove to use org-level file instead [skip ci] (\ `6afcc80 `_\ ) +* **readme:** update link to ``CONTRIBUTING`` [skip ci] (\ `01f25a3 `_\ ) + +Performance Improvements +^^^^^^^^^^^^^^^^^^^^^^^^ + + +* **travis:** improve ``salt-lint`` invocation [skip ci] (\ `1980c63 `_\ ) + +`0.52.2 `_ (2019-10-11) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **rubocop:** add fixes using ``rubocop --safe-auto-correct`` (\ ` `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* merge travis matrix, add ``salt-lint`` & ``rubocop`` to ``lint`` job (\ ` `_\ ) +* **travis:** merge ``rubocop`` linter into main ``lint`` job (\ ` `_\ ) + +`0.52.1 `_ (2019-10-10) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **server.sls:** fix ``salt-lint`` errors (\ ` `_\ ) +* **user.sls:** fix ``salt-lint`` errors (\ ` `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **kitchen:** change ``log_level`` to ``debug`` instead of ``info`` (\ ` `_\ ) +* **kitchen:** install required packages to bootstrapped ``opensuse`` [skip ci] (\ ` `_\ ) +* **kitchen:** use bootstrapped ``opensuse`` images until ``2019.2.2`` [skip ci] (\ ` `_\ ) +* **platform:** add ``arch-base-latest`` (commented out for now) [skip ci] (\ ` `_\ ) +* **yamllint:** add rule ``empty-values`` & use new ``yaml-files`` setting (\ ` `_\ ) +* merge travis matrix, add ``salt-lint`` & ``rubocop`` to ``lint`` job (\ ` `_\ ) +* use ``dist: bionic`` & apply ``opensuse-leap-15`` SCP error workaround (\ ` `_\ ) + +`0.52.0 `_ (2019-08-17) +---------------------------------------------------------------------------------------------------------- + +Features +^^^^^^^^ + + +* **yamllint:** include for this repo and apply rules throughout (\ `9f739fa `_\ ) + +`0.51.0 `_ (2019-08-08) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **connector:** fix typos (connnector) and missing ``enabled`` (\ `bdee94a `_\ ) + +Features +^^^^^^^^ + + +* **linux:** archlinux support (no osmajorrelase grain) (\ `4b4ad88 `_\ ) + +`0.50.0 `_ (2019-07-12) +---------------------------------------------------------------------------------------------------------- + +Features +^^^^^^^^ + + +* **semantic-release:** implement for this formula (\ `1d2e2f5 `_\ ) diff --git a/README.rst b/docs/README.rst similarity index 58% rename from README.rst rename to docs/README.rst index 3944815..844ac63 100644 --- a/README.rst +++ b/docs/README.rst @@ -1,42 +1,72 @@ -===== +.. _readme: + mysql ===== +|img_travis| |img_sr| + +.. |img_travis| image:: https://travis-ci.com/saltstack-formulas/mysql-formula.svg?branch=master + :alt: Travis CI Build Status + :scale: 100% + :target: https://travis-ci.com/saltstack-formulas/mysql-formula +.. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg + :alt: Semantic Release + :scale: 100% + :target: https://github.com/semantic-release/semantic-release + Install the MySQL client and/or server on Linux and MacOS. -.. note:: +.. contents:: **Table of Contents** - See the full `Salt Formulas installation and usage instructions - `_. +General notes +------------- + +See the full `SaltStack Formulas installation and usage instructions +`_. + +If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section +`_. + +If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``, +which contains the currently released version. This formula is versioned according to `Semantic Versioning `_. + +See `Formula Versioning Section `_ for more details. + +Contributing to this repo +------------------------- + +**Commit message formatting is significant!!** + +Please see `How to contribute `_ for more details. Available states -================ +---------------- .. contents:: :local: ``mysql`` ---------- +^^^^^^^^^ Meta-state including all server packages in correct order. This meta-state does **not** include ``mysql.remove_test_database``. ``mysql.macos`` ----------------- +^^^^^^^^^^^^^^^^ Install "MySQL Community Server", "MySQL Workbench", and other related mysql products on MacOS (and create Desktop shortcuts). ``mysql.macos.remove`` ----------------- +^^^^^^^^^^^^^^^^ Remove "MySQL Community Server", "MySQL Workbench", and any other enabled products from MacOS. ``mysql.client`` ----------------- +^^^^^^^^^^^^^^^^ Install the MySQL client package on Linux. ``mysql.server`` ----------------- +^^^^^^^^^^^^^^^^ Install the MySQL server package and start the service. @@ -52,28 +82,28 @@ Debian OS family supports setting MySQL root password during install via debconf newly available ``random.get_str`` method. ``mysql.server_checks`` ------------------------ +^^^^^^^^^^^^^^^^^^^^^^^ Enforces a root password to be set. ``mysql.disabled`` ------------------- +^^^^^^^^^^^^^^^^^^ Ensure that the MySQL service is not running. ``mysql.database`` ------------------- +^^^^^^^^^^^^^^^^^^ Create and manage MySQL databases. ``mysql.python`` ----------------- +^^^^^^^^^^^^^^^^ Install mysql python bindings. ``mysql.user`` --------------- +^^^^^^^^^^^^^^ Create and manage MySQL database users with definable GRANT privileges. @@ -88,7 +118,7 @@ priority. Make sure to **quote the passwords** in the pillar so YAML doesn't throw an exception. ``mysql.remove_test_database`` ------------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. warning:: @@ -100,7 +130,7 @@ MySQL installation. This state is **not** included as part of the meta-state above as this name may conflict with a real database. ``mysql.dev`` -------------- +^^^^^^^^^^^^^ Install the MySQL development libraries and header files. @@ -109,7 +139,7 @@ Install the MySQL development libraries and header files. your pillar data accordingly. ``mysql.repo`` --------------- +^^^^^^^^^^^^^^ Add the official MySQL 5.7 repository. @@ -120,7 +150,7 @@ Add the official MySQL 5.7 repository. changed enabled repository accordingly. ``mysql.config`` ------------------- +^^^^^^^^^^^^^^^^^^ Manage the MySQL configuration. @@ -135,3 +165,49 @@ Manage the MySQL configuration. component keys (`mysql.server`, `mysql.galera`, `mysql.libraries`, etc) with optional global configuration from `mysql.global`. The monolithic configuration, however, is defined separately in `mysql.config`. + + +Testing +------- + +Linux testing is done with ``kitchen-salt``. + +Requirements +^^^^^^^^^^^^ + +* Ruby +* Docker + +.. code-block:: bash + + $ gem install bundler + $ bundle install + $ bin/kitchen test [platform] + +Where ``[platform]`` is the platform name defined in ``kitchen.yml``, +e.g. ``debian-9-2019-2-py3``. + +``bin/kitchen converge`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Creates the docker instance and runs the ``mysql`` main state, ready for testing. + +``bin/kitchen verify`` +^^^^^^^^^^^^^^^^^^^^^^ + +Runs the ``inspec`` tests on the actual instance. + +``bin/kitchen destroy`` +^^^^^^^^^^^^^^^^^^^^^^^ + +Removes the docker instance. + +``bin/kitchen test`` +^^^^^^^^^^^^^^^^^^^^ + +Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``. + +``bin/kitchen login`` +^^^^^^^^^^^^^^^^^^^^^ + +Gives you SSH access to the instance for manual testing. diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..84eff78 --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,166 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# For help on this file's format, see https://kitchen.ci/ +driver: + name: docker + use_sudo: false + privileged: true + run_command: /lib/systemd/systemd + +# Make sure the platforms listed below match up with +# the `env.matrix` instances defined in `.travis.yml` +platforms: + ## SALT `master` + - name: debian-10-master-py3 + driver: + image: saltimages/salt-master-py3:debian-10 + - name: ubuntu-2004-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-20.04 + - name: ubuntu-1804-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-18.04 + - name: centos-8-master-py3 + driver: + image: saltimages/salt-master-py3:centos-8 + - name: fedora-32-master-py3 + driver: + image: saltimages/salt-master-py3:fedora-32 + - name: fedora-31-master-py3 + driver: + image: saltimages/salt-master-py3:fedora-31 + - name: opensuse-leap-152-master-py3 + driver: + image: saltimages/salt-master-py3:opensuse-leap-15.2 + run_command: /usr/lib/systemd/systemd + # Workaround to avoid intermittent failures on `opensuse-leap-15.2`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: amazonlinux-2-master-py3 + driver: + image: saltimages/salt-master-py3:amazonlinux-2 + + ## SALT `3000.3` + - name: debian-10-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:debian-10 + - name: debian-9-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:debian-9 + - name: ubuntu-1804-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:ubuntu-18.04 + - name: centos-8-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:centos-8 + - name: centos-7-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:centos-7 + - name: fedora-31-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:fedora-31 + - name: opensuse-leap-152-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:opensuse-leap-15.2 + run_command: /usr/lib/systemd/systemd + # Workaround to avoid intermittent failures on `opensuse-leap-15.2`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: amazonlinux-2-3000-3-py3 + driver: + image: saltimages/salt-3000.3-py3:amazonlinux-2 + - name: ubuntu-1804-3000-3-py2 + driver: + image: saltimages/salt-3000.3-py2:ubuntu-18.04 + - name: ubuntu-1604-3000-3-py2 + driver: + image: saltimages/salt-3000.3-py2:ubuntu-16.04 + - name: arch-base-latest-3000-3-py2 + driver: + image: saltimages/salt-3000.3-py2:arch-base-latest + run_command: /usr/lib/systemd/systemd + + ## SALT `2019.2` + - name: debian-10-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:debian-10 + - name: debian-9-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:debian-9 + - name: ubuntu-1804-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:ubuntu-18.04 + - name: ubuntu-1604-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:ubuntu-16.04 + - name: centos-8-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:centos-8 + - name: centos-7-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:centos-7 + - name: fedora-31-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:fedora-31 + - name: opensuse-leap-152-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:opensuse-leap-15.2 + run_command: /usr/lib/systemd/systemd + # Workaround to avoid intermittent failures on `opensuse-leap-15.2`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: amazonlinux-2-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:amazonlinux-2 + - name: centos-6-2019-2-py2 + driver: + image: saltimages/salt-2019.2-py2:centos-6 + run_command: /sbin/init + - name: amazonlinux-1-2019-2-py2 + driver: + image: saltimages/salt-2019.2-py2:amazonlinux-1 + run_command: /sbin/init + - name: arch-base-latest-2019-2-py2 + driver: + image: saltimages/salt-2019.2-py2:arch-base-latest + run_command: /usr/lib/systemd/systemd + +provisioner: + name: salt_solo + log_level: debug + salt_install: none + require_chef: false + formula: mysql + salt_copy_filter: + - .kitchen + - .git + +verifier: + # https://www.inspec.io/ + name: inspec + sudo: true + # cli, documentation, html, progress, json, json-min, json-rspec, junit + reporter: + - cli + +suites: + - name: default + provisioner: + state_top: + base: + '*': + - mysql + pillars: + top.sls: + base: + '*': + - mysql + pillars_from_files: + mysql.sls: test/salt/pillar/mysql.sls + verifier: + inspec_tests: + - path: test/integration/default diff --git a/mysql/apparmor.sls b/mysql/apparmor.sls index 41f3748..1cc542d 100644 --- a/mysql/apparmor.sls +++ b/mysql/apparmor.sls @@ -1,4 +1,4 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} {%- if "apparmor" in mysql.config %} diff --git a/mysql/client.sls b/mysql/client.sls index 92f9ee3..927f170 100644 --- a/mysql/client.sls +++ b/mysql/client.sls @@ -1,7 +1,7 @@ include: - .config -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} mysql: pkg.installed: diff --git a/mysql/config.sls b/mysql/config.sls index 1d3d343..440120e 100644 --- a/mysql/config.sls +++ b/mysql/config.sls @@ -1,100 +1,100 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} -{% set os_family = salt['grains.get']('os_family', None) %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} +{%- set os_family = salt['grains.get']('os_family', None) %} -{% if "config_directory" in mysql %} +{%- if "config_directory" in mysql %} mysql_config_directory: file.directory: - name: {{ mysql.config_directory }} - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - user: root - group: root - mode: 755 - {% endif %} + {%- endif %} - makedirs: True -{% if "server_config" in mysql %} +{%- if "server_config" in mysql %} mysql_server_config: file.managed: - name: {{ mysql.config_directory + mysql.server_config.file }} - template: jinja - source: salt://{{ tpldir }}/files/server.cnf - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - context: tpldir: {{ tpldir }} - user: root - group: root - mode: 644 - {% endif %} + {%- endif %} - require: - file: mysql_config_directory -{% endif %} +{%- endif %} -{% if "galera_config" in mysql %} +{%- if "galera_config" in mysql %} mysql_galera_config: file.managed: - name: {{ mysql.config_directory + mysql.galera_config.file }} - template: jinja - source: salt://{{ tpldir }}/files/galera.cnf - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - context: tpldir: {{ tpldir }} - user: root - group: root - mode: 644 - {% endif %} + {%- endif %} - require: - file: mysql_config_directory -{% endif %} +{%- endif %} -{% if "library_config" in mysql %} +{%- if "library_config" in mysql %} mysql_library_config: file.managed: - name: {{ mysql.config_directory + mysql.library_config.file }} - template: jinja - source: salt://{{ tpldir }}/files/client.cnf - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - context: tpldir: {{ tpldir }} - user: root - group: root - mode: 644 - {% endif %} + {%- endif %} - require: - file: mysql_config_directory -{% endif %} +{%- endif %} -{% if "clients_config" in mysql %} +{%- if "clients_config" in mysql %} mysql_clients_config: file.managed: - name: {{ mysql.config_directory + mysql.clients_config.file }} - template: jinja - source: salt://{{ tpldir }}/files/mysql-clients.cnf - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - context: tpldir: {{ tpldir }} - user: root - group: root - mode: 644 - {% endif %} + {%- endif %} - require: - file: mysql_config_directory -{% endif %} +{%- endif %} -{% endif %} +{%- endif %} mysql_config: file.managed: - name: {{ mysql.config.file }} - template: jinja -{% if "config_directory" in mysql %} +{%- if "config_directory" in mysql %} - source: salt://{{ tpldir }}/files/my-include.cnf -{% else %} +{%- else %} - source: salt://{{ tpldir }}/files/my.cnf -{% endif %} +{%- endif %} - context: tpldir: {{ tpldir }} - {% if os_family in ['Debian', 'Gentoo', 'RedHat'] %} + {%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %} - user: root - group: root - mode: 644 - {% endif %} + {%- endif %} diff --git a/mysql/database.sls b/mysql/database.sls index 977a052..0f9796e 100644 --- a/mysql/database.sls +++ b/mysql/database.sls @@ -1,34 +1,46 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} -{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} -{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} -{% set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} -{% set db_states = [] %} +{%- set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} +{%- set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} +{%- set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} +{%- set db_states = [] %} -{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} -{% set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} +{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} +{%- set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} include: - .python -{% for database_obj in salt['pillar.get']('mysql:database', []) %} -{% set state_id = 'mysql_db_' ~ loop.index0 %} -{% set database = database_obj.get('name') if database_obj is mapping else database_obj %} +{%- for database_obj in salt['pillar.get']('mysql:database', []) %} +{%- set state_id = 'mysql_db_' ~ loop.index0 %} +{%- if not database_obj %}{# in case database_obj == [] #} +{%- continue %} +{%- elif database_obj is mapping %} +{%- set database = database_obj.get('name') %} +{%- set present = database_obj.get('present', True) %} +{%- else %} +{%- set database = database_obj %} +{%- set present = True %} +{%- endif %} {{ state_id }}: + {%- if present %} mysql_database.present: + {%- if database_obj is mapping %} + - character_set: {{ database_obj.get('character_set', '') }} + - collate: {{ database_obj.get('collate', '') }} + {%- endif %} + {%- else %} + mysql_database.absent: + {%- endif %} - name: {{ database }} - connection_host: '{{ mysql_host }}' - connection_user: '{{ mysql_salt_user }}' - {% if mysql_salt_pass %} + {%- if mysql_salt_pass %} - connection_pass: '{{ mysql_salt_pass }}' - {% endif %} - {% if database_obj is mapping %} - - character_set: {{ database_obj.get('character_set', '') }} - - collate: {{ database_obj.get('collate', '') }} - {% endif %} + {%- endif %} - connection_charset: utf8 -{% if salt['pillar.get'](['mysql', 'schema', database, 'load']|join(':'), False) %} +{%- if salt['pillar.get'](['mysql', 'schema', database, 'load']|join(':'), False) %} {{ state_id }}_schema: file.managed: - name: /etc/mysql/{{ database }}.schema @@ -38,17 +50,17 @@ include: {%- if template_type %} - template: {{ template_type }} - context: {{ template_context|yaml }} -{% endif %} +{%- endif %} - user: {{ salt['pillar.get']('mysql:server:user', 'mysql') }} - makedirs: True {{ state_id }}_load: cmd.wait: - - name: mysql -u {{ mysql_salt_user }} -h{{ mysql_host }} {% if mysql_salt_pass %}-p{% endif %}{{ mysql_salt_pass }} {{ database }} < /etc/mysql/{{ database }}.schema + - name: mysql -u {{ mysql_salt_user }} -h{{ mysql_host }} {% if mysql_salt_pass %}-p{%- endif %}{{ mysql_salt_pass }} {{ database }} < /etc/mysql/{{ database }}.schema - watch: - file: {{ state_id }}_schema - mysql_database: {{ state_id }} -{% endif %} +{%- endif %} -{% do db_states.append(state_id) %} -{% endfor %} +{%- do db_states.append(state_id) %} +{%- endfor %} diff --git a/mysql/defaults.yaml b/mysql/defaults.yaml index f8854a0..83f556d 100644 --- a/mysql/defaults.yaml +++ b/mysql/defaults.yaml @@ -1,10 +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 - pythonpkg: python-mysqldb devpkg: mysql-devel debconf_utils: debconf-utils @@ -26,8 +26,9 @@ mysql: macos: userhomes: /Users - user: - group: + # `user` and `group` are set from `map.jinja` + # user: ~ + # group: ~ dl: tmpdir: /tmp/mysqltmp prefix: /usr/local @@ -36,65 +37,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' - connnector: + connector: + 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/dev.sls b/mysql/dev.sls index e1dd90b..4f7e19f 100644 --- a/mysql/dev.sls +++ b/mysql/dev.sls @@ -1,4 +1,4 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} mysql_dev: pkg: diff --git a/mysql/disabled.sls b/mysql/disabled.sls index fde0478..7466d47 100644 --- a/mysql/disabled.sls +++ b/mysql/disabled.sls @@ -1,4 +1,4 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} mysql: service.dead: diff --git a/mysql/files/mac_shortcut.sh b/mysql/files/mac_shortcut.sh index 96e1163..b65712c 100755 --- a/mysql/files/mac_shortcut.sh +++ b/mysql/files/mac_shortcut.sh @@ -2,10 +2,10 @@ CMD='/usr/bin/osascript -e' -if [[ -e "{{ home }}/{{ user }}/Desktop/{{ app }}" ]] && [[ "${1}" -eq "remove" ]] +if [[ -e "{{ home }}/{{ user }}/Desktop/{{ app }}" ]] && [[ "${1}" == "remove" ]] then $CMD "tell application \"Finder\" to delete POSIX file \"{{home}}/{{user}}/Desktop/{{ app }}\"" -elif [[ -e "{{ dir }}/{{ app ~ '.app' if suffix else app }}" ]] && [[ "${1}" -eq "add" ]] +elif [[ -e "{{ dir }}/{{ app ~ '.app' if suffix else app }}" ]] && [[ "${1}" == "add" ]] then $CMD "tell application \"Finder\" to delete POSIX file \"{{home}}/{{user}}/Desktop/{{ app }}\"" >/dev/null 2>&1 $CMD "tell application \"Finder\" to make new Alias at (path to desktop folder) to POSIX file \"{{ dir }}/{{ app }}{{ suffix or '' }}\"" diff --git a/mysql/init.sls b/mysql/init.sls index a84c016..3c3ee92 100644 --- a/mysql/init.sls +++ b/mysql/init.sls @@ -1,32 +1,32 @@ -{% from tpldir ~ '/database.sls' import db_states with context %} -{% from tpldir ~ '/user.sls' import user_states with context %} +{%- from tpldir ~ '/database.sls' import db_states with context %} +{%- from tpldir ~ '/user.sls' import user_states with context %} -{% macro requisites(type, states) %} +{%- macro requisites(type, states) %} {%- for state in states %} - {{ type }}: {{ state }} {%- endfor -%} -{% endmacro %} +{%- endmacro %} -{% set mysql_dev = salt['pillar.get']('mysql:dev:install', False) %} -{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', False) %} +{%- set mysql_dev = salt['pillar.get']('mysql:dev:install', False) %} +{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', False) %} include: - .server -{% if mysql_salt_user %} +{%- if mysql_salt_user %} - .salt-user -{% endif %} +{%- endif %} - .database - .user -{% if mysql_dev %} +{%- if mysql_dev %} - .dev -{% endif %} +{%- endif %} -{% if (db_states|length() + user_states|length()) > 0 %} +{%- if (db_states|length() + user_states|length()) > 0 %} extend: mysqld-service-running: service: - require_in: {{ requisites('mysql_database', db_states) }} {{ requisites('mysql_user', user_states) }} -{% endif %} +{%- endif %} diff --git a/mysql/macos/install.sls b/mysql/macos/install.sls index 7e5509b..be74678 100644 --- a/mysql/macos/install.sls +++ b/mysql/macos/install.sls @@ -9,29 +9,25 @@ mysql-macos-extract-dirs: file.directory: - name: {{ dl.tmpdir }} - makedirs: True - - clean: True {%- for product, data in mysql.macos.products.items() if "enabled" in data and data.enabled %} {%- set archivefile = data.url.split('/')[-1] %} {%- set archiveformat = archivefile.split('.')[-1] %} {%- set archivename = archivefile|replace('.dmg', '')|replace('.tar.gz', '')|replace('.zip', '') %} -mysql-macos-remove-previous-{{ product }}-download-archive: - file.absent: - - name: {{ dl.tmpdir }}/{{ archivefile }} - - require_in: - - mysql-macos-download-{{ product }}-archive - mysql-macos-download-{{ product }}-archive: pkg.installed: - name: curl cmd.run: - name: curl {{ dl.opts }} -o {{ dl.tmpdir }}/{{ archivefile }} {{ data.url }} - {% if grains['saltversioninfo'] >= [2017, 7, 0] %} + - unless: test -f {{ dl.tmpdir }}/{{ archivefile }} + {%- if grains['saltversioninfo'] >= [2017, 7, 0] %} - retry: attempts: {{ dl.retries }} interval: {{ dl.interval }} - {% endif %} + until: True + splay: 10 + {%- endif %} - require: - mysql-macos-extract-dirs @@ -41,8 +37,8 @@ mysql-macos-check-{{ product }}-archive-hash: - name: file.check_hash - path: {{ dl.tmpdir }}/{{ archivefile }} - file_hash: {{ data.sum }} - - onchanges: - - mysql-macos-download-{{ product }}-archive + - require: + - cmd: mysql-macos-download-{{ product }}-archive - require_in: - mysql-macos-{{ product }}-install {%- endif %} @@ -68,10 +64,7 @@ mysql-macos-{{ product }}-install: - source_hash: {{ data.sum }} - onchanges: - mysql-macos-download-{{ product }}-archive - {%- endif %} - - require_in: - - mysql-macos-tidyup-{{ product }} {%- if "path" in data and data.path and "app" in data and data.app %} @@ -100,12 +93,4 @@ mysql-macos-{{ product }}-desktop-shortcut-add: - file: mysql-macos-{{ product }}-desktop-shortcut-add {%- endif %} - -mysql-macos-tidyup-{{ product }}: - file.absent: - - name: {{ dl.tmpdir }}/{{ archivefile }} - - onchanges: - - mysql-macos-download-{{ product }}-archive - - {% endfor %} - + {%- endfor %} 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 eb306dc..2ddb339 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 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 @@ -29,9 +22,9 @@ Debian: thread_cache_size: 8 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 @@ -40,31 +33,18 @@ Debian: key_buffer_size: 16M append: | !includedir /etc/mysql/conf.d/ - # {% if 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 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: + 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 @@ -73,26 +53,24 @@ RedHat: Suse: serverpkg: mariadb clientpkg: mariadb-client - {%- if salt['grains.get']('osmajorrelease')|int == 42 %} - # "old" package name up to Leap 42.x - pythonpkg: python-PyMySQL - {% else %} - pythonpkg: python2-pymysql - {% endif %} + pythonpkg: python3-PyMySQL config: file: /etc/my.cnf sections: client: - socket: /var/run/mysql/mysql.sock + socket: /run/mysql/mysql.sock mysqld: + # Empty values below to be resolved, disabling the rule in the meantime + # yamllint disable rule:empty-values port: user: socket: - datadir: + datadir: tmpdir: + # yamllint enable rule:empty-values 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: @@ -107,6 +85,8 @@ Arch: clientpkg: mariadb-clients service: mysqld pythonpkg: mysql-python + # Empty value below to be resolved, disabling the rule in the meantime + # yamllint disable-line rule:empty-values dev: config: @@ -176,7 +156,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 @@ -186,7 +166,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 @@ -215,7 +196,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 @@ -223,20 +204,23 @@ Gentoo: interactive_timeout: noarg_present FreeBSD: - serverpkg: mysql56-server - clientpkg: mysql56-client + serverpkg: mysql57-server + clientpkg: mysql57-client service: mysql-server - pythonpkg: py27-pymysql - devpkg: mysql56-server + pythonpkg: py37-pymysql + devpkg: mysql57-server config: - file: /usr/local/etc/my.cnf + file: /usr/local/etc/mysql/my.cnf sections: client: socket: /tmp/mysql.sock mysqld: + # Empty values below to be resolved, disabling the rule in the meantime + # yamllint disable rule:empty-values user: - datadir: + datadir: /var/db/mysql + # yamllint enable rule:empty-values socket: /tmp/mysql.sock skip-external-locking: noarg_present key_buffer_size: 16M diff --git a/mysql/osfingermap.yaml b/mysql/osfingermap.yaml new file mode 100644 index 0000000..9d98126 --- /dev/null +++ b/mysql/osfingermap.yaml @@ -0,0 +1,76 @@ +# -*- 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-20.04: + 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-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 37e7d8c..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 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/mysql/python.sls b/mysql/python.sls index cecc83f..736ecca 100644 --- a/mysql/python.sls +++ b/mysql/python.sls @@ -1,5 +1,6 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} mysql_python: pkg.installed: - name: {{ mysql.pythonpkg }} + - reload_modules: True diff --git a/mysql/remove_test_database.sls b/mysql/remove_test_database.sls index bb3204f..1286558 100644 --- a/mysql/remove_test_database.sls +++ b/mysql/remove_test_database.sls @@ -1,8 +1,8 @@ -{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} -{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} -{% set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} -{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} -{% set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} +{%- set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} +{%- set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} +{%- set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} +{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} +{%- set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} include: - .python @@ -13,7 +13,7 @@ mysql remove test database: - host: '{{ mysql_host }}' - connection_user: '{{ mysql_salt_user }}' - connection_host: '{{ mysql_host }}' - {% if mysql_salt_pass %} + {%- if mysql_salt_pass %} - connection_pass: '{{ mysql_salt_pass }}' - {% endif %} + {%- endif %} - connection_charset: utf8 diff --git a/mysql/repo.sls b/mysql/repo.sls index c3f4ff9..dde0099 100644 --- a/mysql/repo.sls +++ b/mysql/repo.sls @@ -1,26 +1,26 @@ include: - .config -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} # Completely ignore non-RHEL based systems # TODO: Add Debian and Suse systems. # TODO: Allow user to specify MySQL version and alter yum repo file accordingly. -{% if grains['os_family'] == 'RedHat' %} - {% if grains['osmajorrelease']|int == 5 %} - {% set rpm_source = "http://repo.mysql.com/mysql57-community-release-el5.rpm" %} - {% elif grains['osmajorrelease']|int == 6 %} - {% set rpm_source = "http://repo.mysql.com/mysql57-community-release-el6.rpm" %} - {% elif grains['osmajorrelease']|int == 7 %} - {% set rpm_source = "http://repo.mysql.com/mysql57-community-release-el7.rpm" %} - {% endif %} -{% endif %} +{%- if grains['os_family'] == 'RedHat' and 'osmajorrelease' in grains %} + {%- if grains['osmajorrelease']|int == 5 %} + {%- set rpm_source = "http://repo.mysql.com/mysql57-community-release-el5.rpm" %} + {%- elif grains['osmajorrelease']|int == 6 %} + {%- set rpm_source = "http://repo.mysql.com/mysql57-community-release-el6.rpm" %} + {%- elif grains['osmajorrelease']|int == 7 %} + {%- set rpm_source = "http://repo.mysql.com/mysql57-community-release-el7.rpm" %} + {%- endif %} +{%- endif %} -{% set mysql57_community_release = salt['pillar.get']('mysql:release', false) %} +{%- set mysql57_community_release = salt['pillar.get']('mysql:release', false) %} # A lookup table for MySQL Repo GPG keys & RPM URLs for various RedHat releases - {% set pkg = { + {%- set pkg = { 'key': 'http://repo.mysql.com/RPM-GPG-KEY-mysql', - 'key_hash': 'md5=472a4a4867adfd31a68e8c9bbfacc23d', + 'key_hash': 'md5=162ec8cb41add661b357e926a083b0cc', 'rpm': rpm_source } %} @@ -38,12 +38,12 @@ mysql57_community_release: - require: - file: install_pubkey_mysql - require_in: - {% if "server_config" in mysql %} + {%- if "server_config" in mysql %} - pkg: {{ mysql.serverpkg }} - {% endif %} - {% if "clients_config" in mysql %} + {%- endif %} + {%- if "clients_config" in mysql %} - pkg: {{ mysql.clientpkg }} - {% endif %} + {%- endif %} set_pubkey_mysql: file.replace: diff --git a/mysql/salt-user.sls b/mysql/salt-user.sls index 31df7f6..8e88618 100644 --- a/mysql/salt-user.sls +++ b/mysql/salt-user.sls @@ -1,20 +1,20 @@ include: - .server -{% set os_family = salt['grains.get']('os_family', None) %} -{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', 'salt') %} -{% set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', salt['grains.get']('server_id')) %} -{% set mysql_salt_grants = salt['pillar.get']('mysql:salt_user:grants', []) %} -{% set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} -{% set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} -{% set mysql_root_hash = salt['pillar.get']('mysql:server:root_password_hash', None) %} +{%- set os_family = salt['grains.get']('os_family', None) %} +{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', 'salt') %} +{%- set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', salt['grains.get']('server_id')) %} +{%- set mysql_salt_grants = salt['pillar.get']('mysql:salt_user:grants', []) %} +{%- set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} +{%- set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} +{%- set mysql_root_hash = salt['pillar.get']('mysql:server:root_password_hash', None) %} -{% set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} -{% if mysql_host == 'localhost' %} -{% set host = 'localhost' %} -{% else %} -{% set host = grains['fqdn'] %} -{% endif %} +{%- set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} +{%- if mysql_host == 'localhost' %} +{%- set host = 'localhost' %} +{%- else %} +{%- set host = grains['fqdn'] %} +{%- endif %} mysql_salt_user_with_salt_user: mysql_user.present: @@ -25,13 +25,13 @@ mysql_salt_user_with_salt_user: - connection_user: '{{ mysql_salt_user }}' - connection_pass: '{{ mysql_salt_pass }}' - connection_charset: utf8 - - onlyif: - - mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -h {{ mysql_host }} --execute="SELECT 1;" - - VALUE=$(mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'Y' ]; then /bin/true; else /bin/false; fi -{% if os_family in ['RedHat', 'Suse'] %} + # - onlyif: + # - mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -h {{ mysql_host }} --execute="SELECT 1;" + # - VALUE=$(mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'Y' ]; then /bin/true; else /bin/false; fi +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} +{%- endif %} {%- if mysql_salt_grants != [] %} mysql_salt_user_with_salt_user_grants: @@ -51,11 +51,11 @@ mysql_salt_user_with_salt_user_grants: - VALUE=$(mysql --user {{ mysql_salt_user }} --password='{{ mysql_salt_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'Y' ]; then /bin/true; else /bin/false; fi - require: - mysql_user: mysql_salt_user_with_salt_user -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} -{% endif %} +{%- endif %} +{%- endif %} mysql_salt_user_with_root_user: mysql_user.present: @@ -69,10 +69,10 @@ mysql_salt_user_with_root_user: - onlyif: - mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -h {{ mysql_host }} --execute="SELECT 1;" - VALUE=$(mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} +{%- endif %} {%- if mysql_salt_grants != [] %} mysql_salt_user_with_root_user_grants: @@ -92,11 +92,11 @@ mysql_salt_user_with_root_user_grants: - VALUE=$(mysql --user {{ mysql_root_user }} --password='{{ mysql_root_pass|replace("'", "'\"'\"'") }}' -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi - require: - mysql_user: mysql_salt_user_with_root_user -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} -{% endif %} +{%- endif %} +{%- endif %} mysql_salt_user_with_passwordless_root_user: mysql_user.present: @@ -109,10 +109,10 @@ mysql_salt_user_with_passwordless_root_user: - onlyif: - mysql --user {{ mysql_root_user }} -h {{ mysql_host }} --execute="SELECT 1;" - VALUE=$(mysql --user {{ mysql_root_user }} -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} +{%- endif %} {%- if mysql_salt_grants != [] %} mysql_salt_user_with_passwordless_root_user_grants: @@ -131,13 +131,13 @@ mysql_salt_user_with_passwordless_root_user_grants: - VALUE=$(mysql --user {{ mysql_root_user }} -ss -e "SELECT Grant_priv FROM mysql.user WHERE user = '{{ mysql_salt_user }}' AND host = '{{ host }}';"); if [ "$VALUE" = 'N' -o -z "$VALUE" ]; then /bin/true; else /bin/false; fi - require: - mysql_user: mysql_salt_user_with_passwordless_root_user -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} - require_in: - mysql_user: mysql_root_password -{% endif %} -{% endif %} +{%- endif %} +{%- endif %} -{% if os_family in ['RedHat', 'Suse'] %} +{%- if os_family in ['RedHat', 'Suse'] %} extend: mysql_root_password: cmd.run: @@ -157,4 +157,4 @@ extend: - connection_user: '{{ mysql_salt_user }}' - connection_pass: '{{ mysql_salt_pass }}' - connection_charset: utf8 -{% endif %} +{%- endif %} diff --git a/mysql/server.sls b/mysql/server.sls index 6d5160c..d1375ed 100644 --- a/mysql/server.sls +++ b/mysql/server.sls @@ -42,7 +42,7 @@ mysql_debconf: - require: - pkg: mysql_debconf_utils - {% if salt['grains.get']('osmajorrelease')|int < 9 or not salt['grains.get']('os')|lower == 'debian' %} + {%- if 'osmajorrelease' in grains and salt['grains.get']('osmajorrelease')|int < 9 or not salt['grains.get']('os')|lower == 'debian' %} {% if mysql.serverpkg == 'mysql-community-server' %} mysql_password_debconf: @@ -71,7 +71,7 @@ mysql_password_debconf: {% endif %} {% endif %} -{% elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %} +{%- elif os_family in ['RedHat', 'Suse', 'FreeBSD'] %} mysql_root_password: cmd.run: - name: mysqladmin --host "{{ mysql_host }}" --user {{ mysql_root_user }} password '{{ mysql_root_password|replace("'", "'\"'\"'") }}' @@ -79,7 +79,7 @@ mysql_root_password: - require: - service: mysqld-service-running -{% for host in {'localhost': '', 'localhost.localdomain': '', salt['grains.get']('fqdn'): ''}.keys() %} +{%- for host in {'localhost': '', 'localhost.localdomain': '', salt['grains.get']('fqdn'): ''}.keys() %} mysql_delete_anonymous_user_{{ host }}: mysql_user: - absent @@ -87,9 +87,9 @@ mysql_delete_anonymous_user_{{ host }}: - name: '' - connection_host: '{{ mysql_host }}' - connection_user: '{{ mysql_salt_user }}' - {% if mysql_salt_password %} + {%- if mysql_salt_password %} - connection_pass: '{{ mysql_salt_password }}' - {% endif %} + {%- endif %} - connection_charset: utf8 - require: - service: mysqld-service-running @@ -100,19 +100,19 @@ mysql_delete_anonymous_user_{{ host }}: {%- if (mysql_salt_user != mysql_root_user) %} - sls: mysql.salt-user {%- endif %} -{% endfor %} -{% endif %} -{% endif %} +{%- endfor %} +{%- endif %} +{%- endif %} -{% if os_family == 'Arch' %} +{%- if os_family == 'Arch' %} # on arch linux: inital mysql datadirectory is not created mysql_install_datadir: cmd.run: -{% if mysql.version is defined and mysql.version >= 5.7 %} +{%- if mysql.version is defined and mysql.version >= 5.7 %} - name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir={{ mysql_datadir }} -{% else %} +{%- else %} - name: mysql_install_db --user=mysql --basedir=/usr --datadir={{ mysql_datadir }} -{% endif %} +{%- endif %} - runas: root - creates: {{ mysql_datadir }}/mysql/user.frm - env: @@ -122,33 +122,33 @@ mysql_install_datadir: - file: mysql_config - require_in: - service: mysqld-service-running -{% endif %} +{%- endif %} mysqld-packages: pkg.installed: - name: {{ mysql.serverpkg }} -{% if os_family == 'Debian' and mysql_root_password %} +{%- if os_family == 'Debian' and mysql_root_password %} - require: - debconf: mysql_debconf -{% endif %} +{%- endif %} - require_in: - file: mysql_config -{% if "config_directory" in mysql %} +{%- if "config_directory" in mysql %} - file: mysql_config_directory -{% endif %} +{%- endif %} -{% if os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server' %} +{%- if os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server' %} # Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out. mysql_initialize: cmd.run: - name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir={{ mysql_datadir }} - runas: root - - creates: {{ mysql_datadir}}/mysql/ + - creates: {{ mysql_datadir }}/mysql/ - require: - pkg: {{ mysql.serverpkg }} -{% endif %} +{%- endif %} -{% if os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %} +{%- if os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %} # For MariaDB it's enough to only create the datadir mysql_initialize: file.directory: @@ -158,17 +158,33 @@ mysql_initialize: - makedirs: True - require: - pkg: {{ mysql.serverpkg }} -{% endif %} +{%- endif %} -{% if os_family in ['Gentoo'] %} +{%- if os_family in ['Gentoo'] %} mysql_initialize: cmd.run: - name: emerge --config {{ mysql.serverpkg }} - runas: root - - creates: {{ mysql_datadir}}/mysql/ + - creates: {{ mysql_datadir }}/mysql/ - require: - pkg: {{ mysql.serverpkg }} -{% endif %} +{%- endif %} + +{%- if os_family in ['FreeBSD'] and mysql.serverpkg.lower() != 'mariadb-server' %} +mysql_initialize: + file.directory: + - name: /var/log/mysql + - user: mysql + - group: mysql + - mode: '0750' + cmd.run: + - name: /usr/local/libexec/mysqld --initialize-insecure --user=mysql --basedir=/usr/local --datadir={{ mysql_datadir }} + - runas: root + - creates: {{ mysql_datadir }}/mysql/ + - require: + - pkg: {{ mysql.serverpkg }} + - file: /var/log/mysql +{%- endif %} mysqld-service-running: service.running: @@ -176,17 +192,17 @@ mysqld-service-running: - enable: True - require: - pkg: {{ mysql.serverpkg }} -{% if (os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server') or (os_family in ['Gentoo']) %} +{%- if (os_family in ['RedHat', 'Suse'] and mysql.version is defined and mysql.version >= 5.7 and mysql.serverpkg.lower() != 'mariadb-server') or (os_family in ['Gentoo', 'FreeBSD']) %} - cmd: mysql_initialize -{% elif os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %} +{%- elif os_family in ['RedHat', 'Suse'] and mysql.serverpkg.lower() == 'mariadb-server' %} - file: {{ mysql_datadir }} -{% endif %} +{%- endif %} - watch: - pkg: {{ mysql.serverpkg }} - file: mysql_config -{% if "config_directory" in mysql and "server_config" in mysql %} +{%- if "config_directory" in mysql and "server_config" in mysql %} - file: mysql_server_config -{% endif %} +{%- endif %} mysql_what_is_status_of_{{ mysql.service }}: cmd.run: diff --git a/mysql/user.sls b/mysql/user.sls index e729bf8..414633a 100644 --- a/mysql/user.sls +++ b/mysql/user.sls @@ -1,55 +1,64 @@ -{% from tpldir ~ "/map.jinja" import mysql with context %} +{%- from tpldir ~ "/map.jinja" import mysql with context %} {%- set mysql_root_user = salt['pillar.get']('mysql:server:root_user', 'root') %} {%- set mysql_root_pass = salt['pillar.get']('mysql:server:root_password', salt['grains.get']('server_id')) %} {%- set mysql_host = salt['pillar.get']('mysql:server:host', 'localhost') %} -{% set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} -{% set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} +{%- set mysql_salt_user = salt['pillar.get']('mysql:salt_user:salt_user_name', mysql_root_user) %} +{%- set mysql_salt_pass = salt['pillar.get']('mysql:salt_user:salt_user_password', mysql_root_pass) %} -{% set user_states = [] %} -{% set user_hosts = [] %} +{%- set user_states = [] %} +{%- set user_hosts = [] %} include: - .python -{% for name, user in salt['pillar.get']('mysql:user', {}).items() %} +{%- for name, user in salt['pillar.get']('mysql:user', {}).items() %} -{% set user_host = salt['pillar.get']('mysql:user:%s:host'|format(name)) %} -{% if user_host != '' %} - {% set user_hosts = [user_host] %} -{% else %} - {% set user_hosts = salt['pillar.get']('mysql:user:%s:hosts'|format(name)) %} -{% endif %} +{%- set user_host = salt['pillar.get']('mysql:user:%s:host'|format(name)) %} +{%- if user_host != '' %} + {%- set user_hosts = [user_host] %} +{%- else %} + {%- set user_hosts = salt['pillar.get']('mysql:user:%s:hosts'|format(name)) %} +{%- endif %} -{% if not user_hosts %} - {% set mine_target = salt['pillar.get']('mysql:user:%s:mine_hosts:target'|format(name)) %} - {% set mine_function = salt['pillar.get']('mysql:user:%s:mine_hosts:function'|format(name)) %} - {% set mine_expression_form = salt['pillar.get']('mysql:user:%s:mine_hosts:expr_form'|format(name)) %} +{%- if not user_hosts %} + {%- set mine_target = salt['pillar.get']('mysql:user:%s:mine_hosts:target'|format(name)) %} + {%- set mine_function = salt['pillar.get']('mysql:user:%s:mine_hosts:function'|format(name)) %} + {%- set mine_expression_form = salt['pillar.get']('mysql:user:%s:mine_hosts:expr_form'|format(name)) %} - {% if mine_target and mine_function and mine_expression_form %} - {% set user_hosts = salt['mine.get'](mine_target, mine_function, mine_expression_form).values() %} - {% endif %} -{% endif %} - -{% for host in user_hosts %} - -{% set state_id = 'mysql_user_' ~ name ~ '_' ~ host%} -{{ state_id }}: - mysql_user.present: - - name: {{ name }} - - host: '{{ host }}' - {%- if user['password_hash'] is defined %} - - password_hash: '{{ user['password_hash'] }}' - {%- elif user['password'] is defined and user['password'] != None %} - - password: '{{ user['password'] }}' - {%- else %} - - allow_passwordless: True + {%- if mine_target and mine_function and mine_expression_form %} + {%- set user_hosts = salt['mine.get'](mine_target, mine_function, mine_expression_form).values() %} {%- endif %} - - connection_host: '{{ mysql_host }}' - - connection_user: '{{ mysql_salt_user }}' - {% if mysql_salt_pass %} - - connection_pass: '{{ mysql_salt_pass }}' - {% endif %} - - connection_charset: utf8 +{%- endif %} + +{%- for host in user_hosts %} + +{%- set state_id = 'mysql_user_' ~ name ~ '_' ~ host %} +{{ state_id }}: + {%- if user.get('present', True) %} + mysql_user.present: + - name: {{ name }} + - host: '{{ host }}' + {%- if user['password_hash'] is defined %} + - password_hash: '{{ user['password_hash'] }}' + {%- elif user['password'] is defined and user['password'] != None %} + - password: '{{ user['password'] }}' + {%- elif user['unix_socket'] is defined and user['unix_socket'] != None %} + - allow_passwordless: True + - unix_socket: True + {%- else %} + - allow_passwordless: True + {%- endif %} + {%- else %} + mysql_user.absent: + - name: {{ name }} + - host: '{{ host }}' + {%- endif %} + - connection_host: '{{ mysql_host }}' + - connection_user: '{{ mysql_salt_user }}' + {%- if mysql_salt_pass %} + - connection_pass: '{{ mysql_salt_pass }}' + {%- endif %} + - connection_charset: utf8 {%- if 'grants' in user %} {{ state_id ~ '_grants' }}: @@ -58,72 +67,72 @@ include: - grant: {{ user['grants']|join(",") }} - database: '*.*' - grant_option: {{ user['grant_option'] | default(False) }} - {% if 'ssl' in user or 'ssl-X509' in user %} + {%- if 'ssl' in user or 'ssl-X509' in user %} - ssl_option: - SSL: {{ user['ssl'] | default(False) }} - {% if user['ssl-X509'] is defined %} + {%- if user['ssl-X509'] is defined %} - X509: {{ user['ssl-X509'] }} - {% endif %} - {% if user['ssl-SUBJECT'] is defined %} + {%- endif %} + {%- if user['ssl-SUBJECT'] is defined %} - SUBJECT: {{ user['ssl-SUBJECT'] }} - {% endif %} - {% if user['ssl-ISSUER'] is defined %} + {%- endif %} + {%- if user['ssl-ISSUER'] is defined %} - ISSUER: {{ user['ssl-ISSUER'] }} - {% endif %} - {% if user['ssl-CIPHER'] is defined %} + {%- endif %} + {%- if user['ssl-CIPHER'] is defined %} - CIPHER: {{ user['ssl-CIPHER'] }} - {% endif %} - {% endif %} + {%- endif %} + {%- endif %} - user: {{ name }} - host: '{{ host }}' - connection_host: '{{ mysql_host }}' - connection_user: '{{ mysql_salt_user }}' - {% if mysql_salt_pass -%} + {%- if mysql_salt_pass %} - connection_pass: '{{ mysql_salt_pass }}' - {% endif %} + {%- endif %} - connection_charset: utf8 - require: - mysql_user: {{ state_id }} -{% endif %} +{%- endif %} {%- if 'databases' in user %} -{% for db in user['databases'] %} +{%- for db in user['databases'] %} {{ state_id ~ '_' ~ loop.index0 }}: mysql_grants.present: - name: {{ name ~ '_' ~ db['database'] ~ '_' ~ db['table'] | default('all') }} - - grant: {{db['grants']|join(",")}} + - grant: {{ db['grants']|join(",") }} - database: '{{ db['database'] }}.{{ db['table'] | default('*') }}' - grant_option: {{ db['grant_option'] | default(False) }} - {% if 'ssl' in user or 'ssl-X509' in user %} + {%- if 'ssl' in user or 'ssl-X509' in user %} - ssl_option: - SSL: {{ user['ssl'] | default(False) }} - {% if user['ssl-X509'] is defined %} + {%- if user['ssl-X509'] is defined %} - X509: {{ user['ssl-X509'] }} - {% endif %} - {% if user['ssl-SUBJECT'] is defined %} + {%- endif %} + {%- if user['ssl-SUBJECT'] is defined %} - SUBJECT: {{ user['ssl-SUBJECT'] }} - {% endif %} - {% if user['ssl-ISSUER'] is defined %} + {%- endif %} + {%- if user['ssl-ISSUER'] is defined %} - ISSUER: {{ user['ssl-ISSUER'] }} - {% endif %} - {% if user['ssl-CIPHER'] is defined %} + {%- endif %} + {%- if user['ssl-CIPHER'] is defined %} - CIPHER: {{ user['ssl-CIPHER'] }} - {% endif %} - {% endif %} + {%- endif %} + {%- endif %} - user: {{ name }} - host: '{{ host }}' - escape: {{ db['escape'] | default(True) }} - connection_host: '{{ mysql_host }}' - connection_user: '{{ mysql_salt_user }}' - {% if mysql_salt_pass -%} + {%- if mysql_salt_pass %} - connection_pass: '{{ mysql_salt_pass }}' - {% endif %} + {%- endif %} - connection_charset: utf8 - require: - mysql_user: {{ state_id }} -{% endfor %} -{% endif %} +{%- endfor %} +{%- endif %} -{% do user_states.append(state_id) %} -{% endfor %} -{% endfor %} +{%- do user_states.append(state_id) %} +{%- endfor %} +{%- endfor %} diff --git a/pillar.example b/pillar.example index 006b2e9..17780b3 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 @@ -72,25 +75,28 @@ mysql: - name: bar character_set: utf8 collate: utf8_general_ci + # Delete DB + - name: obsolete_db + 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: @@ -106,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: localhost - ssl: True - ssl-X509: True + host: '%' # Any host + ssl: true + ssl-X509: true ssl-SUBJECT: Subject ssl-ISSUER: Name ssl-CIPHER: Cipher @@ -124,11 +130,18 @@ 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'] + + # User 'alice' will be allowed to connect to the server without password + # as long as she has access to the unix socket. + # This option forces allow_passwordless to be set to True + alice: + host: 'localhost' + unix_socket: true nopassuser: password: ~ host: localhost @@ -143,6 +156,12 @@ mysql: - database: foo grants: ['select', 'insert', 'update'] + # Remove a user + obsoleteuser: + host: localhost + # defaults to true + present: false + # Override any names defined in map.jinja # serverpkg: mysql-server # clientpkg: mysql-client @@ -153,53 +172,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' - connnector: - enabled: False #default + connector: + 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/pre-commit_semantic-release.sh b/pre-commit_semantic-release.sh new file mode 100755 index 0000000..ba80535 --- /dev/null +++ b/pre-commit_semantic-release.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +############################################################################### +# (A) Update `FORMULA` with `${nextRelease.version}` +############################################################################### +sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA + + +############################################################################### +# (B) Use `m2r` to convert automatically produced `.md` docs to `.rst` +############################################################################### + +# Install `m2r` +sudo -H pip install m2r + +# Copy and then convert the `.md` docs +cp ./*.md docs/ +cd docs/ || exit +m2r --overwrite ./*.md + +# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst` +sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst +sed -i -e '1,4s/-/=/g' CHANGELOG.rst + +# Use for debugging output, when required +# cat AUTHORS.rst +# cat CHANGELOG.rst + +# Return back to the main directory +cd .. diff --git a/release-rules.js b/release-rules.js new file mode 100644 index 0000000..c63c850 --- /dev/null +++ b/release-rules.js @@ -0,0 +1,18 @@ +// No release is triggered for the types commented out below. +// Commits using these types will be incorporated into the next release. +// +// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. +module.exports = [ + {breaking: true, release: 'major'}, + // {type: 'build', release: 'patch'}, + // {type: 'chore', release: 'patch'}, + // {type: 'ci', release: 'patch'}, + {type: 'docs', release: 'patch'}, + {type: 'feat', release: 'minor'}, + {type: 'fix', release: 'patch'}, + {type: 'perf', release: 'patch'}, + {type: 'refactor', release: 'patch'}, + {type: 'revert', release: 'patch'}, + {type: 'style', release: 'patch'}, + {type: 'test', release: 'patch'}, +]; diff --git a/release.config.js b/release.config.js new file mode 100644 index 0000000..6af7aa8 --- /dev/null +++ b/release.config.js @@ -0,0 +1,106 @@ +module.exports = { + branch: 'master', + plugins: [ + ['@semantic-release/commit-analyzer', { + preset: 'angular', + releaseRules: './release-rules.js', + }], + '@semantic-release/release-notes-generator', + ['@semantic-release/changelog', { + changelogFile: 'CHANGELOG.md', + changelogTitle: '# Changelog', + }], + ['@semantic-release/exec', { + prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}', + }], + ['@semantic-release/git', { + assets: ['*.md', 'docs/*.rst', 'FORMULA'], + }], + '@semantic-release/github', + ], + generateNotes: { + preset: 'angular', + writerOpts: { + // Required due to upstream bug preventing all types being displayed. + // Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317 + // Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410 + transform: (commit, context) => { + const issues = [] + + commit.notes.forEach(note => { + note.title = `BREAKING CHANGES` + }) + + // NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. + if (commit.type === `feat`) { + commit.type = `Features` + } else if (commit.type === `fix`) { + commit.type = `Bug Fixes` + } else if (commit.type === `perf`) { + commit.type = `Performance Improvements` + } else if (commit.type === `revert`) { + commit.type = `Reverts` + } else if (commit.type === `docs`) { + commit.type = `Documentation` + } else if (commit.type === `style`) { + commit.type = `Styles` + } else if (commit.type === `refactor`) { + commit.type = `Code Refactoring` + } else if (commit.type === `test`) { + commit.type = `Tests` + } else if (commit.type === `build`) { + commit.type = `Build System` + // } else if (commit.type === `chore`) { + // commit.type = `Maintenance` + } else if (commit.type === `ci`) { + commit.type = `Continuous Integration` + } else { + return + } + + if (commit.scope === `*`) { + commit.scope = `` + } + + if (typeof commit.hash === `string`) { + commit.shortHash = commit.hash.substring(0, 7) + } + + if (typeof commit.subject === `string`) { + let url = context.repository + ? `${context.host}/${context.owner}/${context.repository}` + : context.repoUrl + if (url) { + url = `${url}/issues/` + // Issue URLs. + commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => { + issues.push(issue) + return `[#${issue}](${url}${issue})` + }) + } + if (context.host) { + // User URLs. + commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => { + if (username.includes('/')) { + return `@${username}` + } + + return `[@${username}](${context.host}/${username})` + }) + } + } + + // remove references that already appear in the subject + commit.references = commit.references.filter(reference => { + if (issues.indexOf(reference.issue) === -1) { + return true + } + + return false + }) + + return commit + }, + }, + }, +}; diff --git a/test/integration/default/README.md b/test/integration/default/README.md new file mode 100644 index 0000000..37cf963 --- /dev/null +++ b/test/integration/default/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `default` + +This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check default +Summary +------- +Location: default +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec default +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec default --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/default/controls/packages_spec.rb b/test/integration/default/controls/packages_spec.rb new file mode 100644 index 0000000..288f3d6 --- /dev/null +++ b/test/integration/default/controls/packages_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Override by OS +package_name = 'mariadb-server' +if (os[:name] == 'suse') || (os[:name] == 'opensuse') + package_name = 'mariadb' +elsif (os[:name] == 'debian') && os[:release].start_with?('8') + package_name = 'mysql-server' +end + +control 'mysql package' do + title 'should be installed' + + describe package(package_name) do + it { should be_installed } + end +end diff --git a/test/integration/default/inspec.yml b/test/integration/default/inspec.yml new file mode 100644 index 0000000..5865baf --- /dev/null +++ b/test/integration/default/inspec.yml @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: default +title: mysql formula +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: Verify that the mysql formula is setup and configured correctly +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon + - platform-name: arch diff --git a/test/salt/pillar/mysql.sls b/test/salt/pillar/mysql.sls new file mode 100644 index 0000000..17a3124 --- /dev/null +++ b/test/salt/pillar/mysql.sls @@ -0,0 +1,226 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +mysql: + global: + client-server: + default_character_set: utf8 + + clients: + mysql: + default_character_set: utf8 + mysqldump: + default_character_set: utf8 + + library: + client: + default_character_set: utf8 + + server: + # Use this account for database admin (defaults to root) + # root_user: 'admin' + # root_password: '' - to have root@localhost without password + root_password: 'somepass' + root_password_hash: '*13883BDDBE566ECECC0501CDE9B293303116521A' + user: mysql + # If you only manage the dbs and users and the server is on + # another host + # host: 123.123.123.123 + # my.cnf sections changes + mysqld: + # you can use either underscore or hyphen in param names + bind-address: 0.0.0.0 + log_bin: /var/log/mysql/mysql-bin.log + datadir: /var/lib/mysql + port: 3307 + binlog_do_db: foo + auto_increment_increment: 5 + binlog-ignore-db: + - mysql + - sys + - information_schema + - performance_schema + mysql: + # my.cnf param that not require value + no-auto-rehash: noarg_present + + # salt_user: + # salt_user_name: 'salt' + # salt_user_password: 'someotherpass' + # grants: + # - 'all privileges' + + # Manage config + config: + file: ~/.my.cnf + sections: + client: + port: 33306 + socket: /var/lib/mysql-socket/mysql.sock + mysqld_safe: + plugin-dir: '~/mysql/plugins' + mysqld: + user: myself + port: 33306 + datadir: ~/mysql/datadir + apparmor: + dir: /etc/apparmor.d/local + file: usr.sbin.mysqld + + # Manage databases + database: + # Simple definition using default charset and collate + - foo + # Detailed definition + - name: bar + character_set: utf8 + collate: utf8_general_ci + # Delete DB + - name: obsolete_db + present: false + schema: + foo: + load: false + bar: + load: false + baz: + load: true + source: salt://{{ tpldir }}/files/baz.schema.tmpl + template: jinja + qux: + load: true + source: salt://{{ tpldir }}/files/qux.schema.tmpl + template: jinja + context: + encabulator: Turbo + girdlespring: differential + quux: + load: true + source: salt://{{ tpldir }}/files/qux.schema.tmpl + template: jinja + context: + encabulator: Retro + girdlespring: integral + + # Manage users + # you can get pillar for existing server using scripts/import_users.py script + user: + frank: + password: 'somepass' + host: localhost + databases: + - database: foo + grants: ['select', 'insert', 'update'] + escape: true + - database: bar + grants: ['all privileges'] + # bob: + # password_hash: '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4' + # host: '%' # Any host + # ssl: true + # ssl-X509: true + # ssl-SUBJECT: Subject + # ssl-ISSUER: Name + # ssl-CIPHER: Cipher + # databases: + # # https://github.com/saltstack/salt/issues/41178 + # # If you want to refer to databases using wildcards, turn off escape so + # # the renderer does not escape them, enclose the string in '`' and + # # use two '%' + # - database: '`foo\_%%`' + # grants: ['all privileges'] + # grant_option: true + # escape: false + # - database: bar + # table: foobar + # grants: ['select', 'insert', 'update', 'delete'] + nopassuser: + password: ~ + host: localhost + databases: [] + application: + password: 'somepass' + mine_hosts: + target: "G@role:database and *.example.com" + function: "network.get_hostname" + expr_form: compound + databases: + - database: foo + grants: ['select', 'insert', 'update'] + + # Remove a user + obsoleteuser: + host: localhost + # defaults to true + present: false + + # Override any names defined in map.jinja + # serverpkg: mysql-server + # clientpkg: mysql-client + # service: mysql + # pythonpkg: python-mysqldb + # devpkg: mysql-devel + # debconf_utils: debconf-utils + + # Install MySQL headers + dev: + # Install dev package - defaults to false + install: false + + macos: + products: + community_server: + 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 + # 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 + # 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 + # 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 + # 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 + # 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 + # 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 + # 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 + # 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 + # 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 + # yamllint disable-line rule:line-length + url: https://downloads.mysql.com/archives/get/file/mysql-notifier-1.1.6-src.zip + sum: 'md5=349f1994681763fd6626a8ddf6be5363'