From c48eac2c2b8140d06240b4e798ec0ce3f6be995f Mon Sep 17 00:00:00 2001 From: ts Date: Mon, 8 Oct 2018 15:13:20 +0100 Subject: [PATCH] Added new mysql stretch/kali compat --- .../mysql/CHANGELOG.md | 66 +- .../mysql_stretch_compatible/mysql/Gemfile | 94 +- .../mysql_stretch_compatible/mysql/HISTORY.md | 894 +++++++++++++ .../mysql_stretch_compatible/mysql/README.md | 926 +------------ .../mysql/REFERENCE.md | 1180 +++++++++++++++++ .../mysql_stretch_compatible/mysql/Rakefile | 74 +- .../mysql/checksums.json | 137 ++ .../mysql/examples/mysql_plugin.pp | 4 +- .../mysql/examples/mysql_user.pp | 8 +- .../mysql/lib/facter/mysqld_version.rb | 2 +- .../lib/puppet/functions/mysql/deepmerge.rb | 66 + .../lib/puppet/functions/mysql/dirname.rb | 20 + .../lib/puppet/functions/mysql/password.rb | 21 + .../lib/puppet/functions/mysql/strip_hash.rb | 19 + .../parser/functions/mysql_deepmerge.rb | 13 +- .../puppet/parser/functions/mysql_dirname.rb | 10 +- .../puppet/parser/functions/mysql_password.rb | 9 +- .../mysql/lib/puppet/provider/mysql.rb | 10 +- .../puppet/provider/mysql_datadir/mysql.rb | 6 +- .../lib/puppet/provider/mysql_user/mysql.rb | 22 +- .../mysql/lib/puppet/type/mysql_database.rb | 7 +- .../mysql/lib/puppet/type/mysql_datadir.rb | 7 +- .../mysql/lib/puppet/type/mysql_grant.rb | 8 +- .../mysql/lib/puppet/type/mysql_plugin.rb | 11 +- .../mysql/lib/puppet/type/mysql_user.rb | 7 +- .../mysql/manifests/backup/mysqlbackup.pp | 10 +- .../mysql/manifests/backup/mysqldump.pp | 7 +- .../mysql/manifests/backup/xtrabackup.pp | 11 +- .../mysql/manifests/bindings.pp | 70 +- .../mysql/manifests/bindings/client_dev.pp | 6 +- .../mysql/manifests/bindings/daemon_dev.pp | 6 +- .../mysql/manifests/bindings/java.pp | 6 +- .../mysql/manifests/bindings/perl.pp | 6 +- .../mysql/manifests/bindings/php.pp | 6 +- .../mysql/manifests/bindings/python.pp | 6 +- .../mysql/manifests/bindings/ruby.pp | 6 +- .../mysql/manifests/client.pp | 20 + .../mysql/manifests/client/install.pp | 6 +- .../mysql/manifests/db.pp | 49 +- .../mysql/manifests/params.pp | 49 +- .../mysql/manifests/server.pp | 69 +- .../manifests/server/account_security.pp | 6 +- .../mysql/manifests/server/backup.pp | 58 +- .../mysql/manifests/server/binarylog.pp | 8 +- .../mysql/manifests/server/config.pp | 12 +- .../mysql/manifests/server/install.pp | 4 + .../mysql/manifests/server/installdb.pp | 4 + .../mysql/manifests/server/monitor.pp | 13 +- .../mysql/manifests/server/mysqltuner.pp | 11 + .../mysql/manifests/server/providers.pp | 8 +- .../mysql/manifests/server/root_password.pp | 6 +- .../mysql/manifests/server/service.pp | 4 + .../mysql/metadata.json | 21 +- .../mysql/readmes/README_ja_JP.md | 983 +------------- .../mysql/readmes/REFERENCE_ja_JP.md | 1180 +++++++++++++++++ .../mysql/spec/acceptance/locales_spec.rb | 22 +- .../spec/acceptance/mysql_backup_spec.rb | 14 +- .../mysql/spec/acceptance/mysql_helper.rb | 2 +- .../spec/acceptance/mysql_server_spec.rb | 16 +- .../mysql/spec/acceptance/sql_task_spec.rb | 2 +- .../acceptance/types/mysql_database_spec.rb | 8 +- .../spec/acceptance/types/mysql_grant_spec.rb | 54 +- .../acceptance/types/mysql_plugin_spec.rb | 19 +- .../spec/acceptance/types/mysql_user_spec.rb | 14 +- .../mysql/spec/classes/mycnf_template_spec.rb | 2 +- .../mysql/spec/classes/mysql_bindings_spec.rb | 1 + .../mysql/spec/classes/mysql_client_spec.rb | 1 + .../spec/classes/mysql_server_monitor_spec.rb | 2 +- .../mysql/spec/classes/mysql_server_spec.rb | 4 +- .../mysql/spec/default_facts.yml | 2 +- .../mysql/spec/defines/mysql_db_spec.rb | 12 +- .../spec/functions/mysql_deepmerge_spec.rb | 94 ++ .../spec/functions/mysql_dirname_spec.rb | 19 + .../spec/functions/mysql_password_spec.rb | 27 + .../spec/functions/mysql_strip_hash_spec.rb | 27 + .../mysql/spec/spec_helper.rb | 21 + .../mysql/spec/spec_helper_acceptance.rb | 17 +- .../spec/unit/facter/mysqld_version_spec.rb | 2 +- .../puppet/functions/mysql_deepmerge_spec.rb | 6 +- .../puppet/functions/mysql_password_spec.rb | 4 +- .../provider/mysql_database/mysql_spec.rb | 3 +- .../puppet/provider/mysql_user/mysql_spec.rb | 13 +- .../spec/unit/puppet/type/mysql_grant_spec.rb | 4 +- .../spec/unit/puppet/type/mysql_user_spec.rb | 5 + .../mysql/templates/mysqlbackup.sh.erb | 11 + .../webapp/onlinestore/secgen_metadata.xml | 2 +- scenarios/test_scenario.xml | 6 +- 87 files changed, 4568 insertions(+), 2140 deletions(-) create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/HISTORY.md create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/REFERENCE.md create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/checksums.json create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/deepmerge.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/dirname.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/password.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/strip_hash.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/REFERENCE_ja_JP.md create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_deepmerge_spec.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_dirname_spec.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_password_spec.rb create mode 100644 modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_strip_hash_spec.rb diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md index 5e9f85f23..d9ee70215 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md @@ -1,7 +1,65 @@ # Change log -All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org). +All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). + +## [6.2.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/6.2.0) (2018-09-27) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/6.1.0...6.2.0) + +### Added + +- pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#1127](https://github.com/puppetlabs/puppetlabs-mysql/pull/1127) ([tphoney](https://github.com/tphoney)) + +### Fixed + +- \(maint\) - Change versioning comparison [\#1123](https://github.com/puppetlabs/puppetlabs-mysql/pull/1123) ([eimlav](https://github.com/eimlav)) + +## [6.1.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/6.1.0) (2018-09-13) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/6.0.0...6.1.0) + +### Fixed + +- pdksync - \(MODULES-7705\) - Bumping stdlib dependency from \< 5.0.0 to \< 6.0.0 [\#1114](https://github.com/puppetlabs/puppetlabs-mysql/pull/1114) ([pmcmaw](https://github.com/pmcmaw)) +- \(MODULES-6981\) Do not try to read ~root/.my.cnf when calling "mysqld -V" [\#1063](https://github.com/puppetlabs/puppetlabs-mysql/pull/1063) ([simondeziel](https://github.com/simondeziel)) + +## [6.0.0](https://github.com/puppetlabs/puppetlabs-mysql/tree/6.0.0) (2018-08-01) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-mysql/compare/5.4.0...6.0.0) + +### Changed + +- \[FM-6962\] Removal of unsupported OS from mysql [\#1086](https://github.com/puppetlabs/puppetlabs-mysql/pull/1086) ([david22swan](https://github.com/david22swan)) + +### Added + +- \(FM-5985\) - Addition of support for Ubuntu 18.04 to mysql [\#1104](https://github.com/puppetlabs/puppetlabs-mysql/pull/1104) ([david22swan](https://github.com/david22swan)) +- \(MODULES-7439\) - Implementing beaker-testmode\_switcher [\#1095](https://github.com/puppetlabs/puppetlabs-mysql/pull/1095) ([pmcmaw](https://github.com/pmcmaw)) +- Support for optional\_\_args and prescript to mysqldump backup provider [\#1083](https://github.com/puppetlabs/puppetlabs-mysql/pull/1083) ([eputnam](https://github.com/eputnam)) +- Allow empty user passwords [\#1075](https://github.com/puppetlabs/puppetlabs-mysql/pull/1075) ([disappear89](https://github.com/disappear89)) +- Add user tls\_options and grant options to mysql::db [\#1065](https://github.com/puppetlabs/puppetlabs-mysql/pull/1065) ([edestecd](https://github.com/edestecd)) +- Use puppet4 functions-api [\#1044](https://github.com/puppetlabs/puppetlabs-mysql/pull/1044) ([juliantodt](https://github.com/juliantodt)) +- Replaced 'DROP USER' with 'DROP USER IF EXISTS' [\#942](https://github.com/puppetlabs/puppetlabs-mysql/pull/942) ([libertamohamed](https://github.com/libertamohamed)) + +### Fixed + +- \(MODULES-7353\) Enable service for Debian 9 [\#1094](https://github.com/puppetlabs/puppetlabs-mysql/pull/1094) ([david22swan](https://github.com/david22swan)) +- Update locales test for Debian 9 [\#1091](https://github.com/puppetlabs/puppetlabs-mysql/pull/1091) ([HelenCampbell](https://github.com/HelenCampbell)) +- \[FM-7045\] Fix to allow Debian 9 test's to run clean [\#1088](https://github.com/puppetlabs/puppetlabs-mysql/pull/1088) ([david22swan](https://github.com/david22swan)) +- \(MODULES-7198\) Fix DROP USER IF EXISTS on mariadb [\#1082](https://github.com/puppetlabs/puppetlabs-mysql/pull/1082) ([hunner](https://github.com/hunner)) + +## 5.4.0 + +### Added + +- \(PDOC-210\) Puppet Strings documentation [\#1068](https://github.com/puppetlabs/puppetlabs-mysql/pull/1068) ([hunner](https://github.com/hunner)) +- Compatibility for Alpine linux [\#1049](https://github.com/puppetlabs/puppetlabs-mysql/pull/1049) ([cisco87](https://github.com/cisco87)) + +### Fixed + +- \(MODULES-6627\) Removed unused --host flag from mysqlcaller [\#1064](https://github.com/puppetlabs/puppetlabs-mysql/pull/1064) ([HelenCampbell](https://github.com/HelenCampbell)) +- Fixed archlinux compatibility [\#1057](https://github.com/puppetlabs/puppetlabs-mysql/pull/1057) ([bastelfreak](https://github.com/bastelfreak)) +- Changed input param option in export.json from sql to file [\#1054](https://github.com/puppetlabs/puppetlabs-mysql/pull/1054) ([cgoswami](https://github.com/cgoswami)) ## Supported Release [5.3.0] ### Summary @@ -878,8 +936,12 @@ configuration variables. ## 2011-06-03 - Dan Bode - 0.0.1 * initial commit +[5.4.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.3.0...5.4.0 [5.3.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.1...5.3.0 [5.2.1]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.0...5.2.1 [5.2.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.1.0...5.2.0 [5.1.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.0.0...5.1.0 [5.0.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/4.0.1...5.0.0 + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile b/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile index 2ededb50a..2707ef7be 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile @@ -1,25 +1,18 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) - if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)} - [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact - elsif place_or_version =~ %r{\Afile:\/\/(.*)} - ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] + git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} + file_url_regex = %r{\Afile:\/\/(?.*)} + + if place_or_version && (git_url = place_or_version.match(git_url_regex)) + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) + ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else [place_or_version, { require: false }] end end -def gem_type(place_or_version) - if place_or_version =~ %r{\Agit[:@]} - :git - elsif !place_or_version.nil? && place_or_version.start_with?('file:') - :file - else - :gem - end -end - ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') @@ -28,95 +21,42 @@ group :development do gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') + gem "json", '<= 2.0.4', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4') gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-blacksmith", '~> 3.4', require: false gem "puppet-lint-i18n", require: false + gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.13') - gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') - gem "beaker-pe", require: false - gem "beaker-hostgenerator" - gem "beaker-rspec" + gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "beaker-testmode_switcher", require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] -puppet_type = gem_type(puppet_version) facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] -def puppet_older_than?(version) - puppet_version = ENV['PUPPET_GEM_VERSION'] - !puppet_version.nil? && - Gem::Version.correct?(puppet_version) && - Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup)) -end - gems = {} gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment -# variables, use those versions. If not, and if the puppet version is < 3.5.0, -# use known good versions of both for puppet < 3.5.0. -if facter_version - gems['facter'] = location_for(facter_version) -elsif puppet_type == :gem && puppet_older_than?('3.5.0') - gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false] -end +# variables -if hiera_version - gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION']) -elsif puppet_type == :gem && puppet_older_than?('3.5.0') - gems['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false] -end +gems['facter'] = location_for(facter_version) if facter_version +gems['hiera'] = location_for(hiera_version) if hiera_version -if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0')) - # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows - if puppet_type == :gem - gems['ffi'] = ['1.9.0', require: false] - gems['minitar'] = ['0.5.4', require: false] - gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false] - gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false] - gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false] - gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false] - else - gems['ffi'] = ['~> 1.9.0', require: false] - gems['minitar'] = ['~> 0.5.4', require: false] - gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false] - gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false] - gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false] - gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false] - end - - gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false] - - if RUBY_VERSION.start_with?('1.') - gems['win32console'] = ['1.3.2', require: false] - # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x - gems['sys-admin'] = ['1.5.6', require: false] - end - - # Puppet < 3.7.0 requires these. - # Puppet >= 3.5.0 gem includes these as requirements. - # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0. - gems['win32-api'] = ['1.4.8', require: false] - gems['win32-taskscheduler'] = ['0.2.2', require: false] - gems['windows-api'] = ['0.4.3', require: false] - gems['windows-pr'] = ['1.2.3', require: false] -elsif Gem.win_platform? +if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} # If we're using a Puppet gem on Windows which handles its own win32-xxx gem # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). gems['win32-dir'] = ['<= 0.4.9', require: false] gems['win32-eventlog'] = ['<= 0.6.5', require: false] gems['win32-process'] = ['<= 0.7.5', require: false] gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['<= 0.8.8', require: false] + gems['win32-service'] = ['0.8.8', require: false] end gems.each do |gem_name, gem_params| diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/HISTORY.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/HISTORY.md new file mode 100644 index 000000000..740a28c85 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/HISTORY.md @@ -0,0 +1,894 @@ +## 5.4.0 + +### Added + +- \(PDOC-210\) Puppet Strings documentation [\#1068](https://github.com/puppetlabs/puppetlabs-mysql/pull/1068) ([hunner](https://github.com/hunner)) +- Compatibility for Alpine linux [\#1049](https://github.com/puppetlabs/puppetlabs-mysql/pull/1049) ([cisco87](https://github.com/cisco87)) + +### Fixed + +- \(MODULES-6627\) Removed unused --host flag from mysqlcaller [\#1064](https://github.com/puppetlabs/puppetlabs-mysql/pull/1064) ([HelenCampbell](https://github.com/HelenCampbell)) +- Fixed archlinux compatibility [\#1057](https://github.com/puppetlabs/puppetlabs-mysql/pull/1057) ([bastelfreak](https://github.com/bastelfreak)) +- Changed input param option in export.json from sql to file [\#1054](https://github.com/puppetlabs/puppetlabs-mysql/pull/1054) ([cgoswami](https://github.com/cgoswami)) + +## Supported Release [5.3.0] +### Summary +This release uses the PDK convert functionality which in return makes the module PDK compliant. It also includes a roll up of maintenance changes, a new task and support for `GRANTS FUNCTION`. + +### Added +- Add support for `GRANTS FUNCTION` ([MODULES-2075](https://tickets.puppet.com/browse/MODULES-2075)). +- Add Export database task. +- PDK Convert mysql ([MODULES-6454](https://tickets.puppet.com/browse/MODULES-6454)). + +### Changed +- Allow authentication plugin to be changed. +- Update mysql_user provider. +- Plugins don't exist before 5.5; password field name changed +- Fix helpful rubocops and disable hurtful cops. +- Addressing puppet-lint and rubocop errors +- Remove update bundler and add ignore .DS_Store +- Skip rubocop warning in task. +- Fix a typo in a classname in the changelog. + +## Supported Release [5.2.1] +### Summary +This release fixes CVE-2018-6508 which is a potential arbitrary code execution via tasks. + +### Fixed +- Fix export and mysql tasks for arbitrary remote code + +## Supported Release [5.2.0] + +### Added +- Compatibility for puppet-staging 3.0.0 + +### Fixed +- Centralize all mysql command calls for providers +- Add paths to `mysql_datadir` provider for RedHat Software Collections + +## Supported Release [5.1.0] +### Summary +This release adds Tasks to the Mysql module. + +#### Added +- Adds the execute sql task. + +## Supported Release [5.0.0] +### Summary +This is a major release that adds support for string translation. Currently the only supported language besides +English is Japanese. + +#### Added +- Several gem dependencies required for translation. +- Wrapping of strings that require translation. Strings in ruby code are now wrapped with `_()` and strings in puppet code with `translate()`. +- Debian 9 support + +#### Changed +- The default php_package_name for Debian and Ubuntu to `php-mysql` + +## Supported Release 4.0.1 +### Summary +This is a small bugfix release that makes `mysql_install_db` optional and fixes some regular expression issues. + +#### Bugfixes +- ([MODULES-5528](https://tickets.puppet.com/browse/MODULES-5528)) Fixes the `mysql_install_db` command so that it is optional +- ([MODULES-5602](https://tickets.puppet.com/browse/MODULES-5602)) Removes superfluous backslashes in some regular expressions that were causing instability + +## Supported Release 4.0.0 +### Summary +This release sees the enablement of rubocop, also an update to the lib directory with rubocop fixes and several other changes and fixes. Also a bump to the Puppet version compatibility and several Puppet language updates. + +#### Added +- Updated README.md with example how to install MySQL Community Server 5.6 on Centos 7.3 +- Enabled Rubocop and addition of Rubocop fixes for /lib directory. + +#### Removed +- Dropped legacy tests for db.pp. + +#### Changed +- Replaced validate function calls with datatypes in db.pp. +- Bumped recommended puppet version to between 4.7.0 and 6.0.0. +- Conditionalize name validation in mysql_grant type. ([MODULES-4604](https://tickets.puppet.com/browse/MODULES-4604)) + +#### Fixed +- Removal of invalid parameter provider on Mysql_user[user@localhost] in mysql::db ([MODULES-4115](https://tickets.puppet.com/browse/MODULES-4115)) +- Fixed server_service_name for Debian/stretch. +- Spec fixes for Puppet 5. +- Test update for fix:create procedure, then grant ([MODULES-5390](https://tickets.puppet.com/browse/MODULES-5390)) +- Fixing empty user/password issue for xtrabackup. Now defaults as undef instead of ''. +- Remove unsupported Ubuntu versions ([MODULES-5501](https://tickets.puppet.com/browse/MODULES-5501)) + +## Supported Release 3.11.0 +### Summary +This release includes README and metadata translations to Japanese, as well as some enhancements and bugfixes. + +#### Added +- New flag for successful backups +- Solaris support improvements +- New parameter `optional_args` for extra innobackupex options +- Specify environment variables (e.g. https_proxy) for MySQLTuner download. +- Check to only install bzip2 if `$backupcompress` is `true` +- Debian 9 compatibility +- Japanese README + +#### Fixed +- Syntax errors +- Bug where error logs were being created before the datadir was initialized (MODULES-4743) + +## Supported Release 3.10.0 +### Summary +This release includes new features for setting TLS options on a mysql user, a new parameter to allow specifying tool to import sql files, as well as various bugfixes. + +#### Features +- (MODULES-3879) Adds `import_cat_cmd` parameter to specify the command to read sql files +- Adds support for setting `tls_options` in `mysql_user` + +#### Bugfixes +- (MODULES-3557) Adds Ubuntu 16.04 package names for language bindings +- (MODULES-3907) Adds MySQL/Percona 5.7 initialize on fresh deploy + +## Supported Release 3.9.0 +### Summary +This release adds Percona 5.7 support and compatibility with Ubuntu 16.04, in addition to various bugfixes. + +#### Features +- (MODULES-3441) Adds the `mysqld_version` fact +- (MODULES-3513) Adds a new backup dump parameter `maxallowedpacket` +- Adds new parameter `xtrabackup_package_name` to `mysql::backup::xtrabackup` class +- Adds ability to revoke GRANT privilege + +#### Bugfixes +- Fixes a bug where `mysql_user` fails if facter cannot retrieve fqdn. +- Fix global parameter usage in backup script +- Adds support for `puppet-staging` version `2.0.0` +- (MODULES-3601) Moves binary logging configuration to take place after package install +- (MODULES-3711) Add limit to mysql server ID generated value +- (MODULES-3698) Fixes defaults for SLES12 +- Updates user name length restrictions for MySQL version 5.7.8 and above. +- Fixes a bug where error log is not writable by owner + +## Supported Release 3.8.0 +### Summary +This release adds Percona 5.7 support and compatibility with Ubuntu 16.04, in addition to various bugfixes. + +#### Features +- Adds support for Percona 5.7 +- Adds support for Ubuntu 16.04 (Xenial) + +#### Known Limitations +- The mysqlbackup.sh script will not work on MySQL 5.7.0 and up. + +#### Bugfixes +- Use mysql_install_db only with uniq defaults-extra-file +- Updates mysqlbackup.sh to ensure backup directory exist +- Loosen MariaDB recognition to fix it on Debian 8 +- Allow mysql::backup::mysqldump to access root_group in tests +- Fixed problem with ignoring parameters from global configs +- Fixes ordering issue that initialized mysqld before config is set +- (MODULES-1256) Fix parameters on OpenSUSE 12 +- Fixes install errors on Debian-based OS by configuring the base of includedir +- Configure the configfile location for mariadb +- Default mysqld_type return value should be 'mysql' if another type is not detected +- Make sure that bzip2 is installed before setting up the cron tab job using mysqlbackup.sh +- Fixes path issue on FreeBSD +- Check that /var/lib/mysql actually contains files +- Removes mysql regex when checking type +- (MODULES-2111) Add the system database to user related actions +- Updates default group for logfiles on Debian-based OS to 'adm' +- Fixes an issue with Amazon linux major release 4 installation +- Fixes 'mysql_install_db' script support on Gentoo +- Removes erroneous anchors to mysql::client from mysql::db +- Adds path to be able to find MySQL 5.5 installation on CentOS + +## Supported Release 3.7.0 +### Summary + +A large release with several new features. Also includes a considerable amount of bugfixes, many around compatibility and improvements to current functionality. + +#### Features + +- Now uses mariadb in OpenSuSE >= 13.1. +- Switch to rspec-puppet-facts. +- Additional function to check if table exists before grant. +- Add ability to input password hash directly. +- Now checking major release instead of specific release. +- Debian 8 support. + +#### Bugfixes + +- Minor doc update. +- Fixes improper use of function `warn` in backup manifest of server. +- Fixes to Compatibility with PE 3.3. +- Fixes `when not managing config file` in `mysql_server_spec`. +- Improved user validation and munging. +- Fixes fetching the mysql_user password for MySQL >=5.7.6. +- Fixes unique server_id within my.cnf, the issue were the entire mac address was not being read in to generate the id. +- Corrects the daemon_dev_package_name for mariadb on redhat. +- Fix version compare to properly suppress show_diff for root password. +- Fixes to ensure compatibility with future parser. +- Solaris removed from PE in metadata as its not supported. +- Use MYSQL_PWD to avoid mysqldump warnings. +- Use temp cnf file instead of env variable which creates acceptance test failures. +- No longer hash passwords that are already hashed. +- Fix Gemfile to work with ruby 1.8.7. +- Fixed MySQL 5.7.6++ compatibility. +- Fixing error when disabling service management and the service does not exist. +- Ubuntu vivid should use systemd not upstart. +- Fixed new mysql_datadir provider on CentOS for MySQl 5.7.6 compatibility. +- Ensure if service restart to wait till mysql is up. +- Move all dependencies to not have them in case of service unmanaged. +- Re-Added the ability to set a empty string as option parameter. +- Fixes edge-case with dropping pre-existing users with grants. +- Fix logic for choosing rspec version. +- Refactored main acceptance suite. +- Skip idempotency tests on test cells that do have PUP-5016 unfixed. +- Fix tmpdir to be shared across examples. +- Update to current msync configs [006831f]. +- Fix mysql_grant with MySQL ANSI_QUOTES mode. +- Generate .my.cnf for all sections. + +## Supported Release 3.6.2 +### Summary + +Small release for support of newer PE versions. This increments the version of PE in the metadata.json file. + +## 2015-09-22 - Supported Release 3.6.1 +### Summary +This is a security and bugfix release that fixes incorrect username truncation in the munge for the mysql_user type, incorrect function used in `mysql::server::backup` and fixes compatibility issues with PE 3.3.x. + +#### Bugfixes +- Loosen the regex in mysql_user munging so the username is not unintentionally truncated. +- Use `warning()` not `warn()` +- Metadata had inadvertantly dropped 3.3.x support +- Some 3.3.x compatibility issues in `mysqltuner` were corrected + +## 2015-08-10 - Supported Release 3.6.0 +### Summary +This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances. + +#### Features +- Add ability to use mysql::db WITHOUT mysql::server (ie, externally) +- Add prescript attribute to mysql::server::backup for xtrabackup +- Add postscript ability to xtrabackup provider. + +#### Bugfixes +- Fix default root passwords blocking puppet on mysql 5.8 +- Fix service dependency when package_manage is false +- Fix selinux permissions on my.cnf + +## 2015-07-23 - Supported Release 3.5.0 +### Summary +A small release to add explicit support to newer Puppet versions and accumulated patches. + +#### Features/Improvements +- Start running tests against puppet 4 +- Support longer usernames on newer MariaDB versions +- Add parameters for Solaris 11 and 12 + +#### Bugfixes +- Fix references to the mysql-server package +- mysql_server_id doesn't throw and error on machines without macaddress + +## 2015-05-19 - Supported Release 3.4.0 +### Summary +This release includes the addition of extra facts, OpenBSD compatibility, and a number of other features, improvements and bug fixes. + +#### Features/Improvements +- Added server_id fact which includes mac address for better uniqueness +- Added OpenBSD compatibility, only for 'OpenBSD -current' (due to the recent switch to mariadb) +- Added a $mysql_group parameter, and use that instead of the $root_group parameter to define the group membership of the mysql error log file. +- Updated tests for rspec-puppet 2 and future parser +- Further acceptance testing improvements +- MODULES-1928 - allow log-error to be undef +- Split package installation and database install +- README wording improvements +- Added options for including/excluding triggers and routines +- Made the 'TRIGGER' privilege of mysqldump backups depend on whether or not we are actually backing up triggers +- Cleaned up the privilege assignment in the mysqldump backup script +- Add a fact for capturing the mysql version installed + +#### Bugfixes +- mysql backup: fix regression in mysql_user call +- Set service_ensure to undef, in the case of an unmanaged service +- README Typos fixed +- Bugfix on Xtrabackup crons +- Fixed a permission problem that was preventing triggers from being backed up +- MODULES-1981: Revoke and grant difference of old and new privileges +- Fix an issue were we assume triggers work +- Change default for mysql::server::backup to ignore_triggers = false + +#### Deprecations +mysql::server::old_root_password property + +## 2015-03-03 - Supported Release 3.3.0 +### Summary +This release includes major README updates, the addition of backup providers, and a fix for managing the log-bin directory. + +#### Features +- Add package_manage parameters to `mysql::server` and `mysql::client` (MODULES-1143) +- README improvements +- Add `mysqldump`, `mysqlbackup`, and `xtrabackup` backup providers. + +#### Bugfixes +- log-error overrides were not being properly used (MODULES-1804) +- check for full path for log-bin to stop puppet from managing file '.' + +## 2015-02-09 - Supported Release 3.2.0 +### Summary +This release includes several new features and bugfixes, including support for various plugins, making the output from mysql_password more consistent when input is empty and improved username validation. + +#### Features +- Add type and provider to manage plugins +- Add support for authentication plugins +- Add support for mysql_install_db on freebsd +- Add `create_root_user` and `create_root_my_cnf` parameters to `mysql::server` + +#### Bugfixes +- Remove dependency on stdlib >= 4.1.0 (MODULES-1759) +- Make grant autorequire user +- Remove invalid parameter 'provider' from mysql_user instance (MODULES-1731) +- Return empty string for empty input in mysql_password +- Fix `mysql::account_security` when fqdn==localhost +- Update username validation (MODULES-1520) +- Future parser fix in params.pp +- Fix package name for debian 8 +- Don't start the service until the server package is installed and the config file is in place +- Test fixes +- Lint fixes + +## 2014-12-16 - Supported Release 3.1.0 +### Summary + +This release includes several new features, including SLES12 support, and a number of bug fixes. + +#### Notes + +`mysql::server::mysqltuner` has been refactored to fetch the mysqltuner script from github by default. If you are running on a non-network-connected system, you will need to download that file and have it available to your node at a path specified by the `source` parameter to the `mysqltuner` class. + +#### Features +- Add support for install_options for all package resources (MODULES-1484) +- Add log-bin directory creation +- Allow mysql::db to import multiple files (MODULES-1338) +- SLES12 support +- Improved identifier quoting detections +- Reworked `mysql::server::mysqltuner` so that we are no longer packaging the script as it is licensed under the GPL. + +#### Bugfixes +- Fix regression in username validation +- Proper containment for mysql::client in mysql::db +- Support quoted usernames of length 15 and 16 chars + +## 2014-11-11 - Supported Release 3.0.0 +### Summary + +Added several new features including MariaDB support and future parser + +#### Backwards-incompatible Changes +* Remove the deprecated `database`, `database_user`, and `database_grant` resources. The correct resources to use are `mysql`, `mysql_user`, and `mysql_grant` respectively. + +#### Features +* Add MariaDB Support +* The mysqltuner perl script has been updated to 1.3.0 based on work at http://github.com/major/MySQLTuner-perl +* Add future parse support, fixed issues with undef to empty string +* Pass the backup credentials to 'SHOW DATABASES' +* Ability to specify the Includedir for `mysql::server` +* `mysql::db` now has an import\_timeout feature that defaults to 300 +* The `mysql` class has been removed +* `mysql::server` now takes an `override_options` hash that will affect the installation +* Ability to install both dev and client dev + +#### BugFix +* `mysql::server::backup` now passes `ensure` param to the nested `mysql_grant` +* `mysql::server::service` now properly requires the presence of the `log_error` file +* `mysql::config` now occurs before `mysql::server::install_db` correctly + +## 2014-07-15 - Supported Release 2.3.1 +### Summary + +This release merely updates metadata.json so the module can be uninstalled and +upgraded via the puppet module command. + +## 2014-05-14 - Supported Release 2.3.0 + +This release primarily adds support for RHEL7 and Ubuntu 14.04 but it +also adds a couple of new parameters to allow for further customization, +as well as ensuring backups can backup stored procedures properly. + +#### Features +Added `execpath` to allow a custom executable path for non-standard mysql installations. +Added `dbname` to mysql::db and use ensure_resource to create the resource. +Added support for RHEL7 and Fedora Rawhide. +Added support for Ubuntu 14.04. +Create a warning for if you disable SSL. +Ensure the error logfile is owned by MySQL. +Disable ssl on FreeBSD. +Add PROCESS privilege for backups. + +#### Bugfixes + +#### Known Bugs +* No known bugs + +## 2014-03-04 - Supported Release 2.2.3 +### Summary + +This is a supported release. This release removes a testing symlink that can +cause trouble on systems where /var is on a seperate filesystem from the +modulepath. + +#### Features +#### Bugfixes +#### Known Bugs +* No known bugs + +## 2014-03-04 - Supported Release 2.2.2 +### Summary +This is a supported release. Mostly comprised of enhanced testing, plus a +bugfix for Suse. + +#### Bugfixes +- PHP bindings on Suse +- Test fixes + +#### Known Bugs +* No known bugs + +## 2014-02-19 - Version 2.2.1 + +### Summary + +Minor release that repairs mysql_database{} so that it sees the correct +collation settings (it was only checking the global mysql ones, not the +actual database and constantly setting it over and over since January 22nd). + +Also fixes a bunch of tests on various platforms. + + +## 2014-02-13 - Version 2.2.0 + +### Summary + +#### Features +- Add `backupdirmode`, `backupdirowner`, `backupdirgroup` to + mysql::server::backup to allow customizing the mysqlbackupdir. +- Support multiple options of the same name, allowing you to + do 'replicate-do-db' => ['base1', 'base2', 'base3'] in order to get three + lines of replicate-do-db = base1, replicate-do-db = base2 etc. + +#### Bugfixes +- Fix `restart` so it actually stops mysql restarting if set to false. +- DRY out the defaults_file functionality in the providers. +- mysql_grant fixed to work with root@localhost/@. +- mysql_grant fixed for WITH MAX_QUERIES_PER_HOUR +- mysql_grant fixed so revoking all privileges accounts for GRANT OPTION +- mysql_grant fixed to remove duplicate privileges. +- mysql_grant fixed to handle PROCEDURES when removing privileges. +- mysql_database won't try to create existing databases, breaking replication. +- bind_address renamed bind-address in 'mysqld' options. +- key_buffer renamed to key_buffer_size. +- log_error renamed to log-error. +- pid_file renamed to pid-file. +- Ensure mysql::server::root_password runs before mysql::server::backup +- Fix options_override -> override_options in the README. +- Extensively rewrite the README to be accurate and awesome. +- Move to requiring stdlib 3.2.0, shipped in PE3.0 +- Add many new tests. + + +## 2013-11-13 - Version 2.1.0 + +### Summary + +The most important changes in 2.1.0 are improvements to the my.cnf creation, +as well as providers. Setting options to = true strips them to be just the +key name itself, which is required for some options. + +The provider updates fix a number of bugs, from lowercase privileges to +deprecation warnings. + +Last, the new hiera integration functionality should make it easier to +externalize all your grants, users, and, databases. Another great set of +community submissions helped to make this release. + +#### Features +- Some options can not take a argument. Gets rid of the '= true' when an +option is set to true. +- Easier hiera integration: Add hash parameters to mysql::server to allow +specifying grants, users, and databases. + +#### Bugfixes +- Fix an issue with lowercase privileges in mysql_grant{} causing them to be reapplied needlessly. +- Changed defaults-file to defaults-extra-file in providers. +- Ensure /root/.my.cnf is 0600 and root owned. +- database_user deprecation warning was incorrect. +- Add anchor pattern for client.pp +- Documentation improvements. +- Various test fixes. + + +## 2013-10-21 - Version 2.0.1 + +### Summary + +This is a bugfix release to handle an issue where unsorted mysql_grant{} +privileges could cause Puppet to incorrectly reapply the permissions on +each run. + +#### Bugfixes +- Mysql_grant now sorts privileges in the type and provider for comparison. +- Comment and test tweak for PE3.1. + + +## 2013-10-14 - Version 2.0.0 + +### Summary + +(Previously detailed in the changelog for 2.0.0-rc1) + +This module has been completely refactored and works significantly different. +The changes are broad and touch almost every piece of the module. + +See the README.md for full details of all changes and syntax. +Please remain on 1.0.0 if you don't have time to fully test this in dev. + +* mysql::server, mysql::client, and mysql::bindings are the primary interface +classes. +* mysql::server takes an `override_options` parameter to set my.cnf options, +with the hash format: { 'section' => { 'thing' => 'value' }} +* mysql attempts backwards compatibility by forwarding all parameters to +mysql::server. + + +## 2013-10-09 - Version 2.0.0-rc5 + +### Summary + +Hopefully the final rc! Further fixes to mysql_grant (stripping out the +cleverness so we match a much wider range of input.) + +#### Bugfixes +- Make mysql_grant accept '.*'@'.*' in terms of input for user@host. + + +## 2013-10-09 - Version 2.0.0-rc4 + +### Summary + +Bugfixes to mysql_grant and mysql_user form the bulk of this rc, as well as +ensuring that values in the override_options hash that contain a value of '' +are created as just "key" in the conf rather than "key =" or "key = false". + +#### Bugfixes +- Improve mysql_grant to work with IPv6 addresses (both long and short). +- Ensure @host users work as well as user@host users. +- Updated my.cnf template to support items with no values. + + +## 2013-10-07 - Version 2.0.0-rc3 + +### Summary +Fix mysql::server::monitor's use of mysql_user{}. + +#### Bugfixes +- Fix myql::server::monitor's use of mysql_user{} to grant the proper +permissions. Add specs as well. (Thanks to treydock!) + + +## 2013-10-03 - Version 2.0.0-rc2 + +### Summary +Bugfixes + +#### Bugfixes +- Fix a duplicate parameter in mysql::server + + +## 2013-10-03 - Version 2.0.0-rc1 + +### Summary + +This module has been completely refactored and works significantly different. +The changes are broad and touch almost every piece of the module. + +See the README.md for full details of all changes and syntax. +Please remain on 1.0.0 if you don't have time to fully test this in dev. + +* mysql::server, mysql::client, and mysql::bindings are the primary interface +classes. +* mysql::server takes an `override_options` parameter to set my.cnf options, +with the hash format: { 'section' => { 'thing' => 'value' }} +* mysql attempts backwards compatibility by forwarding all parameters to +mysql::server. + +--- +## 2013-09-23 - Version 1.0.0 + +### Summary + +This release introduces a number of new type/providers, to eventually +replace the database_ ones. The module has been converted to call the +new providers rather than the previous ones as they have a number of +fixes, additional options, and work with puppet resource. + +This 1.0.0 release precedes a large refactoring that will be released +almost immediately after as 2.0.0. + +#### Features +- Added mysql_grant, mysql_database, and mysql_user. +- Add `mysql::bindings` class and refactor all other bindings to be contained underneath mysql::bindings:: namespace. +- Added support to back up specified databases only with 'mysqlbackup' parameter. +- Add option to mysql::backup to set the backup script to perform a mysqldump on each database to its own file + +#### Bugfixes +- Update my.cnf.pass.erb to allow custom socket support +- Add environment variable for .my.cnf in mysql::db. +- Add HOME environment variable for .my.cnf to mysqladmin command when +(re)setting root password + +--- +## 2013-07-15 - Version 0.9.0 +#### Features +- Add `mysql::backup::backuprotate` parameter +- Add `mysql::backup::delete_before_dump` parameter +- Add `max_user_connections` attribute to `database_user` type + +#### Bugfixes +- Add client package dependency for `mysql::db` +- Remove duplicate `expire_logs_days` and `max_binlog_size` settings +- Make root's `.my.cnf` file path dynamic +- Update pidfile path for Suse variants +- Fixes for lint + +## 2013-07-05 - Version 0.8.1 +#### Bugfixes + - Fix a typo in the Fedora 19 support. + +## 2013-07-01 - Version 0.8.0 +#### Features + - mysql::perl class to install perl-DBD-mysql. + - minor improvements to the providers to improve reliability + - Install the MariaDB packages on Fedora 19 instead of MySQL. + - Add new `mysql` class parameters: + - `max_connections`: The maximum number of allowed connections. + - `manage_config_file`: Opt out of puppetized control of my.cnf. + - `ft_min_word_len`: Fine tune the full text search. + - `ft_max_word_len`: Fine tune the full text search. + - Add new `mysql` class performance tuning parameters: + - `key_buffer` + - `thread_stack` + - `thread_cache_size` + - `myisam-recover` + - `query_cache_limit` + - `query_cache_size` + - `max_connections` + - `tmp_table_size` + - `table_open_cache` + - `long_query_time` + - Add new `mysql` class replication parameters: + - `server_id` + - `sql_log_bin` + - `log_bin` + - `max_binlog_size` + - `binlog_do_db` + - `expire_logs_days` + - `log_bin_trust_function_creators` + - `replicate_ignore_table` + - `replicate_wild_do_table` + - `replicate_wild_ignore_table` + - `expire_logs_days` + - `max_binlog_size` + +#### Bugfixes + - No longer restart MySQL when /root/.my.cnf changes. + - Ensure mysql::config runs before any mysql::db defines. + +## 2013-06-26 - Version 0.7.1 +#### Bugfixes +- Single-quote password for special characters +- Update travis testing for puppet 3.2.x and missing Bundler gems + +## 2013-06-25 - Version 0.7.0 +This is a maintenance release for community bugfixes and exposing +configuration variables. + +* Add new `mysql` class parameters: + - `basedir`: The base directory mysql uses + - `bind_address`: The IP mysql binds to + - `client_package_name`: The name of the mysql client package + - `config_file`: The location of the server config file + - `config_template`: The template to use to generate my.cnf + - `datadir`: The directory MySQL's datafiles are stored + - `default_engine`: The default engine to use for tables + - `etc_root_password`: Whether or not to add the mysql root password to + /etc/my.cnf + - `java_package_name`: The name of the java package containing the java + connector + - `log_error`: Where to log errors + - `manage_service`: Boolean dictating if mysql::server should manage the + service + - `max_allowed_packet`: Maximum network packet size mysqld will accept + - `old_root_password`: Previous root user password + - `php_package_name`: The name of the phpmysql package to install + - `pidfile`: The location mysql will expect the pidfile to be + - `port`: The port mysql listens on + - `purge_conf_dir`: Value fed to recurse and purge parameters of the + /etc/mysql/conf.d resource + - `python_package_name`: The name of the python mysql package to install + - `restart`: Whether to restart mysqld + - `root_group`: Use specified group for root-owned files + - `root_password`: The root MySQL password to use + - `ruby_package_name`: The name of the ruby mysql package to install + - `ruby_package_provider`: The installation suite to use when installing the + ruby package + - `server_package_name`: The name of the server package to install + - `service_name`: The name of the service to start + - `service_provider`: The name of the service provider + - `socket`: The location of the MySQL server socket file + - `ssl_ca`: The location of the SSL CA Cert + - `ssl_cert`: The location of the SSL Certificate to use + - `ssl_key`: The SSL key to use + - `ssl`: Whether or not to enable ssl + - `tmpdir`: The directory MySQL's tmpfiles are stored +* Deprecate `mysql::package_name` parameter in favor of +`mysql::client_package_name` +* Fix local variable template deprecation +* Fix dependency ordering in `mysql::db` +* Fix ANSI quoting in queries +* Fix travis support (but still messy) +* Fix typos + +## 2013-01-11 - Version 0.6.1 +* Fix providers when /root/.my.cnf is absent + +## 2013-01-09 - Version 0.6.0 +* Add `mysql::server::config` define for specific config directives +* Add `mysql::php` class for php support +* Add `backupcompress` parameter to `mysql::backup` +* Add `restart` parameter to `mysql::config` +* Add `purge_conf_dir` parameter to `mysql::config` +* Add `manage_service` parameter to `mysql::server` +* Add syslog logging support via the `log_error` parameter +* Add initial SuSE support +* Fix remove non-localhost root user when fqdn != hostname +* Fix dependency in `mysql::server::monitor` +* Fix .my.cnf path for root user and root password +* Fix ipv6 support for users +* Fix / update various spec tests +* Fix typos +* Fix lint warnings + +## 2012-08-23 - Version 0.5.0 +* Add puppetlabs/stdlib as requirement +* Add validation for mysql privs in provider +* Add `pidfile` parameter to mysql::config +* Add `ensure` parameter to mysql::db +* Add Amazon linux support +* Change `bind_address` parameter to be optional in my.cnf template +* Fix quoting root passwords + +## 2012-07-24 - Version 0.4.0 +* Fix various bugs regarding database names +* FreeBSD support +* Allow specifying the storage engine +* Add a backup class +* Add a security class to purge default accounts + +## 2012-05-03 - Version 0.3.0 +* 14218 Query the database for available privileges +* Add mysql::java class for java connector installation +* Use correct error log location on different distros +* Fix set_mysql_rootpw to properly depend on my.cnf + +## 2012-04-11 - Version 0.2.0 + +## 2012-03-19 - William Van Hevelingen +* (#13203) Add ssl support (f7e0ea5) + +## 2012-03-18 - Nan Liu +* Travis ci before script needs success exit code. (0ea463b) + +## 2012-03-18 - Nan Liu +* Fix Puppet 2.6 compilation issues. (9ebbbc4) + +## 2012-03-16 - Nan Liu +* Add travis.ci for testing multiple puppet versions. (33c72ef) + +## 2012-03-15 - William Van Hevelingen +* (#13163) Datadir should be configurable (f353fc6) + +## 2012-03-16 - Nan Liu +* Document create_resources dependency. (558a59c) + +## 2012-03-16 - Nan Liu +* Fix spec test issues related to error message. (eff79b5) + +## 2012-03-16 - Nan Liu +* Fix mysql service on Ubuntu. (72da2c5) + +## 2012-03-16 - Dan Bode +* Add more spec test coverage (55e399d) + +## 2012-03-16 - Nan Liu +* (#11963) Fix spec test due to path changes. (1700349) + +## 2012-03-07 - François Charlier +* Add a test to check path for 'mysqld-restart' (b14c7d1) + +## 2012-03-07 - François Charlier +* Fix path for 'mysqld-restart' (1a9ae6b) + +## 2012-03-15 - Dan Bode +* Add rspec-puppet tests for mysql::config (907331a) + +## 2012-03-15 - Dan Bode +* Moved class dependency between sever and config to server (da62ad6) + +## 2012-03-14 - Dan Bode +* Notify mysql restart from set_mysql_rootpw exec (0832a2c) + +## 2012-03-15 - Nan Liu +* Add documentation related to osfamily fact. (8265d28) + +## 2012-03-14 - Dan Bode +* Mention osfamily value in failure message (e472d3b) + +## 2012-03-14 - Dan Bode +* Fix bug when querying for all database users (015490c) + +## 2012-02-09 - Nan Liu +* Major refactor of mysql module. (b1f90fd) + +## 2012-01-11 - Justin Ellison +* Ruby and Python's MySQL libraries are named differently on different distros. (1e926b4) + +## 2012-01-11 - Justin Ellison +* Per @ghoneycutt, we should fail explicitly and explain why. (09af083) + +## 2012-01-11 - Justin Ellison +* Removing duplicate declaration (7513d03) + +## 2012-01-10 - Justin Ellison +* Use socket value from params class instead of hardcoding. (663e97c) + +## 2012-01-10 - Justin Ellison +* Instead of hardcoding the config file target, pull it from mysql::params (031a47d) + +## 2012-01-10 - Justin Ellison +* Moved $socket to within the case to toggle between distros. Added a $config_file variable to allow per-distro config file destinations. (360eacd) + +## 2012-01-10 - Justin Ellison +* Pretty sure this is a bug, 99% of Linux distros out there won't ever hit the default. (3462e6b) + +## 2012-02-09 - William Van Hevelingen +* Changed the README to use markdown (3b7dfeb) + +## 2012-02-04 - Daniel Black +* (#12412) mysqltuner.pl update (b809e6f) + +## 2011-11-17 - Matthias Pigulla +* (#11363) Add two missing privileges to grant: event_priv, trigger_priv (d15c9d1) + +## 2011-12-20 - Jeff McCune +* (minor) Fixup typos in Modulefile metadata (a0ed6a1) + +## 2011-12-19 - Carl Caum +* Only notify Exec to import sql if sql is given (0783c74) + +## 2011-12-19 - Carl Caum +* (#11508) Only load sql_scripts on DB creation (e3b9fd9) + +## 2011-12-13 - Justin Ellison +* Require not needed due to implicit dependencies (3058feb) + +## 2011-12-13 - Justin Ellison +* Bug #11375: puppetlabs-mysql fails on CentOS/RHEL (a557b8d) + +## 2011-06-03 - Dan Bode - 0.0.1 +* initial commit + +[5.4.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.3.0...5.4.0 +[5.3.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.1...5.3.0 +[5.2.1]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.0...5.2.1 +[5.2.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.1.0...5.2.0 +[5.1.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.0.0...5.1.0 +[5.0.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/4.0.1...5.0.0 diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md index b7273d050..8a93f7842 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md @@ -13,7 +13,8 @@ * [Specify passwords](#specify-passwords) * [Install Percona server on CentOS](#install-percona-server-on-centos) * [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu) -4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) + * [Install Plugins](#install-plugins) +4. [Reference - An under-the-hood peek at what the module is doing and how](REFERENCE.md) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) @@ -170,6 +171,8 @@ mysql::db { 'mydb': } ``` +If required, the password can also be an empty string to allow connections without an password. + ### Install Percona server on CentOS This example shows how to do a minimal installation of a Percona server on a @@ -365,7 +368,7 @@ mysql::server::service_name: 'mysqld' # required for puppet module mysql::server::override_options: 'mysqld': 'bind-address': '127.0.0.1' - 'log-error': /var/log/mysqld.log' # required for proper MySQL installation + 'log-error': '/var/log/mysqld.log' # required for proper MySQL installation 'mysqld_safe': 'log-error': '/var/log/mysqld.log' # required for proper MySQL installation @@ -380,929 +383,32 @@ mysql::server::db: ``` +### Install Plugins -## Reference - -### Classes - -#### Public classes - -* [`mysql::server`](#mysqlserver): Installs and configures MySQL. -* [`mysql::server::monitor`](#mysqlservermonitor): Sets up a monitoring user. -* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Installs MySQL tuner script. -* [`mysql::server::backup`](#mysqlserverbackup): Sets up MySQL backups via cron. -* [`mysql::bindings`](#mysqlbindings): Installs various MySQL language bindings. -* [`mysql::client`](#mysqlclient): Installs MySQL client (for non-servers). - -#### Private classes - -* `mysql::server::install`: Installs packages. -* `mysql::server::installdb`: Implements setup of mysqld data directory (e.g. /var/lib/mysql) -* `mysql::server::config`: Configures MYSQL. -* `mysql::server::service`: Manages service. -* `mysql::server::account_security`: Deletes default MySQL accounts. -* `mysql::server::root_password`: Sets MySQL root password. -* `mysql::server::providers`: Creates users, grants, and databases. -* `mysql::bindings::client_dev`: Installs MySQL client development package. -* `mysql::bindings::daemon_dev`: Installs MySQL daemon development package. -* `mysql::bindings::java`: Installs Java bindings. -* `mysql::bindings::perl`: Installs Perl bindings. -* `mysql::bindings::php`: Installs PHP bindings. -* `mysql::bindings::python`: Installs Python bindings. -* `mysql::bindings::ruby`: Installs Ruby bindings. -* `mysql::client::install`: Installs MySQL client. -* `mysql::backup::mysqldump`: Implements mysqldump backups. -* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup. -* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona. - -### Parameters - -#### mysql::server - -##### `create_root_user` - -Whether root user should be created. - -Valid values are `true`, `false`. - -Defaults to `true`. - -This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes. - -##### `create_root_my_cnf` - -Whether to create `/root/.my.cnf`. - -Valid values are `true`, `false`. - -Defaults to `true`. - -`create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. - -##### `root_password` - -The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. - -This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. - -Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. - -##### `old_root_password` - -This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. - -##### `override_options` - -Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: +Plugins can be installed by using the `mysql_plugin` defined type. See `examples/mysql_plugin.pp` for futher examples. ```puppet -$override_options = { - 'section' => { - 'item' => 'thing', - } +class { 'mysql::server': + root_password => 'password' } + +mysql_plugin { 'auth_pam': + ensure => present, + soname => 'auth_pam.so', +} + ``` -See [**Customize Server Options**](#customize-server-options) above for usage details. - -##### `config_file` - -The location, as a path, of the MySQL configuration file. - -##### `manage_config_file` - -Whether the MySQL configuration file should be managed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `includedir` - -The location, as a path, of !includedir for custom configuration overrides. - -##### `install_options` - -Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager. - -##### `purge_conf_dir` - -Whether the `includedir` directory should be purged. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `restart` - -Whether the service should be restarted when things change. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `root_group` - -The name of the group used for root. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). - -##### `mysql_group` - -The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). - -##### `package_ensure` - -Whether the package exists or should be a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Defaults to 'present'. - -##### `package_manage` - -Whether to manage the MySQL server package. - -Defaults to `true`. - -##### `package_name` - -The name of the MySQL server package to install. - -##### `remove_default_accounts` - -Specifies whether to automatically include `mysql::server::account_security`. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `service_enabled` - -Specifies whether the service should be enabled. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `service_manage` - -Specifies whether the service should be managed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `service_name` - -The name of the MySQL server service. - -Defaults are OS dependent, defined in 'params.pp'. - -##### `service_provider` - -The provider to use to manage the service. - -For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. - -##### `users` - -Optional hash of users to create, which are passed to [mysql_user](#mysql_user). - -```puppet -users => { - 'someuser@localhost' => { - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', - password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF', - tls_options => ['NONE'], - }, -} -``` - -##### `grants` - -Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). - -```puppet -grants => { - 'someuser@localhost/somedb.*' => { - ensure => 'present', - options => ['GRANT'], - privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'], - table => 'somedb.*', - user => 'someuser@localhost', - }, -} -``` - -##### `databases` - -Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). - -```puppet -databases => { - 'somedb' => { - ensure => 'present', - charset => 'utf8', - }, -} -``` - -#### mysql::server::backup - -##### `backupuser` - -MySQL user to create for backups. - -##### `backuppassword` - -MySQL user password for backups. - -##### `backupdir` - -Directory in which to store backups. - -##### `backupdirmode` - -Permissions applied to the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupdirowner` - -Owner for the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupdirgroup` - -Group owner for the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupcompress` - -Whether backups should be compressed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `backuprotate` - -How many days to keep backups. - -Valid value is an integer. - -Defaults to 30. - -##### `delete_before_dump` - -Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `backupdatabases` - -Specifies an array of databases to back up. - -##### `file_per_database` - -Whether a separate file be used per database. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `include_routines` - -Whether or not to include routines for each database when doing a `file_per_database` backup. - -Defaults to `false`. - -##### `include_triggers` - -Whether or not to include triggers for each database when doing a `file_per_database` backup. - -Defaults to `false`. - -##### `ensure` - -Allows you to remove the backup scripts. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `execpath` - -Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. - -##### `time` - -An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times. - -#### mysql::server::backup - -##### `postscript` - -A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files. - -##### `prescript` - -A script that is executed before the backup begins. - -##### `provider` - -Sets the server backup implementation. Valid values are: - -* `mysqldump`: Implements backups with mysqldump. Backup type: Logical. This is the default value. -* `mysqlbackup`: Implements backups with MySQL Enterprise Backup from Oracle. Backup type: Physical. To use this type of backup, you'll need the `meb` package, which is available in RPM and TAR formats from Oracle. For Ubuntu, you can use [meb-deb](https://github.com/dveeden/meb-deb) to create a package from an official tarball. -* `xtrabackup`: Implements backups with XtraBackup from Percona. Backup type: Physical. - -##### `maxallowedpacket` - -Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. - -##### `optional_args` - -Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.) - -#### mysql::server::monitor - -##### `mysql_monitor_username` - -The username to create for MySQL monitoring. - -##### `mysql_monitor_password` - -The password to create for MySQL monitoring. - -##### `mysql_monitor_hostname` - -The hostname from which the monitoring user requests are allowed access. - -#### mysql::server::mysqltuner - -**Note**: If you're using this class on a non-network-connected system, you must download the mysqltuner.pl script and have it hosted somewhere accessible via `http(s)://`, `puppet://`, `ftp://`, or a fully qualified file path. - -##### `ensure` - -Ensures that the resource exists. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `version` - -The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. - -Defaults to 'v1.3.0'. - -##### `environment` - -Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' - -#### mysql::bindings - -##### `client_dev` - -Specifies whether `::mysql::bindings::client_dev` should be included. - -Valid values are `true`', `false`. - -Defaults to `false`. - -##### `daemon_dev` - -Specifies whether `::mysql::bindings::daemon_dev` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `java_enable` - -Specifies whether `::mysql::bindings::java` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `perl_enable` - -Specifies whether `mysql::bindings::perl` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `php_enable` - -Specifies whether `mysql::bindings::php` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `python_enable` - -Specifies whether `mysql::bindings::python` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `ruby_enable` - -Specifies whether `mysql::bindings::ruby` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `install_options` - -Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s). - -##### `client_dev_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `client_dev => true`. - -##### `client_dev_package_name` - -The name of the client_dev package to install. - -Only applies if `client_dev => true`. - -##### `client_dev_package_provider` - -The provider to use to install the client_dev package. - -Only applies if `client_dev => true`. - -##### `daemon_dev_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `daemon_dev => true`. - -##### `daemon_dev_package_name` - -The name of the daemon_dev package to install. - -Only applies if `daemon_dev => true`. - -##### `daemon_dev_package_provider` - -The provider to use to install the daemon_dev package. - -Only applies if `daemon_dev => true`. - -##### `java_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `java_enable => true`. - -##### `java_package_name` - -The name of the Java package to install. - -Only applies if `java_enable => true`. - -##### `java_package_provider` - -The provider to use to install the Java package. - -Only applies if `java_enable => true`. - -##### `perl_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `perl_enable => true`. - -##### `perl_package_name` - -The name of the Perl package to install. - -Only applies if `perl_enable => true`. - -##### `perl_package_provider` - -The provider to use to install the Perl package. - -Only applies if `perl_enable => true`. - -##### `php_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `php_enable => true`. - -##### `php_package_name` - -The name of the PHP package to install. - -Only applies if `php_enable => true`. - -##### `python_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `python_enable => true`. - -##### `python_package_name` - -The name of the Python package to install. - -Only applies if `python_enable => true`. - -##### `python_package_provider` - -The provider to use to install the Python package. - -Only applies if `python_enable => true`. - -##### `ruby_package_ensure` - -Whether the package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Only applies if `ruby_enable => true`. - -##### `ruby_package_name` - -The name of the Ruby package to install. - -Only applies if `ruby_enable => true`. - -##### `ruby_package_provider` - -What provider should be used to install the package. - -#### mysql::client - -##### `bindings_enable` - -Whether to automatically install all bindings. - -Valid values are `true`, `false`. - -Default to `false`. - -##### `install_options` - -Array of install options for managed package resources. You must pass the appropriate options for the package manager. - -##### `package_ensure` - -Whether the MySQL package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -##### `package_manage` - -Whether to manage the MySQL client package. - -Defaults to `true`. - -##### `package_name` - -The name of the MySQL client package to install. - -### Defines - -#### mysql::db - -```puppet -mysql_database { 'information_schema': - ensure => 'present', - charset => 'utf8', - collate => 'utf8_swedish_ci', -} -mysql_database { 'mysql': - ensure => 'present', - charset => 'latin1', - collate => 'latin1_swedish_ci', -} -``` - -##### `user` - -The user for the database you're creating. - -##### `password` - -The password for $user for the database you're creating. - -##### `dbname` - -The name of the database to create. - -Defaults to "$name". - -##### `charset` - -The character set for the database. - -Defaults to 'utf8'. - -##### `collate` - -The collation for the database. - -Defaults to 'utf8_general_ci'. - -##### `host` - -The host to use as part of user@host for grants. - -Defaults to 'localhost'. - -##### `grant` - -The privileges to be granted for user@host on the database. - -Defaults to 'ALL'. - -##### `sql` - -The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. - -Defaults to `undef`. - -##### `enforce_sql` - -Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `ensure` - -Specifies whether to create the database. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `import_timeout` - -Timeout, in seconds, for loading the sqlfiles. - -Defaults to 300. - -##### `import_cat_cmd` - -Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. - -Defaults to 'cat'. - -### Types - -#### mysql_database - -`mysql_database` creates and manages databases within MySQL. - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -The name of the MySQL database to manage. - -##### `charset` - -The CHARACTER SET setting for the database. - -Defaults to ':utf8'. - -##### `collate` - -The COLLATE setting for the database. - -Defaults to ':utf8_general_ci'. - -#### mysql_user - -Creates and manages user grants within MySQL. - -```puppet -mysql_user { 'root@127.0.0.1': - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', -} -``` - -You can also specify an authentication plugin. - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - plugin => 'unix_socket', -} -``` - -TLS options can be specified for a user. - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - tls_options => ['SSL'], -} -``` - -##### `name` - -The name of the user, as 'username@hostname' or username@hostname. - -##### `password_hash` - -The user's password hash of the user. Use mysql_password() for creating such a hash. - -##### `max_user_connections` - -Maximum concurrent connections for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_connections_per_hour` - -Maximum connections per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_queries_per_hour` - -Maximum queries per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_updates_per_hour` - -Maximum updates per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `tls_options` - -SSL-related options for a MySQL account, using one or more tls_option values. 'NONE' specifies that the account has no TLS options enforced, and the available options are 'SSL', 'X509', 'CIPHER *cipher*', 'ISSUER *issuer*', 'SUBJECT *subject*'; as stated in the MySQL documentation. - - -#### mysql_grant - -`mysql_grant` creates grant permissions to access databases within MySQL. To create grant permissions to access databases with MySQL, use it you must create the title of the resource as shown below, following the pattern of `username@hostname/database.table`: - -```puppet -mysql_grant { 'root@localhost/*.*': - ensure => 'present', - options => ['GRANT'], - privileges => ['ALL'], - table => '*.*', - user => 'root@localhost', -} -``` - -It is possible to specify privileges down to the column level: - -```puppet -mysql_grant { 'root@localhost/mysql.user': - ensure => 'present', - privileges => ['SELECT (Host, User)'], - table => 'mysql.user', - user => 'root@localhost', -} -``` - -To revoke GRANT privilege specify ['NONE']. - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -Name to describe the grant. Must in a 'user/table' format. - -##### `privileges` - -Privileges to grant the user. - -##### `table` - -The table to which privileges are applied. - -##### `user` - -User to whom privileges are granted. - -##### `options` - -MySQL options to grant. Optional. - -#### mysql_plugin - -`mysql_plugin` can be used to load plugins into the MySQL Server. - -```puppet -mysql_plugin { 'auth_socket': - ensure => 'present', - soname => 'auth_socket.so', -} -``` - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -The name of the MySQL plugin to manage. - -##### `soname` - -The library file name. - -#### `mysql_datadir` - -Initializes the MySQL data directory with version specific code. Pre MySQL 5.7.6 it uses mysql_install_db. After MySQL 5.7.6 it uses mysqld --initialize-insecure. - -Insecure initialization is needed, as mysqld version 5.7 introduced 'secure by default' mode. This means MySQL generates a random password and writes it to STDOUT. This means puppet can never access the database server afterwards, as no credentials are available. - -This type is an internal type and should not be called directly. - -### Facts - -#### `mysql_version` - -Determines the MySQL version by parsing the output from `mysql --version` - -#### `mysql_server_id` - -Generates a unique id, based on the node's MAC address, which can be used as `server_id`. This fact will *always* return `0` on nodes that have only loopback interfaces. Because those nodes aren't connected to the outside world, this shouldn't cause any conflicts. - ### Tasks The MySQL module has an example task that allows a user to execute arbitary SQL against a database. Please refer to to the [PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or [Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how to execute a task. ## Limitations -This module has been tested on: - -* RedHat Enterprise Linux 5, 6, 7 -* Debian 6, 7, 8 -* CentOS 5, 6, 7 -* Ubuntu 10.04, 12.04, 14.04, 16.04 -* Scientific Linux 5, 6 -* SLES 11 - -Testing on other platforms has been minimal and cannot be guaranteed. +For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-tomcat/blob/master/metadata.json) **Note:** The mysqlbackup.sh does not work and is not supported on MySQL 5.7 and greater. -Debian 9 compatibility has not been fully verified. - ## Development Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/REFERENCE.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/REFERENCE.md new file mode 100644 index 000000000..fe4c2c3ac --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/REFERENCE.md @@ -0,0 +1,1180 @@ +# Reference + + +## Classes + +### Public Classes + +* [`mysql::bindings`](#mysqlbindings): Parent class for MySQL bindings. +* [`mysql::client`](#mysqlclient): Installs and configures the MySQL client. +* [`mysql::server`](#mysqlserver): Installs and configures the MySQL server. +* [`mysql::server::backup`](#mysqlserverbackup): Create and manage a MySQL backup. +* [`mysql::server::monitor`](#mysqlservermonitor): This is a helper class to add a monitoring user to the database +* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Manage the MySQLTuner package. + +### Private Classes + +* `mysql::backup::mysqlbackup`: Manage the mysqlbackup client. +* `mysql::backup::mysqldump`: "Provider" for mysqldump +* `mysql::backup::xtrabackup`: "Provider" for Percona XtraBackup +* `mysql::bindings::client_dev`: Private class for installing client development bindings +* `mysql::bindings::daemon_dev`: Private class for installing daemon development bindings +* `mysql::bindings::java`: Private class for installing java language bindings. +* `mysql::bindings::perl`: Private class for installing perl language bindings. +* `mysql::bindings::php`: Private class for installing php language bindings +* `mysql::bindings::python`: Private class for installing python language bindings +* `mysql::bindings::ruby`: Private class for installing ruby language bindings +* `mysql::client::install`: Private class for MySQL client install. +* `mysql::params`: Params class. +* `mysql::server::account_security`: Private class for ensuring localhost accounts do not exist +* `mysql::server::binarylog`: Binary log configuration requires the mysql user to be present. This must be done after package install +* `mysql::server::config`: Private class for MySQL server configuration. +* `mysql::server::install`: Private class for managing MySQL package. +* `mysql::server::installdb`: Builds initial databases on installation. +* `mysql::server::providers`: Convenience class to call each of the three providers with the corresponding hashes provided in mysql::server. +* `mysql::server::root_password`: Private class for managing the root password +* `mysql::server::service`: Private class for managing the MySQL service + +## Defined types + +* [`mysql::db`](#mysqldb): Create and configure a MySQL database. + +## Resource types + +### Public Resource types + +* [`mysql_plugin`](#mysql_plugin): Manage MySQL plugins. + +### Private Resource types + +* `mysql_database`: Manage a MySQL database. +* `mysql_datadir`: Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). +* `mysql_grant`: Manage a MySQL user's rights. +* `mysql_user`: Manage a MySQL user. This includes management of users password as well as privileges. + +## Functions + +* [`mysql_deepmerge`](#mysql_deepmerge): Recursively merges two or more hashes together and returns the resulting hash. +* [`mysql_dirname`](#mysql_dirname): Returns the dirname of a path +* [`mysql_password`](#mysql_password): Hash a string as mysql's "PASSWORD()" function would do it +* [`mysql_strip_hash`](#mysql_strip_hash): TEMPORARY FUNCTION: EXPIRES 2014-03-10 When given a hash this function strips out all blank entries. + +## Tasks + +* [`export`](#export): Allows you to backup your database to local file. +* [`sql`](#sql): Allows you to execute arbitary SQL + +## Classes + +### mysql::bindings + +Parent class for MySQL bindings. + +#### Examples + +##### Install Ruby language bindings + +```puppet +class { 'mysql::bindings': + ruby_enable => true, + ruby_package_ensure => 'present', + ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', + ruby_package_provider => 'rpm', +} +``` + +#### Parameters + +The following parameters are available in the `mysql::bindings` class. + +##### `install_options` + +Data type: `Any` + +Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s). + +Default value: `undef` + +##### `java_enable` + +Data type: `Any` + +Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `perl_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `php_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `python_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `ruby_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `client_dev` + +Data type: `Any` + +Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. + +Default value: `false` + +##### `daemon_dev` + +Data type: `Any` + +Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `java_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `java_enable => true`. + +Default value: $mysql::params::java_package_ensure + +##### `java_package_name` + +Data type: `Any` + +The name of the Java package to install. Only applies if `java_enable => true`. + +Default value: $mysql::params::java_package_name + +##### `java_package_provider` + +Data type: `Any` + +The provider to use to install the Java package. Only applies if `java_enable => true`. + +Default value: $mysql::params::java_package_provider + +##### `perl_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `perl_enable => true`. + +Default value: $mysql::params::perl_package_ensure + +##### `perl_package_name` + +Data type: `Any` + +The name of the Perl package to install. Only applies if `perl_enable => true`. + +Default value: $mysql::params::perl_package_name + +##### `perl_package_provider` + +Data type: `Any` + +The provider to use to install the Perl package. Only applies if `perl_enable => true`. + +Default value: $mysql::params::perl_package_provider + +##### `php_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `php_enable => true`. + +Default value: $mysql::params::php_package_ensure + +##### `php_package_name` + +Data type: `Any` + +The name of the PHP package to install. Only applies if `php_enable => true`. + +Default value: $mysql::params::php_package_name + +##### `php_package_provider` + +Data type: `Any` + +The provider to use to install the PHP package. Only applies if `php_enable => true`. + +Default value: $mysql::params::php_package_provider + +##### `python_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `python_enable => true`. + +Default value: $mysql::params::python_package_ensure + +##### `python_package_name` + +Data type: `Any` + +The name of the Python package to install. Only applies if `python_enable => true`. + +Default value: $mysql::params::python_package_name + +##### `python_package_provider` + +Data type: `Any` + +The provider to use to install the Python package. Only applies if `python_enable => true`. + +Default value: $mysql::params::python_package_provider + +##### `ruby_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `ruby_enable => true`. + +Default value: $mysql::params::ruby_package_ensure + +##### `ruby_package_name` + +Data type: `Any` + +The name of the Ruby package to install. Only applies if `ruby_enable => true`. + +Default value: $mysql::params::ruby_package_name + +##### `ruby_package_provider` + +Data type: `Any` + +What provider should be used to install the package. + +Default value: $mysql::params::ruby_package_provider + +##### `client_dev_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `client_dev => true`. + +Default value: $mysql::params::client_dev_package_ensure + +##### `client_dev_package_name` + +Data type: `Any` + +The name of the client_dev package to install. Only applies if `client_dev => true`. + +Default value: $mysql::params::client_dev_package_name + +##### `client_dev_package_provider` + +Data type: `Any` + +The provider to use to install the client_dev package. Only applies if `client_dev => true`. + +Default value: $mysql::params::client_dev_package_provider + +##### `daemon_dev_package_ensure` + +Data type: `Any` + +Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `daemon_dev => true`. + +Default value: $mysql::params::daemon_dev_package_ensure + +##### `daemon_dev_package_name` + +Data type: `Any` + +The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. + +Default value: $mysql::params::daemon_dev_package_name + +##### `daemon_dev_package_provider` + +Data type: `Any` + +The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. + +Default value: $mysql::params::daemon_dev_package_provider + +### mysql::client + +Installs and configures the MySQL client. + +#### Examples + +##### Install the MySQL client + +```puppet +class {'::mysql::client': + package_name => 'mysql-client', + package_ensure => 'present', + bindings_enable => true, +} +``` + +#### Parameters + +The following parameters are available in the `mysql::client` class. + +##### `bindings_enable` + +Data type: `Any` + +Whether to automatically install all bindings. Valid values are `true`, `false`. Default to `false`. + +Default value: $mysql::params::bindings_enable + +##### `install_options` + +Data type: `Any` + +Array of install options for managed package resources. You must pass the appropriate options for the package manager. + +Default value: `undef` + +##### `package_ensure` + +Data type: `Any` + +Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. + +Default value: $mysql::params::client_package_ensure + +##### `package_manage` + +Data type: `Any` + +Whether to manage the MySQL client package. Defaults to `true`. + +Default value: $mysql::params::client_package_manage + +##### `package_name` + +Data type: `Any` + +The name of the MySQL client package to install. + +Default value: $mysql::params::client_package_name + +### mysql::server + +Installs and configures the MySQL server. + +#### Examples + +##### Install MySQL Server + +```puppet +class { '::mysql::server': + package_name => 'mysql-server', + package_ensure => '5.7.1+mysql~trusty', + root_password => 'strongpassword', + remove_default_accounts => true, +} +``` + +#### Parameters + +The following parameters are available in the `mysql::server` class. + +##### `config_file` + +Data type: `Any` + +The location, as a path, of the MySQL configuration file. + +Default value: $mysql::params::config_file + +##### `includedir` + +Data type: `Any` + +The location, as a path, of !includedir for custom configuration overrides. + +Default value: $mysql::params::includedir + +##### `install_options` + +Data type: `Any` + +Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager + +Default value: `undef` + +##### `install_secret_file` + +Data type: `Any` + +Path to secret file containing temporary root password. + +Default value: $mysql::params::install_secret_file + +##### `manage_config_file` + +Data type: `Any` + +Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::manage_config_file + +##### `override_options` + +Data type: `Any` + +Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. + +Default value: {} + +##### `package_ensure` + +Data type: `Any` + +Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. + +Default value: $mysql::params::server_package_ensure + +##### `package_manage` + +Data type: `Any` + +Whether to manage the MySQL server package. Defaults to `true`. + +Default value: $mysql::params::server_package_manage + +##### `package_name` + +Data type: `Any` + +The name of the MySQL server package to install. + +Default value: $mysql::params::server_package_name + +##### `purge_conf_dir` + +Data type: `Any` + +Whether the `includedir` directory should be purged. Valid values are `true`, `false`. Defaults to `false`. + +Default value: $mysql::params::purge_conf_dir + +##### `remove_default_accounts` + +Data type: `Any` + +Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. + +Default value: `false` + +##### `restart` + +Data type: `Any` + +Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. + +Default value: $mysql::params::restart + +##### `root_group` + +Data type: `Any` + +The name of the group used for root. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). + +Default value: $mysql::params::root_group + +##### `mysql_group` + +Data type: `Any` + +The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). + +Default value: $mysql::params::mysql_group + +##### `root_password` + +Data type: `Any` + +The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. + +Default value: $mysql::params::root_password + +##### `service_enabled` + +Data type: `Any` + +Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::server_service_enabled + +##### `service_manage` + +Data type: `Any` + +Specifies whether the service should be managed. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::server_service_manage + +##### `service_name` + +Data type: `Any` + +The name of the MySQL server service. Defaults are OS dependent, defined in 'params.pp'. + +Default value: $mysql::params::server_service_name + +##### `service_provider` + +Data type: `Any` + +The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. + +Default value: $mysql::params::server_service_provider + +##### `create_root_user` + +Data type: `Any` + +Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes. + +Default value: $mysql::params::create_root_user + +##### `create_root_my_cnf` + +Data type: `Any` + +Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. + +Default value: $mysql::params::create_root_my_cnf + +##### `users` + +Data type: `Any` + +Optional hash of users to create, which are passed to [mysql_user](#mysql_user). + +Default value: {} + +##### `grants` + +Data type: `Any` + +Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). + +Default value: {} + +##### `databases` + +Data type: `Any` + +Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). + +Default value: {} + +##### `enabled` + +Data type: `Any` + +_Deprecated_ + +Default value: `undef` + +##### `manage_service` + +Data type: `Any` + +_Deprecated_ + +Default value: `undef` + +##### `old_root_password` + +Data type: `Any` + +This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. + +Default value: `undef` + +### mysql::server::backup + +Create and manage a MySQL backup. + +#### Examples + +##### Create a basic MySQL backup: + +```puppet +class { 'mysql::server': + root_password => 'password' +} +class { 'mysql::server::backup': + backupuser => 'myuser', + backuppassword => 'mypassword', + backupdir => '/tmp/backups', +} +``` + +#### Parameters + +The following parameters are available in the `mysql::server::backup` class. + +##### `backupuser` + +Data type: `Any` + +MySQL user with backup administrator privileges. + +Default value: `undef` + +##### `backuppassword` + +Data type: `Any` + +Password for `backupuser`. + +Default value: `undef` + +##### `backupdir` + +Data type: `Any` + +Directory to store backup. + +Default value: `undef` + +##### `backupdirmode` + +Data type: `Any` + +Permissions applied to the backup directory. This parameter is passed directly to the file resource. + +Default value: '0700' + +##### `backupdirowner` + +Data type: `Any` + +Owner for the backup directory. This parameter is passed directly to the file resource. + +Default value: 'root' + +##### `backupdirgroup` + +Data type: `Any` + +Group owner for the backup directory. This parameter is passed directly to the file resource. + +Default value: 'root' + +##### `backupcompress` + +Data type: `Any` + +Whether or not to compress the backup (when using the mysqldump provider) + +Default value: `true` + +##### `backuprotate` + +Data type: `Any` + +Backup rotation interval in 24 hour periods. + +Default value: 30 + +##### `ignore_events` + +Data type: `Any` + +Ignore the mysql.event table. + +Default value: `true` + +##### `delete_before_dump` + +Data type: `Any` + +Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup. + +Default value: `false` + +##### `backupdatabases` + +Data type: `Any` + +Databases to backup (if using xtrabackup provider). + +Default value: [] + +##### `file_per_database` + +Data type: `Any` + +Use file per database mode creating one file per database backup. + +Default value: `false` + +##### `include_routines` + +Data type: `Any` + +Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. + +Default value: `false` + +##### `include_triggers` + +Data type: `Any` + +Dump triggers for each dumped table when doing a `file_per_database` backup. + +Default value: `false` + +##### `ensure` + +Data type: `Any` + + + +Default value: 'present' + +##### `time` + +Data type: `Any` + +An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times. + +Default value: ['23', '5'] + +##### `prescript` + +Data type: `Any` + +A script that is executed before the backup begins. + +Default value: `false` + +##### `postscript` + +Data type: `Any` + +A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files. + +Default value: `false` + +##### `execpath` + +Data type: `Any` + +Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. + +Default value: '/usr/bin:/usr/sbin:/bin:/sbin' + +##### `provider` + +Data type: `Any` + +Sets the server backup implementation. Valid values are: + +Default value: 'mysqldump' + +##### `maxallowedpacket` + +Data type: `Any` + +Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. + +Default value: '1M' + +##### `optional_args` + +Data type: `Any` + +Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.) + +Default value: [] + +### mysql::server::monitor + +This is a helper class to add a monitoring user to the database + +#### Parameters + +The following parameters are available in the `mysql::server::monitor` class. + +##### `mysql_monitor_username` + +Data type: `Any` + +The username to create for MySQL monitoring. + +Default value: '' + +##### `mysql_monitor_password` + +Data type: `Any` + +The password to create for MySQL monitoring. + +Default value: '' + +##### `mysql_monitor_hostname` + +Data type: `Any` + +The hostname from which the monitoring user requests are allowed access. + +Default value: '' + +### mysql::server::mysqltuner + +Manage the MySQLTuner package. + +#### Parameters + +The following parameters are available in the `mysql::server::mysqltuner` class. + +##### `ensure` + +Data type: `Any` + +Ensures that the resource exists. Valid values are 'present', 'absent'. Defaults to 'present'. + +Default value: 'present' + +##### `version` + +Data type: `Any` + +The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. + +Default value: 'v1.3.0' + +##### `source` + +Data type: `Any` + +Source path for the mysqltuner package. + +Default value: `undef` + +##### `environment` + +Data type: `Any` + +Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' + +Default value: `undef` + +## Defined types + +### mysql::db + +Create and configure a MySQL database. + +#### Examples + +##### Create a database + +```puppet +mysql::db { 'mydb': + user => 'myuser', + password => 'mypass', + host => 'localhost', + grant => ['SELECT', 'UPDATE'], +} +``` + +#### Parameters + +The following parameters are available in the `mysql::db` defined type. + +##### `user` + +Data type: `Any` + +The user for the database you're creating. + +##### `password` + +Data type: `Any` + +The password for $user for the database you're creating. + +##### `dbname` + +Data type: `Any` + +The name of the database to create. + +Default value: $name + +##### `charset` + +Data type: `Any` + +The character set for the database. + +Default value: 'utf8' + +##### `collate` + +Data type: `Any` + +The collation for the database. + +Default value: 'utf8_general_ci' + +##### `host` + +Data type: `Any` + +The host to use as part of user@host for grants. + +Default value: 'localhost' + +##### `grant` + +Data type: `Any` + +The privileges to be granted for user@host on the database. + +Default value: 'ALL' + +##### `sql` + +Data type: `Optional[Variant[Array, Hash, String]]` + +The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. + +Default value: `undef` + +##### `enforce_sql` + +Data type: `Any` + +Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. + +Default value: `false` + +##### `ensure` + +Data type: `Enum['absent', 'present']` + +Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. + +Default value: 'present' + +##### `import_timeout` + +Data type: `Any` + +Timeout, in seconds, for loading the sqlfiles. Defaults to 300. + +Default value: 300 + +##### `import_cat_cmd` + +Data type: `Any` + +Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. + +Default value: 'cat' + +## Resource types + +### mysql_plugin + +Manage MySQL plugins. + +#### Examples + +##### + +```puppet +mysql_plugin { 'some_plugin': + soname => 'some_pluginlib.so', +} +``` + +#### Properties + +The following properties are available in the `mysql_plugin` type. + +##### `ensure` + +Valid values: present, absent + +The basic property that the resource should be in. + +Default value: present + +##### `soname` + +Valid values: %r{^\w+\.\w+$} + +The name of the library + +#### Parameters + +The following parameters are available in the `mysql_plugin` type. + +##### `name` + +namevar + +The name of the MySQL plugin to manage. + +## Functions + +### mysql_deepmerge + +Type: Ruby 3.x API + +- When there is a duplicate key that is a hash, they are recursively merged. +- When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." +- When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + the rightmost style will win. + +#### `mysql_deepmerge()` + +- When there is a duplicate key that is a hash, they are recursively merged. +- When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." +- When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + the rightmost style will win. + +Returns: `Hash` + +### mysql_dirname + +Type: Ruby 3.x API + +Returns the dirname of a path + +#### `mysql_dirname(String $path)` + +Returns: `String` Directory name of path. + +##### `path` + +Data type: `String` + +Path to find the dirname for. + +### mysql_password + +Type: Ruby 3.x API + +Hash a string as mysql's "PASSWORD()" function would do it + +#### `mysql_password(String $password)` + +Returns: `String` the mysql password hash from the clear text password. + +##### `password` + +Data type: `String` + +Plain text password. + +### mysql_strip_hash + +Type: Ruby 3.x API + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +When given a hash this function strips out all blank entries. + +#### `mysql_strip_hash()` + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +When given a hash this function strips out all blank entries. + +Returns: `Any` + +## Tasks + +### export + +Allows you to backup your database to local file. + +**Supports noop?** false + +#### Parameters + +##### `database` + +Data type: `Optional[String[1]]` + +Database to connect to + +##### `user` + +Data type: `Optional[String[1]]` + +The user + +##### `password` + +Data type: `Optional[String[1]]` + +The password + +##### `file` + +Data type: `String[1]` + +Path to file you want backup to + +### sql + +Allows you to execute arbitary SQL + +**Supports noop?** false + +#### Parameters + +##### `database` + +Data type: `Optional[String[1]]` + +Database to connect to + +##### `user` + +Data type: `Optional[String[1]]` + +The user + +##### `password` + +Data type: `Optional[String[1]]` + +The password + +##### `sql` + +Data type: `String[1]` + +The SQL you want to execute + diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile b/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile index f39d8351c..112dc4212 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile @@ -1,4 +1,76 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' +require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? +require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet_pot_generator/rake_tasks' + +def changelog_user + return unless Rake.application.top_level_tasks.include? "changelog" + returnVal = nil || JSON.load(File.read('metadata.json'))['author'] + raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator user:#{returnVal}" + returnVal +end + +def changelog_project + return unless Rake.application.top_level_tasks.include? "changelog" + returnVal = nil || JSON.load(File.read('metadata.json'))['name'] + raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator project:#{returnVal}" + returnVal +end + +def changelog_future_release + return unless Rake.application.top_level_tasks.include? "changelog" + returnVal = JSON.load(File.read('metadata.json'))['version'] + raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator future_release:#{returnVal}" + returnVal +end + +PuppetLint.configuration.send('disable_relative') + +if Bundler.rubygems.find_name('github_changelog_generator').any? + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? + config.user = "#{changelog_user}" + config.project = "#{changelog_project}" + config.future_release = "#{changelog_future_release}" + config.exclude_labels = ['maintenance'] + config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." + config.add_pr_wo_labels = true + config.issues = false + config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM" + config.configure_sections = { + "Changed" => { + "prefix" => "### Changed", + "labels" => ["backwards-incompatible"], + }, + "Added" => { + "prefix" => "### Added", + "labels" => ["feature", "enhancement"], + }, + "Fixed" => { + "prefix" => "### Fixed", + "labels" => ["bugfix"], + }, + } + end +else + desc 'Generate a Changelog from GitHub' + task :changelog do + raise <= Gem::Version.new('2.2.2')" +EOM + end +end + diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/checksums.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/checksums.json new file mode 100644 index 000000000..e5c01ff43 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/checksums.json @@ -0,0 +1,137 @@ +{ + "CHANGELOG.md": "bea624121cef123e00250ec2321228a9", + "CONTRIBUTING.md": "4d17f3c942e7c93d1577cc4438a231e4", + "Gemfile": "9ba204736d497887aa71980fa336319f", + "HISTORY.md": "202fb76908e67e272549113e70da44a9", + "LICENSE": "3b83ef96387f14655fc854ddc3c6bd57", + "MAINTAINERS.md": "d1a8a0cb1736b23f3143b685e0d034b0", + "NOTICE": "61151e454f47a0df587642c792385533", + "README.md": "83c63cf4abd3c2c57586af802aeea73d", + "REFERENCE.md": "728640207cebe9fcc76bfd28c51be978", + "Rakefile": "5a645b196705e2e8d973114d1552e5ef", + "TODO": "88ca4024a37992b46c34cb46e4ac39e6", + "examples/backup.pp": "a61c6f34f153a323209faf25948737f5", + "examples/bindings.pp": "35a8387f5c55fa2e479c513a67918674", + "examples/java.pp": "0ad9de4f9f2c049642bcf08124757085", + "examples/mysql_database.pp": "107ee8793f7b4a12cfca32eddccc6bbd", + "examples/mysql_db.pp": "55d2d603f9fb8ab3c8a781d08119aa69", + "examples/mysql_grant.pp": "cd42336a6c7b2d27f5d5d6d0e310ee1a", + "examples/mysql_plugin.pp": "3be416bd610ccc563517c1378c726463", + "examples/mysql_user.pp": "ec5182bfb57a9e7a8ba44ad8aff82ac9", + "examples/perl.pp": "454f14dc4492fcf04afbe81b2776917e", + "examples/python.pp": "355a7e1ea3978a8fd290b5bc28b63808", + "examples/ruby.pp": "a6ae0381aacc5a8d2c403e606c6df0f0", + "examples/server/account_security.pp": "375442b7886c01b42fbf75a1fcb31822", + "examples/server/config.pp": "659b7c40e9b55634721b3c33a8c6da98", + "examples/server.pp": "72e22552a95b9a5e4a349dbfc13639dc", + "lib/facter/mysql_server_id.rb": "8074e28063136191d064de5bbd23d823", + "lib/facter/mysql_version.rb": "9e8e89de386bbbd74bac1c24c388ed61", + "lib/facter/mysqld_version.rb": "a865c82a1bbe4fc49998d17038eaaa11", + "lib/puppet/functions/mysql/deepmerge.rb": "91fb87c5912f1499aa00caba63142ffb", + "lib/puppet/functions/mysql/dirname.rb": "2edd12fbdaee91cac386125d66f7f159", + "lib/puppet/functions/mysql/password.rb": "fd2cf970768fb515547179481357c503", + "lib/puppet/functions/mysql/strip_hash.rb": "46f744d3d50c331332ef893e5b1dcddf", + "lib/puppet/parser/functions/mysql_deepmerge.rb": "866fa179eec788d60d879674595bea5f", + "lib/puppet/parser/functions/mysql_dirname.rb": "c86c31344b8d5c0c2bc1ce05eedbbfdc", + "lib/puppet/parser/functions/mysql_password.rb": "c4d522919ce8d270a5d3d2ccf060ecd1", + "lib/puppet/parser/functions/mysql_strip_hash.rb": "59f90ce7c6a5f96c3565ba2ef12a6e7e", + "lib/puppet/provider/mysql.rb": "3eb92809e36d1a57357229d461aa6dc9", + "lib/puppet/provider/mysql_database/mysql.rb": "12e6bfef70486ed4d8a4e731bfde89fa", + "lib/puppet/provider/mysql_datadir/mysql.rb": "aa72daf1732dadd9d5caa6c6ff696414", + "lib/puppet/provider/mysql_grant/mysql.rb": "e0a96951629bc906d45c8bc73f0d16d5", + "lib/puppet/provider/mysql_plugin/mysql.rb": "d0043d2fec34ab9d9839ecb2f5e6f494", + "lib/puppet/provider/mysql_user/mysql.rb": "343f3871935e7a36e2c981cdae5d6482", + "lib/puppet/type/mysql_database.rb": "a52d622db5cb4e9978c57d445e7d63f7", + "lib/puppet/type/mysql_datadir.rb": "003e20fbccdfabbf46e62dfbfc41781b", + "lib/puppet/type/mysql_grant.rb": "2d9bdca037cd3db847f840ffc807817f", + "lib/puppet/type/mysql_plugin.rb": "5786a52bf1ca04a9300831add3f4dbad", + "lib/puppet/type/mysql_user.rb": "0886e73a6ecfe8838196fcaf7e1907a4", + "locales/config.yaml": "2fa67bcbae3c1f47b447359558142bb4", + "locales/ja/puppetlabs-mysql.po": "2cf26b43a97d4444f0af6e542b140a84", + "locales/puppetlabs-mysql.pot": "0bc1d574fc470daa825d2052b901f1c2", + "manifests/backup/mysqlbackup.pp": "a3af8ed949cfa26dda63708b8525f7a7", + "manifests/backup/mysqldump.pp": "6e1650e5af995c9aad06d905f9e9884e", + "manifests/backup/xtrabackup.pp": "735376e8698570aa9e2523307739735b", + "manifests/bindings/client_dev.pp": "22caac5dc87099f19e930c045bd3b8ab", + "manifests/bindings/daemon_dev.pp": "835f8b31d04dc4e274554ebc521bfae4", + "manifests/bindings/java.pp": "594bed2948731d4707837f149a6a34dc", + "manifests/bindings/perl.pp": "1db6a303f85d294e60437425d69e6e21", + "manifests/bindings/php.pp": "fd2f05eb16fb26dcb6856368b32e0d8e", + "manifests/bindings/python.pp": "6f21841a99e131cbbed991cd3b224b45", + "manifests/bindings/ruby.pp": "4e15dc048a88fff9d4dda51149444474", + "manifests/bindings.pp": "a082c3fb3bb814a0953ec7beda9f0786", + "manifests/client/install.pp": "26c737ee4b0ce3a4529dbf3368dd56d5", + "manifests/client.pp": "178235b85d2984e7b6245b3419eb9c58", + "manifests/db.pp": "f7d5de529a9d55e432f6d3606cea28f2", + "manifests/params.pp": "bdd97f331dff824bcb71b512bde0ac31", + "manifests/server/account_security.pp": "e8547d61232dab8399fc1c026678f0e8", + "manifests/server/backup.pp": "1781622fb06122bbc119eb6f80b5bbe5", + "manifests/server/binarylog.pp": "5ea5c22eeda8100c49c0de59bf0348bb", + "manifests/server/config.pp": "fd386ce8b1a6015362af0cd745d273a4", + "manifests/server/install.pp": "e00ad8cd4292540d6556c63a82bcf923", + "manifests/server/installdb.pp": "320b2242006cbd4d3f537b07df054f97", + "manifests/server/monitor.pp": "3303efac7f345000b5d49ce8c807a513", + "manifests/server/mysqltuner.pp": "063d000c4b3dedcc3873725f2345ed7c", + "manifests/server/providers.pp": "1ff9ff9f003b061c3a6a184c01ca734e", + "manifests/server/root_password.pp": "ac1250741d8e26bfe5c73a2dc6599fba", + "manifests/server/service.pp": "0e37b66b3d68d734cccf6e18c50238e2", + "manifests/server.pp": "e2aeee196fb5afb00de32270ae979fa2", + "metadata.json": "f8eb72b00d30b0f02968431052f0199e", + "readmes/README_ja_JP.md": "18d5302aa8b6e984b190ac2b3e633999", + "readmes/REFERENCE_ja_JP.md": "8f395be104df61b6f20b96cf861d4307", + "spec/acceptance/locales_spec.rb": "5999c778fcbbe072b5302bd9a1b862a6", + "spec/acceptance/mysql_backup_spec.rb": "1e45476499232adfc732d4d7db084950", + "spec/acceptance/mysql_db_spec.rb": "cc23120fecd30fc1689ebbbd976c03c3", + "spec/acceptance/mysql_helper.rb": "5f9f41b66022b99b4630ba9b581e68cf", + "spec/acceptance/mysql_server_spec.rb": "c72db5ea61b0f3c4c0765d8cb6cf2fbf", + "spec/acceptance/nodesets/centos-7-x64.yml": "a713f3abd3657f0ae2878829badd23cd", + "spec/acceptance/nodesets/debian-8-x64.yml": "d2d2977900989f30086ad251a14a1f39", + "spec/acceptance/nodesets/default.yml": "b42da5a1ea0c964567ba7495574b8808", + "spec/acceptance/nodesets/docker/centos-7.yml": "8a3892807bdd62306ae4774f41ba11ae", + "spec/acceptance/nodesets/docker/debian-8.yml": "ac8e871d1068c96de5e85a89daaec6df", + "spec/acceptance/nodesets/docker/ubuntu-14.04.yml": "dc42ee922a96908d85b8f0f08203ce58", + "spec/acceptance/sql_task_spec.rb": "5ccb8605df65ac994b2e3ada87413a65", + "spec/acceptance/types/mysql_database_spec.rb": "18d2d82180d8f26e793d25d2853199b6", + "spec/acceptance/types/mysql_grant_spec.rb": "acaa270a0f778d3bd8e06836141fac6e", + "spec/acceptance/types/mysql_plugin_spec.rb": "3984c7432d3f8b8f7461e21e139776c5", + "spec/acceptance/types/mysql_user_spec.rb": "2973815482b49457ee3c22f18921abd3", + "spec/classes/graceful_failures_spec.rb": "b87bf88de1903d81765ea2823e30b13f", + "spec/classes/mycnf_template_spec.rb": "41a4593b53d5ad9416f96d1c695efa0c", + "spec/classes/mysql_bindings_spec.rb": "cc74d765e235c986be88dc23b68bcc85", + "spec/classes/mysql_client_spec.rb": "8cbbecb97b11841730d1e6e761b55f9e", + "spec/classes/mysql_server_account_security_spec.rb": "fa9089b55ba0839a601e1b487d6f6958", + "spec/classes/mysql_server_backup_spec.rb": "476160ee6579495309ec11c2a081fdd9", + "spec/classes/mysql_server_monitor_spec.rb": "1e028eeb613ab7baa6d8ae2c9cf7366f", + "spec/classes/mysql_server_mysqltuner_spec.rb": "b353330180fedb94dff9a242acf8f729", + "spec/classes/mysql_server_spec.rb": "b39d692016bb1bfb63c61bbc777bfbbb", + "spec/default_facts.yml": "b1ca07fac7dcb249d641d8b63239ef7c", + "spec/defines/mysql_db_spec.rb": "83b27cf8dbfe928db504b37c0fa4d1bc", + "spec/functions/mysql_deepmerge_spec.rb": "fb3afbbe85490122c62c1472a9f98d27", + "spec/functions/mysql_dirname_spec.rb": "2d24e3737d189a4a6bc27e0e979b4ab4", + "spec/functions/mysql_password_spec.rb": "3ef9614805abbb84a90a6abb2a4125e6", + "spec/functions/mysql_strip_hash_spec.rb": "40c9eccc3b09ca20ed7ce35930affe21", + "spec/spec_helper.rb": "d1342428e68cc7b29b19a29688def899", + "spec/spec_helper_acceptance.rb": "ee714af36b07fb0638b57c232ffdc9d2", + "spec/spec_helper_local.rb": "35d201e4b56adf60407d84c2a231b9ff", + "spec/unit/facter/mysql_server_id_spec.rb": "6cd165396028f68de96b8e66f1acadb6", + "spec/unit/facter/mysql_version_spec.rb": "0e555c398b189e20648ae6a037d106f6", + "spec/unit/facter/mysqld_version_spec.rb": "7af40a2b38b996684752b49f2cb64ec6", + "spec/unit/puppet/functions/mysql_deepmerge_spec.rb": "96b153d97d10255a9e3904da0a7bfd48", + "spec/unit/puppet/functions/mysql_password_spec.rb": "82214310a621f86813dee0dfecaf27ca", + "spec/unit/puppet/provider/mysql_database/mysql_spec.rb": "05ab36956e6807e9e7056b61c2de05f1", + "spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb": "033d476b84e766a455b7bfd403a67c2d", + "spec/unit/puppet/provider/mysql_user/mysql_spec.rb": "7a8e569fefae9758ec692c2cec46d881", + "spec/unit/puppet/type/mysql_database_spec.rb": "8e790bec45c59bc48544d7ac446b2f25", + "spec/unit/puppet/type/mysql_grant_spec.rb": "f6aafaffed76df6cad9466defb30e34b", + "spec/unit/puppet/type/mysql_plugin_spec.rb": "c4bfe6319219c10142667af520e09e2b", + "spec/unit/puppet/type/mysql_user_spec.rb": "3e56a74ff308a9744c6a915462093846", + "tasks/export.json": "81c6eee3500d31843221da03e75a9f7b", + "tasks/export.rb": "bed98c19b371cef7f4b1a54d273842de", + "tasks/sql.json": "f57ad96a8079e6729ff7557f9ac6fa62", + "tasks/sql.rb": "b6428a942317640b2b23d2776faac505", + "templates/meb.cnf.erb": "b6422b19ee97b8a2883bfac44fdc0292", + "templates/my.cnf.erb": "535d2ff37fea6b11ad928224965143d3", + "templates/my.cnf.pass.erb": "11f80afb0993a436f074a43f70733999", + "templates/mysqlbackup.sh.erb": "5ef94baab34d6061798b7381de89d1d5", + "templates/xtrabackup.sh.erb": "ebcf249f36fd947e2daf5cff92367a14" +} \ No newline at end of file diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp index d80275972..6901d0b01 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp @@ -7,7 +7,7 @@ $validate_password_soname = $::osfamily ? { default => 'validate_password.so' } -mysql::plugin { 'validate_password': +mysql_plugin { 'validate_password': ensure => present, soname => $validate_password_soname, } @@ -17,7 +17,7 @@ $auth_socket_soname = $::osfamily ? { default => 'auth_socket.so' } -mysql::plugin { 'auth_socket': +mysql_plugin { 'auth_socket': ensure => present, soname => $auth_socket_soname, } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp index c47186866..6c312ce40 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp @@ -6,18 +6,18 @@ class { 'mysql::server': mysql_user{ 'redmine@localhost': ensure => present, - password_hash => mysql_password('redmine'), + password_hash => mysql::password('redmine'), require => Class['mysql::server'], } mysql_user{ 'dan@localhost': ensure => present, - password_hash => mysql_password('blah') + password_hash => mysql::password('blah') } mysql_user{ 'dan@%': ensure => present, - password_hash => mysql_password('blah'), + password_hash => mysql::password('blah'), } mysql_user{ 'socketplugin@%': @@ -27,6 +27,6 @@ mysql_user{ 'socketplugin@%': mysql_user{ 'socketplugin@%': ensure => present, - password_hash => mysql_password('blah'), + password_hash => mysql::password('blah'), plugin => 'mysql_native_password', } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb index 61e2acf9a..a97459eff 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb @@ -1,5 +1,5 @@ Facter.add('mysqld_version') do setcode do - Facter::Util::Resolution.exec('mysqld -V 2>/dev/null') + Facter::Util::Resolution.exec('mysqld --no-defaults -V 2>/dev/null') end end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/deepmerge.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/deepmerge.rb new file mode 100644 index 000000000..3cda71d18 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/deepmerge.rb @@ -0,0 +1,66 @@ +# @summary Recursively merges two or more hashes together and returns the resulting hash. +# +# @example +# $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } +# $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } +# $merged_hash = mysql_deepmerge($hash1, $hash2) +# # The resulting hash is equivalent to: +# # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } +# +# - When there is a duplicate key that is a hash, they are recursively merged. +# - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." +# - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. +# +Puppet::Functions.create_function(:'mysql::deepmerge') do + def deepmerge(*args) + if args.length < 2 + raise Puppet::ParseError, _('mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at least 2)') % { args_length: args.length } + end + + result = {} + args.each do |arg| + next if arg.is_a?(String) && arg.empty? # empty string is synonym for puppet's undef + # If the argument was not a hash, skip it. + unless arg.is_a?(Hash) + raise Puppet::ParseError, _('mysql_deepmerge: unexpected argument type %{arg_class}, only expects hash arguments.') % { args_class: args.class } + end + + # We need to make a copy of the hash since it is frozen by puppet + current = deep_copy(arg) + + # Now we have to traverse our hash assigning our non-hash values + # to the matching keys in our result while following our hash values + # and repeating the process. + overlay(result, current) + end + result + end + + def normalized?(hash, key) + return true if hash.key?(key) + return false unless key =~ %r{-|_} + other_key = key.include?('-') ? key.tr('-', '_') : key.tr('_', '-') + return false unless hash.key?(other_key) + hash[key] = hash.delete(other_key) + true + end + + def overlay(hash1, hash2) + hash2.each do |key, value| + if normalized?(hash1, key) && value.is_a?(Hash) && hash1[key].is_a?(Hash) + overlay(hash1[key], value) + else + hash1[key] = value + end + end + end + + def deep_copy(inputhash) + return inputhash unless inputhash.is_a? Hash + hash = {} + inputhash.each do |k, v| + hash.store(k, deep_copy(v)) + end + hash + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/dirname.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/dirname.rb new file mode 100644 index 000000000..4074a4241 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/dirname.rb @@ -0,0 +1,20 @@ +# @summary +# Returns the dirname of a path +# +Puppet::Functions.create_function(:'mysql::dirname') do + # @param path + # Path to find the dirname for. + # + # @return + # Directory name of path. + # + dispatch :dirname do + required_param 'Variant[String, Undef]', :path + return_type 'String' + end + + def dirname(path) + return '' if path.nil? + File.dirname(path) + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/password.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/password.rb new file mode 100644 index 000000000..24d1cc5b1 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/password.rb @@ -0,0 +1,21 @@ +require 'digest/sha1' +# @summary +# Hash a string as mysql's "PASSWORD()" function would do it +# +Puppet::Functions.create_function(:'mysql::password') do + # @param password + # Plain text password. + # + # @return the mysql password hash from the clear text password. + # + dispatch :password do + required_param 'String', :password + return_type 'String' + end + + def password(password) + return '' if password.empty? + return password if password =~ %r{\*[A-F0-9]{40}$} + '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(password)).upcase + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/strip_hash.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/strip_hash.rb new file mode 100644 index 000000000..90a74e686 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/functions/mysql/strip_hash.rb @@ -0,0 +1,19 @@ +# @summary +# When given a hash this function strips out all blank entries. +# +Puppet::Functions.create_function(:'mysql::strip_hash') do + # @param hash + # Hash to be stripped + # + dispatch :strip_hash do + required_param 'Hash', :hash + return_type 'Hash' + end + + def strip_hash(hash) + # Filter out all the top level blanks. + hash.reject { |_k, v| v == '' }.each do |_k, v| + v.reject! { |_ki, vi| vi == '' } if v.is_a?(Hash) + end + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb index 97d10229b..766028e89 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb @@ -1,21 +1,20 @@ -# Recursively merges two or more hashes together and returns the resulting hash. module Puppet::Parser::Functions newfunction(:mysql_deepmerge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| - Recursively merges two or more hashes together and returns the resulting hash. - - For example: + @summary Recursively merges two or more hashes together and returns the resulting hash. + @example $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } $merged_hash = mysql_deepmerge($hash1, $hash2) # The resulting hash is equivalent to: # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } - When there is a duplicate key that is a hash, they are recursively merged. - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + - When there is a duplicate key that is a hash, they are recursively merged. + - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." + - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. + @return [Hash] ENDHEREDOC if args.length < 2 diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb index e1a21202d..40a8ad64f 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb @@ -1,7 +1,13 @@ -# Returns the dirname of a path. module Puppet::Parser::Functions newfunction(:mysql_dirname, type: :rvalue, doc: <<-EOS - Returns the dirname of a path. + @summary + Returns the dirname of a path + + @param [String] path + Path to find the dirname for. + + @return [String] + Directory name of path. EOS ) do |arguments| diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb index 4169bf433..53ba580b2 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb @@ -1,9 +1,12 @@ require 'digest/sha1' -# Returns the mysql password hash from the clear text password. -# Hash a string as mysql's "PASSWORD()" function would do it module Puppet::Parser::Functions newfunction(:mysql_password, type: :rvalue, doc: <<-EOS - Returns the mysql password hash from the clear text password. + @summary + Hash a string as mysql's "PASSWORD()" function would do it + + @param [String] password Plain text password. + + @return [String] the mysql password hash from the clear text password. EOS ) do |args| diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb index 173d3ce9e..a01570849 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb @@ -50,13 +50,21 @@ class Puppet::Provider::Mysql < Puppet::Provider self.class.mysqld_version end + def self.newer_than(forks_versions) + forks_versions.keys.include?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) >= 0 + end + + def newer_than(forks_versions) + self.class.newer_than(forks_versions) + end + def defaults_file self.class.defaults_file end def self.mysql_caller(text_of_sql, type) if type.eql? 'system' - mysql_raw([defaults_file, '--host=', system_database, '-e', text_of_sql].flatten.compact) + mysql_raw([defaults_file, system_database, '-e', text_of_sql].flatten.compact) elsif type.eql? 'regular' mysql_raw([defaults_file, '-NBe', text_of_sql].flatten.compact) else diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb index ec5f32b32..b733b9379 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb @@ -52,7 +52,7 @@ Puppet::Type.type(:mysql_datadir).provide(:mysql, parent: Puppet::Provider::Mysq end opts = [defaults_extra_file] - %w[basedir datadir user].each do |opt| + ['basedir', 'datadir', 'user'].each do |opt| val = eval(opt) # rubocop:disable Security/Eval opts << "--#{opt}=#{val}" unless val.nil? end @@ -60,7 +60,7 @@ Puppet::Type.type(:mysql_datadir).provide(:mysql, parent: Puppet::Provider::Mysq if mysqld_version.nil? debug("Installing MySQL data directory with mysql_install_db #{opts.compact.join(' ')}") mysql_install_db(opts.compact) - elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0 + elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6') opts << "--log-error=#{log_error}" opts << initialize.to_s debug("Initializing MySQL data directory >= 5.7.6 with mysqld: #{opts.compact.join(' ')}") @@ -80,7 +80,7 @@ Puppet::Type.type(:mysql_datadir).provide(:mysql, parent: Puppet::Provider::Mysq def exists? datadir = @resource[:datadir] - File.directory?("#{datadir}/mysql") && (Dir.entries("#{datadir}/mysql") - %w[. ..]).any? + File.directory?("#{datadir}/mysql") && (Dir.entries("#{datadir}/mysql") - ['.', '..']).any? end ## diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb index d647f6420..bbe7b63a1 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb @@ -14,7 +14,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) ## Default ... # rubocop:disable Metrics/LineLength query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'" - elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0 + elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6') query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, AUTHENTICATION_STRING, PLUGIN FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'" else query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'" @@ -83,8 +83,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) @property_hash[:max_updates_per_hour] = max_updates_per_hour merged_tls_options = tls_options.join(' AND ') - if ((mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0) || - (mysqld_type == 'mariadb' && Puppet::Util::Package.versioncmp(mysqld_version, '10.2.0') >= 0) + if newer_than('mysql' => '5.7.6', 'percona' => '5.7.6', 'mariadb' => '10.2.0') self.class.mysql_caller("ALTER USER '#{merged_name}' REQUIRE #{merged_tls_options}", 'system') else self.class.mysql_caller("GRANT USAGE ON *.* TO '#{merged_name}' REQUIRE #{merged_tls_options}", 'system') @@ -96,7 +95,13 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) def destroy merged_name = @resource[:name].sub('@', "'@'") - self.class.mysql_caller("DROP USER '#{merged_name}'", 'system') + if_exists = if newer_than('mysql' => '5.7', 'percona' => '5.7', 'mariadb' => '10.1.3') + 'IF EXISTS ' + else + '' + end + + self.class.mysql_caller("DROP USER #{if_exists}'#{merged_name}'", 'system') @property_hash.clear exists? ? (return false) : (return true) @@ -120,8 +125,8 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) if mysqld_version.nil? # default ... if mysqld_version does not work self.class.mysql_caller("SET PASSWORD FOR #{merged_name} = '#{string}'", 'system') - elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0 - raise ArgumentError, _('Only mysql_native_password (*ABCD...XXX) hashes are supported.') unless string =~ %r{^\*} + elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6') + raise ArgumentError, _('Only mysql_native_password (*ABCD...XXX) hashes are supported.') unless string =~ %r{^\*|^$} self.class.mysql_caller("ALTER USER #{merged_name} IDENTIFIED WITH mysql_native_password AS '#{string}'", 'system') else self.class.mysql_caller("SET PASSWORD FOR #{merged_name} = '#{string}'", 'system') @@ -161,7 +166,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) def plugin=(string) merged_name = self.class.cmd_user(@resource[:name]) - if (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0 + if newer_than('mysql' => '5.7.6', 'percona' => '5.7.6') sql = "ALTER USER #{merged_name} IDENTIFIED WITH '#{string}'" sql << " AS '#{@resource[:password_hash]}'" if string == 'mysql_native_password' else @@ -178,8 +183,7 @@ Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) def tls_options=(array) merged_name = self.class.cmd_user(@resource[:name]) merged_tls_options = array.join(' AND ') - if ((mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0) || - (mysqld_type == 'mariadb' && Puppet::Util::Package.versioncmp(mysqld_version, '10.2.0') >= 0) + if newer_than('mysql' => '5.7.6', 'percona' => '5.7.6', 'mariadb' => '10.2.0') self.class.mysql_caller("ALTER USER #{merged_name} REQUIRE #{merged_tls_options}", 'system') else self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} REQUIRE #{merged_tls_options}", 'system') diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb index f8b940650..817f04257 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb @@ -1,5 +1,10 @@ Puppet::Type.newtype(:mysql_database) do - @doc = 'Manage MySQL databases.' + @doc = <<-PUPPET + @summary + Manage a MySQL database. + + @api private + PUPPET ensurable diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb index e49a41195..7945f4e30 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb @@ -1,5 +1,10 @@ Puppet::Type.newtype(:mysql_datadir) do - @doc = 'Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above).' + @doc = <<-PUPPET + @summary + Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). + + @api private + PUPPET ensurable diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb index c8929d8dc..ea1db177d 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb @@ -1,6 +1,10 @@ -# This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_grant) do - @doc = "Manage a MySQL user's rights." + @doc = <<-PUPPET + @summary + Manage a MySQL user's rights. + + @api private + PUPPET ensurable autorequire(:file) { '/root/.my.cnf' } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb index 029220e18..433146e69 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb @@ -1,5 +1,14 @@ Puppet::Type.newtype(:mysql_plugin) do - @doc = 'Manage MySQL plugins.' + @doc = <<-PUPPET + @summary + Manage MySQL plugins. + + @example + mysql_plugin { 'some_plugin': + soname => 'some_pluginlib.so', + } + + PUPPET ensurable diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb index 8a564edd6..10dfae7c0 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb @@ -1,6 +1,11 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_user) do - @doc = 'Manage a MySQL user. This includes management of users password as well as privileges.' + @doc = <<-PUPPET + @summary + Manage a MySQL user. This includes management of users password as well as privileges. + + @api private + PUPPET ensurable diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp index 08a5cc1d7..adcb99e2e 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp @@ -1,4 +1,8 @@ -# See README.me for usage. +# @summary +# Manage the mysqlbackup client. +# +# @api private +# class mysql::backup::mysqlbackup ( $backupuser = '', $backuppassword = '', @@ -25,7 +29,7 @@ class mysql::backup::mysqlbackup ( mysql_user { "${backupuser}@localhost": ensure => $ensure, - password_hash => mysql_password($backuppassword), + password_hash => mysql::password($backuppassword), require => Class['mysql::server::root_password'], } @@ -88,7 +92,7 @@ class mysql::backup::mysqlbackup ( 'password' => $backuppassword, } } - $options = mysql_deepmerge($default_options, $mysql::server::override_options) + $options = mysql::deepmerge($default_options, $mysql::server::override_options) file { 'mysqlbackup-config-file': path => '/etc/mysql/conf.d/meb.cnf', diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp index e8988dfc4..7ed2a86a2 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp @@ -1,4 +1,7 @@ -# See README.me for usage. +# @summary +# "Provider" for mysqldump +# @api private +# class mysql::backup::mysqldump ( $backupuser = '', $backuppassword = '', @@ -30,7 +33,7 @@ class mysql::backup::mysqldump ( mysql_user { "${backupuser}@localhost": ensure => $ensure, - password_hash => mysql_password($backuppassword), + password_hash => mysql::password($backuppassword), require => Class['mysql::server::root_password'], } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp index e0365588a..fc3e670d7 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp @@ -1,4 +1,7 @@ -# See README.me for usage. +# @summary +# "Provider" for Percona XtraBackup +# @api private +# class mysql::backup::xtrabackup ( $xtrabackup_package_name = $mysql::params::xtrabackup_package_name, $backupuser = undef, @@ -26,14 +29,12 @@ class mysql::backup::xtrabackup ( $additional_cron_args = '' ) inherits mysql::params { - package{ $xtrabackup_package_name: - ensure => $ensure, - } + ensure_packages($xtrabackup_package_name) if $backupuser and $backuppassword { mysql_user { "${backupuser}@localhost": ensure => $ensure, - password_hash => mysql_password($backuppassword), + password_hash => mysql::password($backuppassword), require => Class['mysql::server::root_password'], } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp index 3fd9c74a3..a6565ce2a 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp @@ -1,4 +1,72 @@ -# See README.md. +# @summary +# Parent class for MySQL bindings. +# +# @example Install Ruby language bindings +# class { 'mysql::bindings': +# ruby_enable => true, +# ruby_package_ensure => 'present', +# ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', +# ruby_package_provider => 'rpm', +# } +# @param install_options +# Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s). +# @param java_enable +# Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. +# @param perl_enable +# Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. +# @param php_enable +# Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. +# @param python_enable +# Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. +# @param ruby_enable +# Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. +# @param client_dev +# Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. +# @param daemon_dev +# Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. +# @param java_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `java_enable => true`. +# @param java_package_name +# The name of the Java package to install. Only applies if `java_enable => true`. +# @param java_package_provider +# The provider to use to install the Java package. Only applies if `java_enable => true`. +# @param perl_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `perl_enable => true`. +# @param perl_package_name +# The name of the Perl package to install. Only applies if `perl_enable => true`. +# @param perl_package_provider +# The provider to use to install the Perl package. Only applies if `perl_enable => true`. +# @param php_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `php_enable => true`. +# @param php_package_name +# The name of the PHP package to install. Only applies if `php_enable => true`. +# @param php_package_provider +# The provider to use to install the PHP package. Only applies if `php_enable => true`. +# @param python_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `python_enable => true`. +# @param python_package_name +# The name of the Python package to install. Only applies if `python_enable => true`. +# @param python_package_provider +# The provider to use to install the Python package. Only applies if `python_enable => true`. +# @param ruby_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `ruby_enable => true`. +# @param ruby_package_name +# The name of the Ruby package to install. Only applies if `ruby_enable => true`. +# @param ruby_package_provider +# What provider should be used to install the package. +# @param client_dev_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `client_dev => true`. +# @param client_dev_package_name +# The name of the client_dev package to install. Only applies if `client_dev => true`. +# @param client_dev_package_provider +# The provider to use to install the client_dev package. Only applies if `client_dev => true`. +# @param daemon_dev_package_ensure +# Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `daemon_dev => true`. +# @param daemon_dev_package_name +# The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. +# @param daemon_dev_package_provider +# The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. +# class mysql::bindings ( $install_options = undef, # Boolean to determine if we should include the classes. diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp index dc249e158..9e88946db 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing client development bindings +# +# @api private +# class mysql::bindings::client_dev { if $mysql::bindings::client_dev_package_name { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp index 44caaafc1..48a936e32 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing daemon development bindings +# +# @api private +# class mysql::bindings::daemon_dev { if $mysql::bindings::daemon_dev_package_name { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp index db93ac282..23e3aa566 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing java language bindings. +# +# @api private +# class mysql::bindings::java { package { 'mysql-connector-java': diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp index 99d429c46..9ef13b9bc 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing perl language bindings. +# +# @api private +# class mysql::bindings::perl { package{ 'perl_mysql': diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp index 9af706962..36c914921 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp @@ -1,4 +1,8 @@ -# Private class: See README.md +# @summary +# Private class for installing php language bindings +# +# @api private +# class mysql::bindings::php { package { 'php-mysql': diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp index a44c8fa15..1c2494ac5 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing python language bindings +# +# @api private +# class mysql::bindings::python { package { 'python-mysqldb': diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp index d431efedc..1630265fb 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing ruby language bindings +# +# @api private +# class mysql::bindings::ruby { package{ 'ruby_mysql': diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp index 2af2351d3..58cd04f71 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp @@ -1,3 +1,23 @@ +# @summary +# Installs and configures the MySQL client. +# +# @example Install the MySQL client +# class {'::mysql::client': +# package_name => 'mysql-client', +# package_ensure => 'present', +# bindings_enable => true, +# } +# +# @param bindings_enable +# Whether to automatically install all bindings. Valid values are `true`, `false`. Default to `false`. +# @param install_options +# Array of install options for managed package resources. You must pass the appropriate options for the package manager. +# @param package_ensure +# Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# @param package_manage +# Whether to manage the MySQL client package. Defaults to `true`. +# @param package_name +# The name of the MySQL client package to install. # class mysql::client ( $bindings_enable = $mysql::params::bindings_enable, diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp index 26e5ec276..9e5f98e7c 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp @@ -1,4 +1,8 @@ -# See README.md. +# @summary +# Private class for MySQL client install. +# +# @api private +# class mysql::client::install { if $mysql::client::package_manage { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp index 6b6c39b9b..a84c0c84d 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp @@ -1,19 +1,60 @@ -# See README.md for details. +# @summary +# Create and configure a MySQL database. +# +# @example Create a database +# mysql::db { 'mydb': +# user => 'myuser', +# password => 'mypass', +# host => 'localhost', +# grant => ['SELECT', 'UPDATE'], +# } +# +# @param user +# The user for the database you're creating. +# @param password +# The password for $user for the database you're creating. +# @param tls_options +# The tls_options for $user for the database you're creating. +# @param dbname +# The name of the database to create. +# @param charset +# The character set for the database. +# @param collate +# The collation for the database. +# @param host +# The host to use as part of user@host for grants. +# @param grant +# The privileges to be granted for user@host on the database. +# @param grant_options +# The grant_options for the grant for user@host on the database. +# @param sql +# The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. +# @param enforce_sql +# Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. +# @param ensure +# Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. +# @param import_timeout +# Timeout, in seconds, for loading the sqlfiles. Defaults to 300. +# @param import_cat_cmd +# Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. +# define mysql::db ( $user, $password, + $tls_options = undef, $dbname = $name, $charset = 'utf8', $collate = 'utf8_general_ci', $host = 'localhost', $grant = 'ALL', + $grant_options = undef, Optional[Variant[Array, Hash, String]] $sql = undef, $enforce_sql = false, Enum['absent', 'present'] $ensure = 'present', $import_timeout = 300, $import_cat_cmd = 'cat', ) { - #input validation + $table = "${dbname}.*" $sql_inputs = join([$sql], ' ') @@ -31,7 +72,8 @@ define mysql::db ( $user_resource = { ensure => $ensure, - password_hash => mysql_password($password), + password_hash => mysql::password($password), + tls_options => $tls_options, } ensure_resource('mysql_user', "${user}@${host}", $user_resource) @@ -41,6 +83,7 @@ define mysql::db ( provider => 'mysql', user => "${user}@${host}", table => $table, + options => $grant_options, require => [ Mysql_database[$dbname], Mysql_user["${user}@${host}"], diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp index 9de66a983..e28fa0071 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp @@ -1,4 +1,8 @@ -# Private class: See README.md. +# @summary +# Params class. +# +# @api private +# class mysql::params { $manage_config_file = true @@ -221,27 +225,30 @@ class mysql::params { } 'Archlinux': { - $client_package_name = 'mariadb-clients' - $server_package_name = 'mariadb' - $basedir = '/usr' - $config_file = '/etc/mysql/my.cnf' - $datadir = '/var/lib/mysql' - $log_error = '/var/log/mysqld.log' - $pidfile = '/var/run/mysqld/mysqld.pid' - $root_group = 'root' - $mysql_group = 'mysql' - $server_service_name = 'mysqld' - $socket = '/var/lib/mysql/mysql.sock' - $ssl_ca = '/etc/mysql/cacert.pem' - $ssl_cert = '/etc/mysql/server-cert.pem' - $ssl_key = '/etc/mysql/server-key.pem' - $tmpdir = '/tmp' + $daemon_dev_package_name = undef + $client_dev_package_name = undef + $includedir = undef + $client_package_name = 'mariadb-clients' + $server_package_name = 'mariadb' + $basedir = '/usr' + $config_file = '/etc/mysql/my.cnf' + $datadir = '/var/lib/mysql' + $log_error = '/var/log/mysqld.log' + $pidfile = '/var/run/mysqld/mysqld.pid' + $root_group = 'root' + $mysql_group = 'mysql' + $server_service_name = 'mysqld' + $socket = '/var/lib/mysql/mysql.sock' + $ssl_ca = '/etc/mysql/cacert.pem' + $ssl_cert = '/etc/mysql/server-cert.pem' + $ssl_key = '/etc/mysql/server-key.pem' + $tmpdir = '/tmp' # mysql::bindings - $java_package_name = 'mysql-connector-java' - $perl_package_name = 'perl-dbd-mysql' - $php_package_name = undef - $python_package_name = 'mysql-python' - $ruby_package_name = 'mysql-ruby' + $java_package_name = 'mysql-connector-java' + $perl_package_name = 'perl-dbd-mysql' + $php_package_name = undef + $python_package_name = 'mysql-python' + $ruby_package_name = 'mysql-ruby' } 'Gentoo': { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp index 11e074880..9e2ba9f54 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp @@ -1,4 +1,69 @@ -# Class: mysql::server: See README.md for documentation. +# @summary +# Installs and configures the MySQL server. +# +# @example Install MySQL Server +# class { '::mysql::server': +# package_name => 'mysql-server', +# package_ensure => '5.7.1+mysql~trusty', +# root_password => 'strongpassword', +# remove_default_accounts => true, +# } +# +# @param config_file +# The location, as a path, of the MySQL configuration file. +# @param includedir +# The location, as a path, of !includedir for custom configuration overrides. +# @param install_options +# Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager +# @param install_secret_file +# Path to secret file containing temporary root password. +# @param manage_config_file +# Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. +# @param override_options +# Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. +# @param package_ensure +# Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. +# @param package_manage +# Whether to manage the MySQL server package. Defaults to `true`. +# @param package_name +# The name of the MySQL server package to install. +# @param purge_conf_dir +# Whether the `includedir` directory should be purged. Valid values are `true`, `false`. Defaults to `false`. +# @param remove_default_accounts +# Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. +# @param restart +# Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. +# @param root_group +# The name of the group used for root. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). +# @param mysql_group +# The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). +# @param root_password +# The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. +# @param service_enabled +# Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. +# @param service_manage +# Specifies whether the service should be managed. Valid values are `true`, `false`. Defaults to `true`. +# @param service_name +# The name of the MySQL server service. Defaults are OS dependent, defined in 'params.pp'. +# @param service_provider +# The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. +# @param create_root_user +# Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes. +# @param create_root_my_cnf +# Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. +# @param users +# Optional hash of users to create, which are passed to [mysql_user](#mysql_user). +# @param grants +# Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). +# @param databases +# Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). +# @param enabled +# _Deprecated_ +# @param manage_service +# _Deprecated_ +# @param old_root_password +# This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. +# class mysql::server ( $config_file = $mysql::params::config_file, $includedir = $mysql::params::includedir, @@ -49,7 +114,7 @@ class mysql::server ( } # Create a merged together set of options. Rightmost hashes win over left. - $options = mysql_deepmerge($mysql::params::default_options, $override_options) + $options = mysql::deepmerge($mysql::params::default_options, $override_options) Class['mysql::server::root_password'] -> Mysql::Db <| |> diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp index 3fcdd614c..c2095d83a 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp @@ -1,4 +1,8 @@ -# See README.md. +# @summary +# Private class for ensuring localhost accounts do not exist +# +# @api private +# class mysql::server::account_security { mysql_user { [ 'root@127.0.0.1', diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp index 21102d384..25bf0537a 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp @@ -1,4 +1,60 @@ -# See README.me for usage. +# @summary +# Create and manage a MySQL backup. +# +# @example Create a basic MySQL backup: +# class { 'mysql::server': +# root_password => 'password' +# } +# class { 'mysql::server::backup': +# backupuser => 'myuser', +# backuppassword => 'mypassword', +# backupdir => '/tmp/backups', +# } +# +# @param backupuser +# MySQL user with backup administrator privileges. +# @param backuppassword +# Password for `backupuser`. +# @param backupdir +# Directory to store backup. +# @param backupdirmode +# Permissions applied to the backup directory. This parameter is passed directly to the file resource. +# @param backupdirowner +# Owner for the backup directory. This parameter is passed directly to the file resource. +# @param backupdirgroup +# Group owner for the backup directory. This parameter is passed directly to the file resource. +# @param backupcompress +# Whether or not to compress the backup (when using the mysqldump provider) +# @param backuprotate +# Backup rotation interval in 24 hour periods. +# @param ignore_events +# Ignore the mysql.event table. +# @param delete_before_dump +# Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup. +# @param backupdatabases +# Databases to backup (if using xtrabackup provider). +# @param file_per_database +# Use file per database mode creating one file per database backup. +# @param include_routines +# Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. +# @param include_triggers +# Dump triggers for each dumped table when doing a `file_per_database` backup. +# @param ensure +# @param time +# An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times. +# @param prescript +# A script that is executed before the backup begins. +# @param postscript +# A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files. +# @param execpath +# Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. +# @param provider +# Sets the server backup implementation. Valid values are: +# @param maxallowedpacket +# Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. +# @param optional_args +# Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.) +# class mysql::server::backup ( $backupuser = undef, $backuppassword = undef, diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp index 459915d0c..68d5c09e1 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp @@ -1,4 +1,8 @@ -# Binary log configuration requires the mysql user to be present. This must be done after package install +# @summary +# Binary log configuration requires the mysql user to be present. This must be done after package install +# +# @api private +# class mysql::server::binarylog { $options = $mysql::server::options @@ -7,7 +11,7 @@ class mysql::server::binarylog { $logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false) if $logbin { - $logbindir = mysql_dirname($logbin) + $logbindir = mysql::dirname($logbin) #Stop puppet from managing directory if just a filename/prefix is specified if $logbindir != '.' { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp index de97bea5e..6c0b7f017 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp @@ -1,4 +1,8 @@ -# See README.me for options. +# @summary +# Private class for MySQL server configuration. +# +# @api private +# class mysql::server::config { $options = $mysql::server::options @@ -20,7 +24,7 @@ class mysql::server::config { # on some systems this is /etc/my.cnf.d, while Debian has /etc/mysql/conf.d and FreeBSD something in /usr/local. For the latter systems, # managing this basedir is also required, to have it available before the package is installed. - $includeparentdir = mysql_dirname($includedir) + $includeparentdir = mysql::dirname($includedir) if $includeparentdir != '/' and $includeparentdir != '/etc' { file { $includeparentdir: ensure => directory, @@ -39,9 +43,9 @@ class mysql::server::config { # on mariadb systems, $includedir is not defined, but /etc/my.cnf.d has # to be managed to place the server.cnf there - $configparentdir = mysql_dirname($mysql::server::config_file) + $configparentdir = mysql::dirname($mysql::server::config_file) if $configparentdir != '/' and $configparentdir != '/etc' and $configparentdir - != $includedir and $configparentdir != mysql_dirname($includedir) { + != $includedir and $configparentdir != mysql::dirname($includedir) { file { $configparentdir: ensure => directory, mode => '0755', diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp index 3b9601def..21c762ef7 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing MySQL package. +# +# @api private # class mysql::server::install { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp index 7e5423328..ee80b4604 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp @@ -1,3 +1,7 @@ +# @summary +# Builds initial databases on installation. +# +# @api private # class mysql::server::installdb { $options = $mysql::server::options diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp index 6b1860983..0e9d43a62 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp @@ -1,4 +1,13 @@ -#This is a helper class to add a monitoring user to the database +# @summary +# This is a helper class to add a monitoring user to the database +# +# @param mysql_monitor_username +# The username to create for MySQL monitoring. +# @param mysql_monitor_password +# The password to create for MySQL monitoring. +# @param mysql_monitor_hostname +# The hostname from which the monitoring user requests are allowed access. +# class mysql::server::monitor ( $mysql_monitor_username = '', $mysql_monitor_password = '', @@ -9,7 +18,7 @@ class mysql::server::monitor ( mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}": ensure => present, - password_hash => mysql_password($mysql_monitor_password), + password_hash => mysql::password($mysql_monitor_password), require => Class['mysql::server::service'], } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp index ae91e63ac..b337f50ca 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp @@ -1,3 +1,14 @@ +# @summary +# Manage the MySQLTuner package. +# +# @param ensure +# Ensures that the resource exists. Valid values are 'present', 'absent'. Defaults to 'present'. +# @param version +# The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. +# @param source +# Source path for the mysqltuner package. +# @param environment +# Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' # class mysql::server::mysqltuner( $ensure = 'present', diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp index b651172fc..0f1cb8fa9 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp @@ -1,6 +1,8 @@ -# Convenience class to call each of the three providers with the corresponding -# hashes provided in mysql::server. -# See README.md for details. +# @summary +# Convenience class to call each of the three providers with the corresponding hashes provided in mysql::server. +# +# @api private +# class mysql::server::providers { create_resources('mysql_user', $mysql::server::users) create_resources('mysql_grant', $mysql::server::grants) diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp index 9ebc10398..e32f6f834 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing the root password +# +# @api private # class mysql::server::root_password { @@ -22,7 +26,7 @@ class mysql::server::root_password { if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' { mysql_user { 'root@localhost': ensure => present, - password_hash => mysql_password($mysql::server::root_password), + password_hash => mysql::password($mysql::server::root_password), require => Exec['remove install pass'] } } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp index 3ce81d483..f9bc20c2a 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing the MySQL service +# +# @api private # class mysql::server::service { $options = $mysql::server::options diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json index 6a86aad08..43491b84f 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json @@ -1,7 +1,7 @@ { "name": "puppetlabs-mysql", - "version": "5.3.0", - "author": "Puppet Labs", + "version": "6.2.0", + "author": "puppetlabs", "summary": "Installs, configures, and manages the MySQL service.", "license": "Apache-2.0", "source": "git://github.com/puppetlabs/puppetlabs-mysql.git", @@ -14,13 +14,14 @@ }, { "name": "puppetlabs/stdlib", - "version_requirement": ">= 3.2.0 < 5.0.0" + "version_requirement": ">= 3.2.0 < 6.0.0" }, { "name": "puppet/staging", "version_requirement": ">= 1.0.1 < 4.0.0" } ], + "data_provider": null, "operatingsystem_support": [ { "operatingsystem": "RedHat", @@ -49,7 +50,6 @@ { "operatingsystem": "Scientific", "operatingsystemrelease": [ - "5", "6", "7" ] @@ -57,14 +57,13 @@ { "operatingsystem": "SLES", "operatingsystemrelease": [ - "11 SP1", + "11", "12" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ - "7", "8", "9" ] @@ -73,17 +72,19 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "14.04", - "16.04" + "16.04", + "18.04" ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.7.0 < 6.0.0" + "version_requirement": ">= 4.7.0 < 7.0.0" } ], "description": "MySQL module", - "template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git", - "template-ref": "1.3.2-0-g07678c8" + "template-url": "https://github.com/puppetlabs/pdk-templates", + "template-ref": "heads/master-0-g8fc95db", + "pdk-version": "1.7.0" } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md index 69f98c3d1..483a4daa9 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md @@ -2,22 +2,23 @@ #### 目次 -1. [モジュールについて - モジュールの機能とその有益性](#モジュールについて) -2. [セットアップ - mysql導入の基本](#セットアップ) - * [mysqlの導入](#mysqlの導入) -3. [使用方法 - 設定オプションとその他の機能](#使用方法) - * [サーバオプションのカスタマイズ](#サーバオプションのカスタマイズ) - * [データベースの作成](#データベースの作成) - * [設定のカスタマイズ](#設定のカスタマイズ) - * [既存のサーバに対する操作](#既存のサーバに対する操作) - * [パスワードの指定](#パスワードの指定) - * [CentOSへのPerconaサーバのインストール](#centosへのperconaサーバのインストール) - *[UbuntuへのMariaDBのインストール](#ubuntuへのmariadbのインストール) -4. [参考 - モジュールの機能と動作について](#参考) -5. [制約事項 - OSの互換性など](#制約事項) -6. [開発 - モジュール貢献についてのガイドライン](#開発) +1. [説明 - モジュールの機能とその有益性](#module-description) +2. [セットアップ - mysql導入の基本](#setup) + * [mysqlの導入](#beginning-with-mysql) +3. [使用方法 - 設定オプションと追加機能](#usage) + * [サーバオプションのカスタマイズ](#customize-server-options) + * [データベースを作成します](#create-a-database) + * [設定のカスタマイズ](#customize-configuration) + * [既存のサーバに対する操作](#work-with-an-existing-server) + * [パスワードの指定](#specify-passwords) + * [CentOSへのPerconaサーバのインストール](#install-percona-server-on-centos) + * [UbuntuへのMariaDBのインストール](#install-mariadb-on-ubuntu) + * [プラグインのインストール](#install-plugins) +4. [参考 - モジュールの機能と動作について](REFERENCE.md) +5. [制約 - OS互換性など](#limitations) +6. [開発 - モジュール貢献についてのガイド](#development) -## モジュールについて +## モジュールの概要 mysqlモジュールは、MySQLサービスをインストール、設定、管理します。 @@ -43,7 +44,7 @@ class { '::mysql::server': $override_options用のハッシュ構造体の例については、後述の[**サーバオプションのカスタマイズ**](#サーバオプションのカスタマイズ)を参照してください。 -## 使用方法 +## 使用 サーバに関するすべてのインタラクションは`mysql::server`を使用して行われ、クライアントのインストールには`mysql::client`が、バインディングのインストールには`mysql::bindings`が使用されます。 @@ -90,7 +91,7 @@ replicate-do-db = base2 バージョンに固有なパラメータを実装するには、[mysqld-5.5]のようにバージョンを指定します。こうすると、1つのconfigで複数の異なるバージョンのMySQLに対応できます。 -### データベースの作成 +### データベースを作成します ユーザおよび割り当てられたいくつかの権限を含むデータベースを作成するには、次のようにします。 @@ -170,15 +171,15 @@ mysql::db { 'mydb': } ``` +必要に応じて、パスワードも空文字列とし、パスワードなしで接続を許可することができます。 + ### CentOSへのPerconaサーバのインストール -次の例は、CentOSシステムへのPerconaサーバの最小限のインストール方法を示します。 -この例では、Perconaサーバ、クライアント、バインディング(PerlとPythonのバインディングを含む)がセットアップされます。この方法をカスタマイズして必要に応じバージョンを更新することができます。 +次の例は、CentOSシステムへのPerconaサーバの最小限のインストール方法を示します。この例では、Perconaサーバ、クライアント、バインディング(PerlとPythonのバインディングを含む)がセットアップされます。この方法をカスタマイズして必要に応じバージョンを更新することができます。 この方法は、Puppet 4.4/CentOS 7/Perconaサーバ5.7でテストされています。 -**注意:** yumレポジトリのインストールはこのパッケージには含まれていません。 -この例は、インストールの詳細を示したものに過ぎません。 +注意:** yumレポジトリのインストールはこのパッケージには含まれていません。 ```puppet yumrepo { 'percona': @@ -229,7 +230,7 @@ class { 'mysql::bindings': python_package_name => 'MySQL-python', } -# 依存関係の定義 +# Dependencies definition Yumrepo['percona']-> Class['mysql::server'] @@ -293,8 +294,7 @@ class {'::mysql::server': } } -# 依存関係の管理。レポジトリをインストールする場合は -# この例の前のステップで示されている部分だけを使用してください。 +# 依存関係の管理。レポジトリをインストールする場合はこの例の前のステップで示されている部分だけを使用してください。 Apt::Source['mariadb'] ~> Class['apt::update'] -> Class['::mysql::server'] @@ -314,7 +314,7 @@ class {'::mysql::client': bindings_enable => true, } -# 依存関係の管理。レポジトリをインストールする場合はこの例の前のステップで示されている部分だけを使用してください。 +# Dependency management. Only use that part if you are installing the repository as shown in the Preliminary step of this example. Apt::Source['mariadb'] ~> Class['apt::update'] -> Class['::mysql::client'] @@ -326,7 +326,7 @@ MySQLモジュールおよびHieraを使用して、MySQL Communityサーバー * MySQL Community Server 5.6 * Centos 7.3 -* Hieraを使用したPuppet 3.8.7 +* Hieraを使用したPuppet 3.8.7 * puppetlabs-mysqlモジュールv3.9.0 Puppetで: @@ -357,17 +357,17 @@ yumrepo: gpgkey: 'http://repo.mysql.com/RPM-GPG-KEY-mysql' mysql::client::package_name: "mysql-community-client" # 適切なMySQL導入のために必要 -mysql::server::package_name: "mysql-community-server" #適切なMySQL導入のために必要 -mysql::server::package_ensure: 'installed' #ここではバージョンを指定しないでください。残念ながら、パッケージがインストールされているエラーでyumは失敗しました。 +mysql::server::package_name: "mysql-community-server" # 適切なMySQL導入のために必要 +mysql::server::package_ensure: 'installed' # ここではバージョンを指定しないでください。残念ながら、パッケージがインストールされているエラーでyumは失敗しました。 mysql::server::root_password: "change_me_i_am_insecure" mysql::server::manage_config_file: true mysql::server::service_name: 'mysqld' # Puppetモジュールに必要 mysql::server::override_options: 'mysqld': 'bind-address': '127.0.0.1' - 'log-error': /var/log/mysqld.log' # 適切なMySQL導入のために必要 + 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要 'mysqld_safe': - 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要 + 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要 # データベース+アクセスできるアカウント、暗号化されていないパスワードを作成 mysql::server::db: @@ -380,929 +380,32 @@ mysql::server::db: ``` +### プラグインのインストール -## 参考 - -### クラス - -#### パブリッククラス - -* [`mysql::server`](#mysqlserver):MySQLをインストールして設定します。 -* [`mysql::server::monitor`](#mysqlservermonitor):モニタするユーザをセットアップします。 -* [`mysql::server::mysqltuner`](#mysqlservermysqltuner):MySQL tunerスクリプトをインストールします。 -* [`mysql::server::backup`](#mysqlserverbackup):cronを使用してMySQLバックアップをセットアップします。 -* [`mysql::bindings`](#mysqlbindings):さまざまなMySQL言語バインディングをインストールします。 -* [`mysql::client`](#mysqlclient):MySQLクライアントをインストールします(サーバ以外)。 - -#### プライベートクラス - -* `mysql::server::install`:パッケージをインストールします。 -* `mysql::server::installdb`:mysqldデータディレクトリ(/var/lib/mysqlなど)のセットアップを実行します。 -* `mysql::server::config`:MySQLを設定します。 -* `mysql::server::service`:サービスを管理します。 -* `mysql::server::account_security`:デフォルトのMySQLアカウントを削除します。 -* `mysql::server::root_password`:MySQLのルートパスワードを設定します。 -* `mysql::server::providers`:ユーザ、GRANT権限、データベースを作成します。 -* `mysql::bindings::client_dev`:MySQLクライアント開発パッケージをインストールします。 -* `mysql::bindings::daemon_dev`:MySQLデーモン開発パッケージをインストールします。 -* `mysql::bindings::java`:javaバインディングをインストールします。 -* `mysql::bindings::perl`:Perlバインディングをインストールします。 -* `mysql::bindings::php`:PHPバインディングをインストールします。 -* `mysql::bindings::python`:Pythonバインディングをインストールします。 -* `mysql::bindings::ruby`:Rubyバインディングをインストールします。 -* `mysql::client::install`:MySQLクライアントをインストールします。 -* `mysql::backup::mysqldump`:mysqldumpのバックアップを実行します。 -* `mysql::backup::mysqlbackup`:Oracle MySQL Enterprise Backupを使用してバックアップを実行します。 -* `mysql::backup::xtrabackup`:PerconaのXtraBackupを使用してバックアップを実行します。 - -### パラメータ - -#### mysql::server - -##### `create_root_user` - -ルートユーザを作成するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -このパラメータは、Galeraでクラスタをセットアップする場合に役立ちます。ルートユーザの作成が必要なのは一度だけです。このパラメータを、1つのノードに対しtrueに設定し、他のすべてのノードに対してfalseに設定できます。 - -##### `create_root_my_cnf` - -`/root/.my.cnf`を作成するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -`create_root_my_cnf`を使用すると`create_root_user`に左右されずに`/root/.my.cnf`を作成できます。すべてのノードに`/root/.my.cnf`が存在するようにしたい場合に、Galeraでこの機能を使用してクラスタをセットアップできます。 - -##### `root_password` - -MySQLのルートパスワード。Puppetは、このパラメータを使用して、ルートパスワードの設定や`/root/.my.cnf`の更新を試みます。 - -`create_root_user`または`create_root_my_cnf`がtrueの場合にこのパラメータが必要です。`root_password`が'UNSET'の場合は`create_root_user`と`create_root_my_cnf`がfalseになります(MySQLルートユーザと`/root/.my.cnf`が作成されません)。 - -パスワード変更はサポートされますが、`/root/.my.cnf`に旧パスワードが設定されている必要があります。実際には、Puppetは`/root/.my.cnf`に設定されている旧パスワードを使用してMySQLで新しいパスワードを設定してから、`/root/.my.cnf`を新しいパスワードで更新します。 - -##### `old_root_password` - -現在、このパラメータでは何も行わず、下位互換性を確保するためだけに存在します。ルートパスワードの変更についての詳細は、上記の`root_password`パラメータの説明を参照してください。 - -##### `override_options` - -MySQLに渡すオーバーライドオプションを指定します。構造はmy.cnfファイルのハッシュと同様です。 +プラグインはユーザ定義のタイプ`mysql_plugin` を使用してインストールできます。`examples/mysql_plugin.pp`で、具体的な例を参照してください。 ```puppet -$override_options = { - 'section' => { - 'item' => 'thing', - } +class { 'mysql::server': + root_password => 'password' } + +mysql_plugin { 'auth_pam': + ensure => present, + soname => 'auth_pam.so', +} + ``` -使用方法の詳細は、上記の[**サーバオプションのカスタマイズ**](#サーバオプションのカスタマイズ)を参照してください。 - -##### `config_file` - -MySQL設定ファイルの場所を示すパス。 - -##### `manage_config_file` - -MySQL設定ファイルを管理するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -##### `includedir` - -カスタム設定オーバーライド用の!includedirの場所を示すパス。 - -##### `install_options` - -管理対象のパッケージリソースに[install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)配列を渡します。指定されているパッケージマネージャに対応する正しいオプションを渡す必要があります。 - -##### `purge_conf_dir` - -`includedir`ディレクトリをパージするかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `restart` - -何らかの変更があった場合にサービスを再起動するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `root_group` - -ルートに使用するグループの名前。グループ名またはグループIDのいずれかです。詳細については[`group`ファイルの属性](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。 - -##### `mysql_group` - -MySQLデーモンユーザのグループの名前。グループ名またはグループIDのいずれかです。詳細については[`group`ファイルの属性](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。 - -##### `package_ensure` - -パッケージが存在するかどうか、またはパッケージが特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -デフォルト値:'present'。 - -##### `package_manage` - -MySQLサーバパッケージを管理するかどうかを指定します。 - -デフォルト値:`true`。 - -##### `package_name` - -インストールするMySQLサーバパッケージの名前。 - -##### `remove_default_accounts` - -`mysql::server::account_security`を自動的に含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `service_enabled` - -サービスの有効化を指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -##### `service_manage` - -サービスを管理するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -##### `service_name` - -MySQLサーバサービスの名前。 - -デフォルト値はOSにより異なり、'params.pp'に定義されています。 - -##### `service_provider` - -サービスの管理に使用するプロバイダ。 - -Ubuntuの場合のデフォルト値は'upstart'、Ubuntu以外の場合のデフォルト値は定義されていません。 - -##### `users` - -作成するユーザのハッシュ(オプション)。[mysql_user](#mysql_user)に渡されます。 - -```puppet -users => { - 'someuser@localhost' => { - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', - password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF', - tls_options => ['NONE'], - }, -} -``` - -##### `grants` - -[mysql_grant](#mysql_grant)に渡されるGRANT権限のハッシュ(オプション)。 - -```puppet -grants => { - 'someuser@localhost/somedb.*' => { - ensure => 'present', - options => ['GRANT'], - privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'], - table => 'somedb.*', - user => 'someuser@localhost', - }, -} -``` - -##### `databases` - -作成されるデータベースのハッシュ(オプション)。[mysql_database](#mysql_database)に渡されます。 - -```puppet -databases => { - 'somedb' => { - ensure => 'present', - charset => 'utf8', - }, -} -``` - -#### mysql::server::backup - -##### `backupuser` - -バックアップ用に作成するMySQLユーザ。 - -##### `backuppassword` - -バックアップ用のMySQLユーザパスワード。 - -##### `backupdir` - -バックアップを保存するディレクトリ。 - -##### `backupdirmode` - -バックアップディレクトリに適用されるパーミッション。このパラメータは`file`リソースに直接渡されます。 - -##### `backupdirowner` - -バックアップディレクトリの所有者。このパラメータは`file`リソースに直接渡されます。 - -##### `backupdirgroup` - -バックアップディレクトリのグループ所有者。このパラメータは`file`リソースに直接渡されます。 - -##### `backupcompress` - -バックアップを圧縮するかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`true`。 - -##### `backuprotate` - -バックアップを保持する日数。 - -有効な値:整数値。 - -デフォルト値:30。 - -##### `delete_before_dump` - -バックアップ前に古い.sqlファイルを削除するかどうかを設定します。trueに設定すると古いファイルがバックアップ前に削除され、falseに設定するとバックアップ後に削除されます。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `backupdatabases` - -バックアップするデータベースの配列を指定します。 - -##### `file_per_database` - -データベースごとに個別のファイルを使用するかどうかを設定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `include_routines` - -`file_per_database`バックアップを実行する際にデータベースごとにルーチンを含めるかどうかを設定します。 - -デフォルト値:`false`。 - -##### `include_triggers` - -`file_per_database`バックアップを実行する際にデータベースごとにトリガを含めるかどうかを設定します。 - -デフォルト値:`false`。 - -##### `ensure` - -バックアップスクリプトを削除できます。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `execpath` - -MySQLを標準的でない場所にインストールする場合にカスタムパスを設定できます。デフォルト値:`/usr/bin:/usr/sbin:/bin:/sbin`。 - -##### `time` - -バックアップ時刻を設定する2つの要素の配列。時刻をHH:MM形式で['23', '5'](23:05)または['3', '45'](03:45)に設定できます。 - -#### mysql::server::backup - -##### `postscript` - -バックアップ終了時に実行されるスクリプト。この機能を使用すると、バックアップを中央ストアに同期させることができます。このスクリプトは、直接実行される1つの行であっても、配列を形成する複数の行であっても構いません。あるいは、外部で管理される1つ以上の(実行可能な)ファイルにすることもできます。 - -##### `prescript` - -バックアップ開始前に実行されるスクリプト。 - -##### `provider` - -サーバのバックアップの実行について設定します。有効な値は以下のとおりです。 - -* `mysqldump`:mysqldumpを使用してバックアップを実行。バックアップのタイプ:Logical(デフォルト値)。 -* `mysqlbackup`:OracleのMySQL Enterprise Backupを使用してバックアップを実行します。バックアップのタイプ:Physical。このタイプのバックアップを使用するにはOracleの`meb`パッケージが必要です。RPM形式のものとTAR形式のものがあります。Ubuntuの場合は、[meb-deb](https://github.com/dveeden/meb-deb)を使用して公式のtarballからパッケージを作成できます。 -* `xtrabackup:PerconaのXtraBackupを使用してバックアップを実行します。バックアップのタイプ:Physical。 - -##### `maxallowedpacket` - -バックアップダンプスクリプト用のSQLステートメントの最大サイズを定義ます。デフォルト値は1MBで、MySQL Serverのデフォルト値と同じです。 - -##### `optional_args` - -バックアップツールに渡すべきオプションの引数の配列を指定します(現在はxtrabackupプロバイダでのみサポート)。 - -#### mysql::server::monitor - -##### `mysql_monitor_username` - -MySQLのモニタ用に作成するユーザ名。 - -##### `mysql_monitor_password` - -MySQLのモニタ用に作成するパスワード。 - -##### `mysql_monitor_hostname` - -モニタするユーザリクエストへのアクセスが許可されたホスト名。 - -#### mysql::server::mysqltuner - -**注意**:ネットワークに接続されていないシステムでこのクラスを使用する場合は、mysqltuner.plスクリプトをダウンロードし、`http(s)://`、`puppet://`、`ftp://`、または完全修飾ファイルパスを使用して、アクセス可能な場所でホストされるようにしておく必要があります。 - -##### `ensure` - -リソースが存在することを確認します。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `version` - -major/MySQLTuner-perl githubレポジトリからインストールするバージョン。有効なタグでなければなりません。 - -デフォルト値:'v1.3.0'。 - -##### `environment` - -プロキシを使用したダウンロードなどのダウンロード中に有効な環境変数:environment => 'https_proxy=http://proxy.example.com:80' - -#### mysql::bindings - -##### `client_dev` - -`::mysql::bindings::client_dev`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `daemon_dev` - -`::mysql::bindings::daemon_dev`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `java_enable` - -`::mysql::bindings::java`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `perl_enable` - -`mysql::bindings::perl`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `php_enable` - -`mysql::bindings::php`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `python_enable` - -`mysql::bindings::python`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `ruby_enable` - -`mysql::bindings::ruby`を含めるかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `install_options` - -管理対象のパッケージリソースに`install_options`を渡します。パッケージマネージャに対応する[正しいオプション](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)を渡す必要があります。 - -##### `client_dev_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`client_dev => true`の場合だけです。 - -##### `client_dev_package_name` - -インストールするclient_devパッケージの名前。 - -適用されるのは`client_dev => true`の場合だけです。 - -##### `client_dev_package_provider` - -client_devパッケージのインストールに使用するプロバイダ。 - -適用されるのは`client_dev => true`の場合だけです。 - -##### `daemon_dev_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのはdaemon_dev => true`の場合だけです。 - -##### `daemon_dev_package_name` - -インストールするdaemon_devパッケージの名前。 - -適用されるのはdaemon_dev => true`の場合だけです。 - -##### `daemon_dev_package_provider` - -daemon_devパッケージのインストールに使用するプロバイダ。 - -適用されるのはdaemon_dev => true`の場合だけです。 - -##### `java_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`java_enable => true`の場合だけです。 - -##### `java_package_name` - -インストールするJavaパッケージの名前。 - -適用されるのは`java_enable => true`の場合だけです。 - -##### `java_package_provider` - -Javaパッケージのインストールに使用するプロバイダ。 - -適用されるのは`java_enable => true`の場合だけです。 - -##### `perl_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`perl_enable => true`の場合だけです。 - -##### `perl_package_name` - -インストールするPerlパッケージの名前。 - -適用されるのは`perl_enable => true`の場合だけです。 - -##### `perl_package_provider` - -Perlパッケージのインストールに使用するプロバイダ。 - -適用されるのは`perl_enable => true`の場合だけです。 - -##### `php_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`php_enable => true`の場合だけです。 - -##### `php_package_name` - -インストールするPHPパッケージの名前。 - -適用されるのは`php_enable => true`の場合だけです。 - -##### `python_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`python_enable => true`の場合だけです。 - -##### `python_package_name` - -インストールするPythonパッケージの名前。 - -適用されるのは`python_enable => true`の場合だけです。 - -##### `python_package_provider` - -Pythonパッケージのインストールに使用するプロバイダ。 - -適用されるのは`python_enable => true`の場合だけです。 - -##### `ruby_package_ensure` - -パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -適用されるのは`ruby_enable => true`の場合だけです。 - -##### `ruby_package_name` - -インストールするRubyパッケージの名前。 - -適用されるのは`ruby_enable => true`の場合だけです。 - -##### `ruby_package_provider` - -Rubyパッケージのインストールに使用するプロバイダ。 - -#### mysql::client - -##### `bindings_enable` - -すべてのバインディングを自動的にインストールするかどうかを指定します。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `install_options` - -管理対象のパッケージリソースに関するインストールオプションの配列。パッケージマネージャに対応する正しいオプションを渡す必要があります。 - -##### `package_ensure` - -MySQLパッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。 - -有効な値:'present'、'absent'、または'x.y.z'。 - -##### `package_manage` - -MySQLクライアントパッケージを管理するかどうかを指定します。 - -デフォルト値:`true`。 - -##### `package_name` - -インストールするMySQLクライアントパッケージの名前。 - -### 定義 - -#### mysql::db - -```puppet -mysql_database { 'information_schema': - ensure => 'present', - charset => 'utf8', - collate => 'utf8_swedish_ci', -} -mysql_database { 'mysql': - ensure => 'present', - charset => 'latin1', - collate => 'latin1_swedish_ci', -} -``` - -##### `user` - -作成するデータベースのユーザ。 - -##### `password` - -作成するデータベースの$userのパスワード。 - -##### `dbname` - -作成するデータベースの名前。 - -デフォルト値:"$name"。 - -##### `charset` - -データベースに使用するキャラクタセット。 - -デフォルト値:'utf8'。 - -##### `collate` - -データベースの照合順序。 - -デフォルト値:'utf8_general_ci'。 - -##### `host` - -GRANT権限を付与するuser@hostの一部として使用するホスト。 - -デフォルト値:'localhost'。 - -##### `grant` - -データベースに対してuser@hostに付与される権限。 - -デフォルト値:'ALL'。 - -##### `sql` - -実行するsqlfileへのパス。文字列として指定された1つのファイル、または文字列の配列のいずれかです。 - -デフォルト値:`undef`。 - -##### `enforce_sql` - -sqlfilesを毎回実行するかどうかを指定します。falseに設定した場合はsqlfilesは1回しか実行されません。 - -有効な値:`true`、`false`。 - -デフォルト値:`false`。 - -##### `ensure` - -データベースを作成するかどうかを指定します。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `import_timeout` - -sqlfilesをロードするときのタイムアウト(秒)。 - -デフォルト値:300。 - -##### `import_cat_cmd` - -データベースをインポートするためにsqlfileを読み込むコマンド。sqlfilesが圧縮されている場合に役立ちます。たとえば.gzファイルの場合に'zcat'を使用することができます。 - -デフォルト値:'cat'。 - -### タイプ - -#### mysql_database - -`mysql_database`は、MySQLでデータベースを作成し、管理します。 - -##### `ensure` - -リソースの存在を指定します。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `name` - -管理するMySQLデータベースの名前。 - -##### `charset` - -データベースに使用するキャラクタセットの設定。 - -デフォルト値:'utf8'。 - -##### `collate` - -データベースに使用する照合順序の設定。 - -デフォルト値:'utf8_general_ci'。 - -#### mysql_user - -MySQLでのユーザのGRANT権限を作成し、管理します。 - -```puppet -mysql_user { 'root@127.0.0.1': - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', -} -``` - -認証プラグインを指定することもできます。 - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - plugin => 'unix_socket', -} -``` - -ユーザに対しTLSオプションを指定できます。 - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - tls_options => ['SSL'], -} -``` - -##### `name` - -ユーザ名('username@hostname'またはusername@hostname)。 - -##### `password_hash` - -ユーザのパスワードハッシュ。このようなハッシュを作成するには、mysql_password()を使用してください。 - -##### `max_user_connections` - -同時に接続するユーザ数の最大値。 - -整数値でなければなりません。 - -指定値が'0'の場合は無制限(またはグローバル)になります。 - -##### `max_connections_per_hour` - -ユーザの1時間あたりの接続回数最大値。 - -整数値でなければなりません。 - -指定値が'0'の場合は無制限(またはグローバル)になります。 - -##### `max_queries_per_hour` - -ユーザの1時間あたりのクエリ数最大値。 - -整数値でなければなりません。 - -指定値が'0'の場合は無制限(またはグローバル)になります。 - -##### `max_updates_per_hour` - -ユーザの1時間あたりの更新回数最大値。 - -整数値でなければなりません。 - -指定値が'0'の場合は無制限(またはグローバル)になります。 - -##### `tls_options` - -1つ以上のtls_optionの値を使用するMySQLアカウント用のSSL関連のオプション。'NONE'の場合はアカウントにTLSオプションが指定されません。使用可能なオプションは、MySQLドキュメントに示されているとおり、'SSL'、'X509'、'CIPHER *cipher*'、'ISSUER *issuer*'、'SUBJECT *subject*'です。 - - -#### mysql_grant - -`mysql_grant`は、MySQLでデータベースにアクセスするのに必要なGRANT権限を作成します。MySQLでデータベースにアクセスするためのGRANT権限を作成するには、`username@hostname/database.table`のパターンに続けて次のようにリソースのタイトルを作成する必要があります。 - -```puppet -mysql_grant { 'root@localhost/*.*': - ensure => 'present', - options => ['GRANT'], - privileges => ['ALL'], - table => '*.*', - user => 'root@localhost', -} -``` - -次のように、列レベルまで詳細に権限を指定することができます。 - -```puppet -mysql_grant { 'root@localhost/mysql.user': - ensure => 'present', - privileges => ['SELECT (Host, User)'], - table => 'mysql.user', - user => 'root@localhost', -} -``` - -GRANT権限を取り消す場合は['NONE']を指定します。 - -##### `ensure` - -リソースの存在を指定します。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `name` - -GRANT権限を示す名前。'user/table'の形式でなければなりません。 - -##### `privileges` - -ユーザに許可を与える権限。 - -##### `table` - -権限が適用されるテーブル。 - -##### `user` - -権限が付与されるユーザ。 - -##### `options` - -権限を付与するMySQLオプション(オプション)。 - -#### mysql_plugin - -`mysql_plugin`を使用してMySQLサーバにプラグインをロードできます。 - -```puppet -mysql_plugin { 'auth_socket': - ensure => 'present', - soname => 'auth_socket.so', -} -``` - -##### `ensure` - -リソースの存在を指定します。 - -有効な値:'present'、'absent'。 - -デフォルト値:'present'。 - -##### `name` - -管理するMySQLプラグインの名前。 - -##### `soname` - -ライブラリファイルの名前。 - -#### `mysql_datadir` - -バージョンに固有なコードでMySQLデータディレクトリを初期化します。MySQL 5.7.6より前のバージョンではmysql_install_dbを、後のバージョンではmysqld --initialize-insecureを使用します。 - -安全でない初期化が必要なのは、mysqldバージョン5.7で'secure by default'モードが導入されているからです。これは、MySQLがランダムなパスワードを作成してSTDOUTに書き込むことを意味します。したがって、使用可能な認証情報がないためPuppetが後でデータベースサーバにアクセスすることはできません。 - -このタイプは内部タイプであるため、直接呼び出すことはできません。 - -### ファクト - -#### `mysql_version` - -`mysql --version`からの出力を解析してMySQLのバージョンを判断します。 - -#### `mysql_server_id` - -ノードのMACアドレスに基づいて、`server_id`として使用可能な一意なIDを作成します。ループバックインターフェイスしかないノードでは、このファクトは*常に*`0`を返します。これらのノードは外部に接続されていないため、これが衝突の原因になる可能性はありません。 - ### タスク MySQLモジュールにはサンプルタスクがあり、ユーザはデータベースに対して任意のSQLを実行できます。[Puppet Enterpriseマニュアル](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html)または[Boltマニュアル](https://puppet.com/docs/bolt/latest/bolt.html)で、タスクを実行する方法に関する情報を参照してください。 -## 制約事項 +## 制約 -このモジュールは以下のプラットフォームでテストされています。 - -* RedHat Enterprise Linux 5、6、7 -* Debian 6、7、8 -* CentOS 5、 6、7 -* Ubuntu 10.04、12.04、14.04、16.04 -* Scientific Linux 5、6 -* SLES 11 - -他のプラットフォームでは最小限のテストしか行っていないため、保証はできません。 +サポートされているオペレーティングシステムの一覧については、[metadata.json](https://github.com/puppetlabs/puppetlabs-tomcat/blob/master/metadata.json)を参照してください。 **注意:** mysqlbackup.shは、MySQL 5.7以降では動作せず、サポートされていません。 -Debian 9の互換性は完全には検証されていません。 - ## 開発 Puppet Forge上のPuppetモジュールはオープンプロジェクトであり、その価値を維持するにはコミュニティからの貢献が欠かせません。Puppetが提供する膨大な数のプラットフォームや、無数のハードウェア、ソフトウェア、デプロイ設定に弊社がアクセスすることは不可能です。 @@ -1326,4 +429,4 @@ Puppet Forge上のPuppetモジュールはオープンプロジェクトであ * Chris Weyl * Daniël van Eeden * Jan-Otto Kröpke -* Timothy Sven Nelson \ No newline at end of file +* Timothy Sven Nelson diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/REFERENCE_ja_JP.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/REFERENCE_ja_JP.md new file mode 100644 index 000000000..ce5091ae9 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/REFERENCE_ja_JP.md @@ -0,0 +1,1180 @@ +# リファレンス + + +## クラス + +### パブリッククラス + +* [`mysql::bindings`](#mysqlbindings): MySQLバインディングの親クラス。 +* [`mysql::client`](#mysqlclient): MySQLクライアントをインストールして設定します。 +* [`mysql::server`](#mysqlserver): MySQLサーバをインストールして設定します。 +* [`mysql::server::backup`](#mysqlserverbackup): MySQLバックアップを作成して管理します。 +* [`mysql::server::monitor`](#mysqlservermonitor): モニタするユーザをデータベースに追加するヘルパクラスです。 +* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): MySQLTunerパッケージを管理します。 + +### プライベートクラス + +* `mysql::backup::mysqlbackup`: mysqlbackupクライアントを管理します。 +* `mysql::backup::mysqldump`: mysqldumpの"プロバイダ" +* `mysql::backup::xtrabackup`: Percona XtraBackupの"プロバイダ" +* `mysql::bindings::client_dev`: クライアント開発バインディングのインストールに使用するプライベートクラス +* `mysql::bindings::daemon_dev`: デーモン開発バインディングのインストールに使用するプライベートクラス +* `mysql::bindings::java`: java言語バインディングのインストールに使用するプライベートクラス。 +* `mysql::bindings::perl`: perl言語バインディングのインストールに使用するプライベートクラス。 +* `mysql::bindings::php`: php言語バインディングのインストールに使用するプライベートクラス +* `mysql::bindings::python`: python言語バインディングのインストールに使用するプライベートクラス +* `mysql::bindings::ruby`: ruby言語バインディングのインストールに使用するプライベートクラス +* `mysql::client::install`: MySQLクライアントのインストールに使用するプライベートクラス。 +* `mysql::params`: Paramsクラス。 +* `mysql::server::account_security`: localhostアカウントが存在しないことを確認するためのプライベートクラス +* `mysql::server::binarylog`: バイナリログの設定では、mysqlユーザが必要です。パッケージのインストール後に行ってください +* `mysql::server::config`: MySQLサーバの設定に使用するプライベートクラス。 +* `mysql::server::install`: MySQLパッケージの管理に使用するプライベートクラス。 +* `mysql::server::installdb`: インストール時に初期データベースを構築します。 +* `mysql::server::providers`: mysel::serverで指定された、対応するハッシュを使って3つのプロバイダを呼び出すためのコンビニエンスクラス。 +* `mysql::server::root_password`: ルートパスワードの管理に使用するプライベートクラス +* `mysql::server::service`: MySQLサービスの管理に使用するプライベートクラス + +## 定義された型 + +* [`mysql::db`](#mysqldb): MySQLデータベースを作成して設定します。 + +## リソース型 + +### パブリックリソース型 + +* [`mysql_plugin`](#mysql_plugin): MySQLプラグインを管理します。 + +### プライベートリソース型 + +* `mysql_database`: MySQLデータベースを管理します。 +* `mysql_datadir`: mysql_install_dbまたはmysqld (5.7.6以上)を使用してMySQL datadirsを管理します。 +* `mysql_grant`: MySQLのユーザ権限を管理します。 +* `mysql_user`: MySQLユーザを管理します。これには、ユーザパスワードおよび権限の管理が含まれます。 + +## 関数 + +* [`mysql_deepmerge`](#mysql_deepmerge): 2つ以上のハッシュタグを再帰的に統合し、その結果得られたハッシュを返します。 +* [`mysql_dirname`](#mysql_dirname): パスのdirnameを返します +* [`mysql_password`](#mysql_password): mysqlの"PASSWORD()"関数のように、文字列にハッシュをかけます +* [`mysql_strip_hash`](#mysql_strip_hash): TEMPORARY FUNCTION: EXPIRES 2014-03-10 ハッシュが指定されると、この関数はすべての空白エントリを取り除きます。 + +## タスク + +* [`export`](#export): ローカルファイルにデータベースのバックアップを作成できます。 +* [`sql`](#sql): 任意のSQLを実行できます + +## クラス + +### mysql::bindings + +MySQLバインディングの親クラス。 + +#### 例 + +##### Ruby言語バインディングをインストールします + +```puppet +class { 'mysql::bindings': + ruby_enable => true, + ruby_package_ensure => 'present', + ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', + ruby_package_provider => 'rpm', +} +``` + +#### パラメータ + +`mysql::bindings`クラスでは、以下のパラメータを使用できます。 + +##### `install_options` + +データ型: `Any` + +管理対象のパッケージリソースに`install_options`を渡します。パッケージマネージャに対応する[正しいオプション](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)を渡す必要があります。 + +デフォルト値: `undef` + +##### `java_enable` + +データ型: `Any` + +`::mysql::bindings::java`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `perl_enable` + +データ型: `Any` + +`mysql::bindings::perl`を含めるかどうかを指定します。有効な値: `true`、false`。 + +デフォルト値: `false` + +##### `php_enable` + +データ型: `Any` + +`mysql::bindings::php`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `python_enable` + +データ型: `Any` + +`mysql::bindings::python`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `ruby_enable` + +データ型: `Any` + +`mysql::bindings::ruby`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `client_dev` + +データ型: `Any` + +`::mysql::bindings::client_dev`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `daemon_dev` + +データ型: `Any` + +`::mysql::bindings::daemon_dev`を含めるかどうかを指定します。有効な値: `true`、`false`。 + +デフォルト値: `false` + +##### `java_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`java_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::java_package_ensure + +##### `java_package_name` + +データ型: `Any` + +インストールするJavaパッケージの名前。適用されるのは`java_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::java_package_name + +##### `java_package_provider` + +データ型: `Any` + +Javaパッケージのインストールに使用するプロバイダ。適用されるのは`java_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::java_package_provider + +##### `perl_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`perl_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::perl_package_ensure + +##### `perl_package_name` + +データ型: `Any` + +インストールするPerlパッケージの名前。適用されるのは`perl_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::perl_package_name + +##### `perl_package_provider` + +データ型: `Any` + +Perlパッケージのインストールに使用するプロバイダ。適用されるのは`perl_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::perl_package_provider + +##### `php_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`php_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::php_package_ensure + +##### `php_package_name` + +データ型: `Any` + +インストールするPHPパッケージの名前。適用されるのは`php_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::php_package_name + +##### `php_package_provider` + +データ型: `Any` + +PHPパッケージのインストールに使用するプロバイダ。適用されるのは`php_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::php_package_provider + +##### `python_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`python_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::python_package_ensure + +##### `python_package_name` + +データ型: `Any` + +インストールするPythonパッケージの名前。適用されるのは`python_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::python_package_name + +##### `python_package_provider` + +データ型: `Any` + +Pythonパッケージのインストールに使用するプロバイダ。適用されるのは`python_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::python_package_provider + +##### `ruby_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`ruby_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::ruby_package_ensure + +##### `ruby_package_name` + +データ型: `Any` + +インストールするRubyパッケージの名前。適用されるのは`ruby_enable => true`の場合だけです。 + +デフォルト値: $mysql::params::ruby_package_name + +##### `ruby_package_provider` + +データ型: `Any` + +Rubyパッケージのインストールに使用するプロバイダ。 + +デフォルト値: $mysql::params::ruby_package_provider + +##### `client_dev_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`client_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::client_dev_package_ensure + +##### `client_dev_package_name` + +データ型: `Any` + +インストールするclient_devパッケージの名前。適用されるのは`client_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::client_dev_package_name + +##### `client_dev_package_provider` + +データ型: `Any` + +client_devパッケージのインストールに使用するプロバイダ。適用されるのは`client_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::client_dev_package_provider + +##### `daemon_dev_package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。適用されるのは`daemon_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::daemon_dev_package_ensure + +##### `daemon_dev_package_name` + +データ型: `Any` + +インストールするdaemon_devパッケージの名前。適用されるのは`daemon_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::daemon_dev_package_name + +##### `daemon_dev_package_provider` + +データ型: `Any` + +daemon_devパッケージのインストールに使用するプロバイダ。適用されるのは`daemon_dev => true`の場合だけです。 + +デフォルト値: $mysql::params::daemon_dev_package_provider + +### mysql::client + +MySQLクライアントをインストールして設定します。 + +#### 例 + +##### MySQLクライアントをインストールします + +```puppet +class {'::mysql::client': + package_name => 'mysql-client', + package_ensure => 'present', + bindings_enable => true, +} +``` + +#### パラメータ + +`mysql::client`クラスでは、以下のパラメータを使用できます。 + +##### `bindings_enable` + +データ型: `Any` + +すべてのバインディングを自動的にインストールするかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `false`。 + +デフォルト値: $mysql::params::bindings_enable + +##### `install_options` + +データ型: `Any` + +管理対象のパッケージリソースに関するインストールオプションの配列。パッケージマネージャに対応する正しいオプションを渡す必要があります。 + +デフォルト値: `undef` + +##### `package_ensure` + +データ型: `Any` + +MySQLパッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。 + +デフォルト値: $mysql::params::client_package_ensure + +##### `package_manage` + +データ型: `Any` + +MySQLクライアントパッケージを管理するかどうかを指定します。デフォルト値: `true`。 + +デフォルト値: $mysql::params::client_package_manage + +##### `package_name` + +データ型: `Any` + +インストールするMySQLクライアントパッケージの名前。 + +デフォルト値: $mysql::params::client_package_name + +### mysql::server + +MySQLサーバーをインストールして設定します。 + +#### 例 + +##### MySQLサーバをインストールします + +```puppet +class { '::mysql::server': + package_name => 'mysql-server', + package_ensure => '5.7.1+mysql~trusty', + root_password => 'strongpassword', + remove_default_accounts => true, +} +``` + +#### パラメータ + +`mysql::server`クラスでは、以下のパラメータを使用できます。 + +##### `config_file` + +データ型: `Any` + +MySQL設定ファイルの場所を示すパス。 + +デフォルト値: $mysql::params::config_file + +##### `includedir` + +データ型: `Any` + +カスタム設定オーバーライド用の!includedirの場所を示すパス。 + +デフォルト値: $mysql::params::includedir + +##### `install_options` + +データ型: `Any` + +管理対象のパッケージリソースに[install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)配列を渡します。指定されているパッケージマネージャに対応する正しいオプションを渡す必要があります。 + +デフォルト値: `undef` + +##### `install_secret_file` + +データ型: `Any` + +一時的なルートパスワードを含むシークレットファイルへのパス。 + +デフォルト値: $mysql::params::install_secret_file + +##### `manage_config_file` + +データ型: `Any` + +MySQLの設定ファイルを管理するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `true`。 + +デフォルト値: $mysql::params::manage_config_file + +##### `override_options` + +データ型: `Any` + +MySQLに渡すオーバーライドオプションを指定します。構造はmy.cnfファイルのハッシュと同様です。詳しい使用方法については、上記を参照してください。 + +デフォルト値: {} + +##### `package_ensure` + +データ型: `Any` + +パッケージが存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。有効な値: 'present'、'absent'、'x.y.z'。デフォルト値: 'present'。 + +デフォルト値: $mysql::params::server_package_ensure + +##### `package_manage` + +データ型: `Any` + +MySQLサーバパッケージを管理するかどうかを指定します。デフォルト値: `true`。 + +デフォルト値: $mysql::params::server_package_manage + +##### `package_name` + +データ型: `Any` + +インストールするMySQLサーバパッケージの名前。 + +デフォルト値: $mysql::params::server_package_name + +##### `purge_conf_dir` + +データ型: `Any` + +`includedir`ディレクトリをパージするかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `false`。 + +デフォルト値: $mysql::params::purge_conf_dir + +##### `remove_default_accounts` + +データ型: `Any` + +`mysql::server::account_security`を自動的に含めるかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `false`。 + +デフォルト値: `false` + +##### `restart` + +データ型: `Any` + +何らかの変化があった場合にサービスを再起動するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `false`。 + +デフォルト値: $mysql::params::restart + +##### `root_group` + +データ型: `Any` + +ルートに使用するグループの名前。グループ名またはグループIDのいずれかです。詳細については[group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。 + +デフォルト値: $mysql::params::root_group + +##### `mysql_group` + +データ型: `Any` + +MySQLデーモンユーザのグループの名前、グループ名またはグループIDのいずれかです。詳細については[group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。 + +デフォルト値: $mysql::params::mysql_group + +##### `root_password` + +データ型: `Any` + +MySQLのルートパスワード。Puppetは、このパラメータを使用して、ルートパスワードの設定や`/root/.my.cnf`の更新を試みます。`create_root_user`または`create_root_my_cnf`がtrueの場合にこのパラメータが必要です。`root_password`が'UNSET'の場合は`create_root_user`と`create_root_my_cnf`はfalseになります(MySQLルートユーザと`/root/.my.cnf`は作成されません)。パスワード変更はサポートされますが、`/root/.my.cnf`に旧パスワードが設定されている必要があります。実際には、Puppetは`/root/my.cnf`に設定されている旧パスワードを使用してMySQLで新しいパスワードを設定してから、`/root/.my.cnf`を新しいパスワードで更新します。 + +デフォルト値: $mysql::params::root_password + +##### `service_enabled` + +データ型: `Any` + +サービスを有効化するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `true`。 + +デフォルト値: $mysql::params::server_service_enabled + +##### `service_manage` + +データ型: `Any` + +サービスを管理するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `true`。 + +デフォルト値: $mysql::params::server_service_manage + +##### `service_name` + +データ型: `Any` + +MySQLサーバサービスの名前。デフォルト値はOSにより異なり、'params.pp'に定義されています。 + +デフォルト値: $mysql::params::server_service_name + +##### `service_provider` + +データ型: `Any` + +サービスの管理に使用するプロバイダ。Ubuntuの場合のデフォルト値は'upstart'、Ubuntu以外の場合のデフォルト値は定義されていません。 + +デフォルト値: $mysql::params::server_service_provider + +##### `create_root_user` + +データ型: `Any` + +ルートユーザを作成するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `true`。このパラメータは、Galeraでクラスタをセットアップする場合に役立ちます。ルートユーザの作成が必要なのは一度だけです。このパラメータを、1つのノードに対しtrueに設定し、他のすべてのノードに対してfalseに設定できます。 + +デフォルト値: $mysql::params::create_root_user + +##### `create_root_my_cnf` + +データ型: `Any` + +`/root/.my.cnf`を作成するかどうかを指定します。有効な値: `true`、`false`。デフォルト値: `true`。`create_root_my_cnf`を使用すると`create_root_user`に左右されずに`/root/.my.cnf`を作成できます。すべてのノードに`/root/.my.cnf`が存在するようにした場合に、Galeraでこの機能を使用してクラスタをセットアップできます。 + +デフォルト値: $mysql::params::create_root_my_cnf + +##### `users` + +データ型: `Any` + +作成するユーザのハッシュ(オプション)。[mysql_user](#mysql_user)に渡されます。 + +デフォルト値: {} + +##### `grants` + +データ型: `Any` + +[mysql_grant](#mysql_grant)に渡されるGRANT権限のハッシュ(オプション)。 + +デフォルト値: {} + +##### `databases` + +データ型: `Any` + +作成されるデータベースのハッシュ(オプション)。[mysql_database](#mysql_database)に渡されます。 + +デフォルト値: {} + +##### `enabled` + +データ型: `Any` + +_Deprecated_ + +デフォルト値: `undef` + +##### `manage_service` + +データ型: `Any` + +_Deprecated_ + +デフォルト値: `undef` + +##### `old_root_password` + +データ型: `Any` + +現在、このパラメータでは何も行わず、下位互換性を確保するためだけに存在します。ルートパスワードの変更についての詳細は、上記の`root_password`パラメータの説明を参照してください。 + +デフォルト値: `undef` + +### mysql::server::backup + +MySQLバックアップを作成し、管理します。 + +#### 例 + +##### 基本的なMySQLバックアップを作成します: + +```puppet +class { 'mysql::server': + root_password => 'password' +} +class { 'mysql::server::backup': + backupuser => 'myuser', + backuppassword => 'mypassword', + backupdir => '/tmp/backups', +} +``` + +#### パラメータ + +`mysql::server::backup`クラスでは、以下のパラメータを使用できます。 + +##### `backupuser` + +データ型: `Any` + +バックアップ管理者権限を持つMySQLユーザ。 + +デフォルト値: `undef` + +##### `backuppassword` + +データ型: `Any` + +`backupuser`のパスワード。 + +デフォルト値: `undef` + +##### `backupdir` + +データ型: `Any` + +バックアップを保存するディレクトリ。 + +デフォルト値: `undef` + +##### `backupdirmode` + +データ型: `Any` + +バックアップディレクトリに適用されるパーミッション。このパラメータはfileリソースに直接渡されます。 + +デフォルト値: '0700' + +##### `backupdirowner` + +データ型: `Any` + +バックアップディレクトリの所有者。このパラメータはfileリソースに直接渡されます。 + +デフォルト値: 'root' + +##### `backupdirgroup` + +データ型: `Any` + +バックアップディレクトリのグループ所有者。このパラメータはfileリソースに直接渡されます。 + +デフォルト値: 'root' + +##### `backupcompress` + +データ型: `Any` + +バックアップを圧縮するかどうかを指定します(mysqldumpプロバイダを使用する場合)。 + +デフォルト値: `true` + +##### `backuprotate` + +データ型: `Any` + +バックアップの回転間隔(24時間形式)。 + +デフォルト値: 30 + +##### `ignore_events` + +データ型: `Any` + +mysql.eventテーブルを無視します。 + +デフォルト値: `true` + +##### `delete_before_dump` + +データ型: `Any` + +バックアップ前に古い.sqlファイルを削除するかどうかを設定します。trueに設定すると古いファイルがバックアップ前に削除され、falseに設定するとバックアップ後に削除されます。 + +デフォルト値: `false` + +##### `backupdatabases` + +データ型: `Any` + +バックアップするデータベース(xtrabackupプロバイダを使用する場合)。 + +デフォルト値: [] + +##### `file_per_database` + +データ型: `Any` + +データベースバックアップごとにファイルを1つ作成する、file per databaseモードを使用します。 + +デフォルト値: `false` + +##### `include_routines` + +データ型: `Any` + +`file_per_database`バックアップを実行する際に、ダンプされたデータベースから保存済みのルーチン(プロシージャと関数)をダンプします。 + +デフォルト値: `false` + +##### `include_triggers` + +データ型: `Any` + +`file_per_database`バックアップを実行する際に、ダンプされた各テーブルのトリガをダンプします。 + +デフォルト値: `false` + +##### `ensure` + +データ型: `Any` + + + +デフォルト値: 'present' + +##### `time` + +データ型: `Any` + +バックアップ時刻を設定する2つの要素の配列。時刻をHH:MM形式で['23', '5'](23:05)または['3', '45'](03:45)に設定できます。 + +デフォルト値: ['23', '5'] + +##### `prescript` + +データ型: `Any` + +バックアップ開始前に実行されるスクリプト。 + +デフォルト値: `false` + +##### `postscript` + +データ型: `Any` + +バックアップ終了時に実行されるスクリプト。この機能を使用すると、バックアップを中央ストアに同期させることができます。このスクリプトは、直接実行される1つの行であっても、配列を形成する複数の行であっても構いません。あるいは、外部で管理される1つ以上の(実行可能な)ファイルにすることもできます。 + +デフォルト値: `false` + +##### `execpath` + +データ型: `Any` + +MySQLを標準的でない場所にインストールする場合にカスタムパスを設定できます。デフォルト値:`/usr/bin:/usr/sbin:/bin:/sbin`。 + +デフォルト値: '/usr/bin:/usr/sbin:/bin:/sbin' + +##### `provider` + +データ型: `Any` + +サーバのバックアップの実行について設定します。有効な値は以下のとおりです。 + +デフォルト値: 'mysqldump' + +##### `maxallowedpacket` + +データ型: `Any` + +バックアップダンプスクリプト用のSQLステートメントの最大サイズを定義ます。デフォルト値は1MBで、MySQL Serverのデフォルト値と同じです。 + +デフォルト値: '1M' + +##### `optional_args` + +データ型: `Any` + +バックアップツールに渡すべきオプションの引数の配列を指定します(現在はxtrabackupプロバイダでのみサポート)。 + +デフォルト値: [] + +### mysql::server::monitor + +モニタするユーザをデータベースに追加するヘルパクラスです + +#### パラメータ + +`mysql::server::monitor`クラスでは、以下のパラメータを使用できます。 + +##### `mysql_monitor_username` + +データ型: `Any` + +MySQLのモニタ用に作成するユーザ名。 + +デフォルト値: '' + +##### `mysql_monitor_password` + +データ型: `Any` + +MySQLのモニタ用に作成するパスワード。 + +デフォルト値: '' + +##### `mysql_monitor_hostname` + +データ型: `Any` + +モニタするユーザリクエストへのアクセスが許可されたホスト名。 + +デフォルト値: '' + +### mysql::server::mysqltuner + +MySQLTunerパッケージを管理します。 + +#### パラメータ + +`mysql::server::mysqltuner`クラスでは、以下のパラメータを使用できます。 + +##### `ensure` + +データ型: `Any` + +リソースが存在することを確認します。有効な値: 'present'、'absent'。デフォルト値: 'present'。 + +デフォルト値: 'present' + +##### `version` + +データ型: `Any` + +major/MySQLTuner-perl githubリポジトリからインストールするバージョン。有効なタグでなければなりません。デフォルト値: 'v1.3.0'。 + +デフォルト値: 'v1.3.0' + +##### `source` + +データ型: `Any` + +mysqltunerパッケージのソースパス。 + +デフォルト値: `undef` + +##### `environment` + +データ型: `Any` + +プロキシを使用したダウンロードなどのダウンロード中に有効な環境変数: environment => 'https_proxy=http://proxy.example.com:80' + +デフォルト値: `undef` + +## 定義された型 + +### mysql::db + +MySQLデータベースを作成し、設定します。 + +#### 例 + +##### データベースを作成します + +```puppet +mysql::db { 'mydb': + user => 'myuser', + password => 'mypass', + host => 'localhost', + grant => ['SELECT', 'UPDATE'], +} +``` + +#### パラメータ + +`mysql::db`ユーザ定義タイプでは、以下のパラメータを使用できます。 + +##### `user` + +データ型: `Any` + +作成するデータベースのユーザ。 + +##### `password` + +データ型: `Any` + +作成するデータベースの$userのパスワード。 + +##### `dbname` + +データ型: `Any` + +作成するデータベースの名前。 + +デフォルト値: $name + +##### `charset` + +データ型: `Any` + +データベースに使用するキャラクタセット。 + +デフォルト値: 'utf8' + +##### `collate` + +データ型: `Any` + +データベースの照合順序。 + +デフォルト値: 'utf8_general_ci' + +##### `host` + +データ型: `Any` + +GRANT権限を付与するuser@hostの一部として使用するホスト。 + +デフォルト値: 'localhost' + +##### `grant` + +データ型: `Any` + +データベースに対してuser@hostに付与される権限。 + +デフォルト値: 'ALL' + +##### `sql` + +データタイプ: `Optional[Variant[Array, Hash, String]]` + +実行するsqlfileへのパス。文字列として指定された1つのファイル、または文字列の配列のいずれかです。 + +デフォルト値: `undef` + +##### `enforce_sql` + +データ型: `Any` + +sqlfilesを毎回実行するかどうかを指定します。falseに設定した場合はsqlfilesは1回しか実行されません。 + +デフォルト値: `false` + +##### `ensure` + +データタイプ: `Enum['absent', 'present']` + +データベースを作成するかどうかを指定します。有効な値: 'present'、'absent'。デフォルト値: 'present'。 + +デフォルト値: 'present' + +##### `import_timeout` + +データ型: `Any` + +sqlfilesをロードするときのタイムアウト(秒)。デフォルト値: 300。 + +デフォルト値: 300 + +##### `import_cat_cmd` + +データ型: `Any` + +データベースをインポートするためにsqlfileを読み込むコマンド。sqlfilesが圧縮されている場合に役立ちます。例えば.gzファイルの場合に'zcat'を使用することができます。 + +デフォルト値: 'cat' + +## リソース型 + +### mysql_plugin + +MySQLプラグインを管理します。 + +#### 例 + +##### + +```puppet +mysql_plugin { 'some_plugin': + soname => 'some_pluginlib.so', +} +``` + +#### プロパティ + +`mysql_plugin`タイプでは、以下のプロパティを使用できます。 + +##### `ensure` + +デフォルト値: present、absent + +リソースの基本的なプロパティ。 + +デフォルト値: present + +##### `soname` + +有効な値: %r{^\w+\.\w+$} + +ライブラリの名前 + +#### パラメータ + +`mysql_plugin`タイプでは、以下のパラメータを使用できます。 + +##### `name` + +namevar + +管理するMySQLプラグインの名前。 + +## 関数 + +### mysql_deepmerge + +タイプ: Ruby 3.x API + +- ハッシュである重複キーが存在する場合は、再帰的に統合されます。 +- ハッシュではない重複キーが存在する場合は、最右のハッシュのキーが上位になります。 +- 2つのキーの間でダッシュとアンダースコアの使用に競合がある場合(競合がない場合は、mysqlはこれらを同一のものとして扱います)、 + 最右のスタイルが上位になります。 + +#### `mysql_deepmerge()` + +- ハッシュである重複キーが存在する場合は、再帰的に統合されます。 +- ハッシュではない重複キーが存在する場合は、最右のハッシュのキーが上位になります。 +- 2つのキーの間でダッシュとアンダースコアの使用に競合がある場合(競合がない場合は、mysqlはこれらを同一のものとして扱います)、 + 最右のスタイルが上位になります。 + +結果: `Hash` + +### mysql_dirname + +タイプ: Ruby 3.x API + +パスのdirnameを返します + +#### `mysql_dirname(String $path)` + +結果: `String` パスのディレクトリ名。 + +##### `path` + +データタイプ: `String` + +dirnameを検索するパス。 + +### mysql_password + +タイプ: Ruby 3.x API + +mysqlの"PASSWORD()"関数のように、文字列にハッシュをかけます + +#### `mysql_password(String $password)` + +結果: `String` 平文のパスワードから返されたmysqlパスワードハッシュ。 + +##### `password` + +データタイプ: `String` + +平文のパスワード。 + +### mysql_strip_hash + +タイプ: Ruby 3.x API + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +ハッシュが指定されると、この関数はすべての空白エントリを取り除きます。 + +#### `mysql_strip_hash()` + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +ハッシュが指定されると、この関数はすべての空白エントリを取り除きます。 + +結果: `Any` + +## タスク + +### export + +ローカルファイルにデータベースのバックアップを作成できます。 + +**Supports noop?** false + +#### パラメータ + +##### `database` + +データタイプ: `Optional[String[1]]` + +接続先のデータベース + +##### `user` + +データタイプ: `Optional[String[1]]` + +ユーザ + +##### `password` + +データタイプ: `Optional[String[1]]` + +パスワード + +##### `file` + +データタイプ: `String[1]` + +バックアップ先のファイルのパス + +### sql + +任意のSQLを実行できます + +**Supports noop?** false + +#### パラメータ + +##### `database` + +データタイプ: `Optional[String[1]]` + +接続先のデータベース + +##### `user` + +データタイプ: `Optional[String[1]]` + +ユーザ + +##### `password` + +データタイプ: `Optional[String[1]]` + +パスワード + +##### `sql` + +データタイプ: `String[1]` + +実行するSQL + diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb index e3cef352a..23bbcbcc6 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper_acceptance' require 'beaker/i18n_helper' -describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && puppet_version =~ %r{(^4\.10\.[56789]|5\.\d\.\d)} do +describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5')) do before :all do hosts.each do |host| on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb") @@ -10,6 +10,14 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami end context 'when triggering puppet simple string error' do + # 'service_enabled' being set to false can cause random failures in Debian 9 + let(:os_variant) do + if fact('operatingsystem') =~ %r{Debian} && fact('operatingsystemrelease') =~ %r{^9\.} + 'true' + else + 'false' + end + end let(:pp) do <<-MANIFEST class { 'mysql::server': @@ -24,13 +32,13 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami root_group => 'root', root_password => 'test', old_root_password => 'kittensnmittens', - service_enabled => 'false' + service_enabled => '#{os_variant}', } MANIFEST end it 'displays Japanese error' do - apply_manifest(pp, catch_error: true) do |r| + execute_manifest(pp, catch_error: true) do |r| expect(r.stderr).to match(%r{`old_root_password`属性は廃止予定であり、今後のリリースで廃止されます。}i) end end @@ -53,7 +61,7 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami end it 'displays Japanese failure' do - apply_manifest(pp, catch_failures: true) do |r| + execute_manifest(pp, catch_failures: true) do |r| expect(r.stderr).to match(%r{'prescript'オプションは、現在、mysqldumpバックアッププロバイダ向けには実装されていません。}i) end end @@ -63,7 +71,7 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami let(:pp) do <<-MANIFEST mysql::db { 'mydb': - user => 'thisisalongusernametestfortodayandtomorrowandthenextday', + user => 'thisisalongusernametestfortodayandtomorrowandthenextdayandthedayafteeeeeeerrrrrrrrrrrrrrr', password => 'mypass', host => 'localhost', grant => ['SELECT', 'UPDATE'], @@ -72,7 +80,7 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami end it 'displays Japanese failure' do - apply_manifest(pp, expect_failures: true) do |r| + execute_manifest(pp, expect_failures: true) do |r| expect(r.stderr).to match(%r{MySQLユーザ名は最大\d{2}文字に制限されています。}i) end end @@ -88,7 +96,7 @@ describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfami end it 'displays Japanese error' do - apply_manifest(pp, expect_failures: true) do |r| + execute_manifest(pp, expect_failures: true) do |r| expect(r.stderr).to match(%r{無効なデータベースのユーザ"name@localhost}i) end end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb index b0fecb0ca..18e1ade87 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb @@ -29,8 +29,8 @@ describe 'mysql::server::backup class' do } MANIFEST it 'when configuring mysql backups' do - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end end @@ -104,8 +104,8 @@ describe 'mysql::server::backup class' do } MANIFEST it 'when configuring mysql backups' do - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end end @@ -124,7 +124,7 @@ describe 'mysql::server::backup class' do it 'creates one file per database' do unless version_is_greater_than('5.7.0') - %w[backup1 backup2].each do |database| + ['backup1', 'backup2'].each do |database| shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| expect(r.stdout).to match(%r{1}) expect(r.exit_code).to be_zero @@ -142,7 +142,7 @@ describe 'mysql::server::backup class' do it 'has one file per database per run' do unless version_is_greater_than('5.7.0') - %w[backup1 backup2].each do |database| + ['backup1', 'backup2'].each do |database| shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| expect(r.stdout).to match(%r{2}) expect(r.exit_code).to be_zero @@ -187,7 +187,7 @@ describe 'mysql::server::backup class' do } MANIFEST it 'when configuring mysql backups with triggers and routines' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'runs mysqlbackup.sh with no errors' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb index e041d20bc..6da16ca5b 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb @@ -1,5 +1,5 @@ def pre_run - apply_manifest("class { 'mysql::server': root_password => 'password' }", catch_failures: true) + execute_manifest("class { 'mysql::server': root_password => 'password' }", catch_failures: true) @mysql_version = (on default, 'mysql --version').output.chomp.match(%r{\d+\.\d+\.\d+})[0] end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb index 3b9b8204c..6d4fdde24 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper_acceptance' describe 'mysql class' do - # rubocop:disable RSpec/InstanceVariable describe 'advanced config' do let(:pp) do <<-MANIFEST @@ -51,10 +50,18 @@ describe 'mysql class' do before(:all) do @tmpdir = default.tmpdir('mysql') end + # 'manage_config_file'/'service_enabled' being set to false can cause random failures in Debian 9 + let(:os_variant) do + if fact('operatingsystem') =~ %r{Debian} && fact('operatingsystemrelease') =~ %r{^9\.} + 'true' + else + 'false' + end + end let(:pp) do <<-MANIFEST class { 'mysql::server': - manage_config_file => 'false', + manage_config_file => '#{os_variant}', override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }}, package_ensure => 'present', purge_conf_dir => 'false', @@ -62,7 +69,7 @@ describe 'mysql class' do restart => 'false', root_group => 'root', root_password => 'test', - service_enabled => 'false', + service_enabled => '#{os_variant}', service_manage => 'false', users => {}, grants => {}, @@ -73,7 +80,6 @@ describe 'mysql class' do it_behaves_like 'a idempotent resource' end - # rubocop:enable RSpec/InstanceVariable describe 'syslog configuration' do let(:pp) do @@ -92,7 +98,7 @@ describe 'mysql class' do let(:pp) { "class { 'mysql::server': root_password => '#{password}' }" } it 'does not display the password' do - result = apply_manifest(pp, catch_failures: true) + result = execute_manifest(pp, catch_failures: true) # this does not actually prove anything, as show_diff in the puppet config defaults to false. expect(result.stdout).not_to match %r{#{password}} end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb index 1ebed9c9e..781b2e478 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb @@ -12,7 +12,7 @@ describe 'mysql tasks', if: puppet_version =~ %r{(5\.\d\.\d)} && fact('operating MANIFEST it 'sets up a mysql instance' do - apply_manifest_on(hosts, pp, catch_failures: true) + execute_manifest_on(hosts, pp, catch_failures: true) end it 'execute arbitary sql' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb index fc207a6b5..1faad0995 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb @@ -6,7 +6,7 @@ describe 'mysql_database' do class { 'mysql::server': } MANIFEST it 'works with no errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end end @@ -17,7 +17,7 @@ describe 'mysql_database' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the database #stdout' do @@ -44,8 +44,8 @@ describe 'mysql_database' do } MANIFEST it 'creates two db of different types idempotently' do - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + execute_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_changes: true) end it 'finds latin1 db #stdout' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb index 981dd85a2..983757b18 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb @@ -10,7 +10,7 @@ describe 'mysql_grant' do } MANIFEST - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end describe 'missing privileges for user' do @@ -26,7 +26,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter` is required}) + expect(execute_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter` is required}) end it 'does not find the user' do @@ -47,7 +47,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - apply_manifest(pp, expect_failures: true) + execute_manifest(pp, expect_failures: true) end it 'does not find the user' do @@ -69,7 +69,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -98,7 +98,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -128,7 +128,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -157,7 +157,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `parameter` is required.}) + expect(execute_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `parameter` is required.}) end end @@ -176,7 +176,7 @@ describe 'mysql_grant' do } MANIFEST it 'onlies try to apply ALL' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -246,7 +246,7 @@ describe 'mysql_grant' do } MANIFEST it 'applies' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds short hostname #stdout' do @@ -383,8 +383,8 @@ describe 'mysql_grant' do } MANIFEST it 'setup mysql::server' do - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + execute_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_changes: true) end end @@ -401,7 +401,7 @@ describe 'mysql_grant' do } MANIFEST it 'create ALL privs' do - apply_manifest(pp_one, catch_failures: true) + execute_manifest(pp_one, catch_failures: true) end pp_two = <<-MANIFEST @@ -416,7 +416,7 @@ describe 'mysql_grant' do } MANIFEST it 'create lowercase all privs' do - expect(apply_manifest(pp_two, catch_failures: true).exit_code).to eq(0) + expect(execute_manifest(pp_two, catch_failures: true).exit_code).to eq(0) end end @@ -439,7 +439,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -475,7 +475,7 @@ describe 'mysql_grant' do } EOS - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end # rubocop:enable RSpec/ExampleLength it 'finds the user' do @@ -504,7 +504,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors when version greater than 5.5.0' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -533,7 +533,7 @@ describe 'mysql_grant' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the user #stdout' do @@ -562,7 +562,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter`: PROXY can only be specified by itself}) + expect(execute_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter`: PROXY can only be specified by itself}) end it 'does not find the user' do @@ -584,7 +584,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{PROXY user not supported on mysql versions < 5\.5\.0}i) + expect(execute_manifest(pp, expect_failures: true).stderr).to match(%r{PROXY user not supported on mysql versions < 5\.5\.0}i) end it 'does not find the user' do @@ -606,7 +606,7 @@ describe 'mysql_grant' do } MANIFEST it 'fails' do - expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `property` for PROXY should be specified as proxy_user@proxy_host.}) + expect(execute_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `property` for PROXY should be specified as proxy_user@proxy_host.}) end it 'does not find the user' do @@ -625,7 +625,7 @@ describe 'mysql_grant' do } MANIFEST it 'setup mysql::server' do - apply_manifest(pp_one, catch_failures: true) + execute_manifest(pp_one, catch_failures: true) end pp_two = <<-MANIFEST @@ -651,7 +651,7 @@ describe 'mysql_grant' do } MANIFEST it 'applies' do - apply_manifest(pp_two, catch_failures: true) + execute_manifest(pp_two, catch_failures: true) end it 'fails with fqdn' do @@ -687,7 +687,7 @@ describe 'mysql_grant' do it 'fails to execute while applying' do mysql_cmd = shell('which mysql').stdout.chomp shell("mv #{mysql_cmd} #{mysql_cmd}.bak") - expect(apply_manifest(pp_three, expect_failures: true).stderr).to match(%r{Could not find a suitable provider for mysql_grant}) + expect(execute_manifest(pp_three, expect_failures: true).stderr).to match(%r{Could not find a suitable provider for mysql_grant}) shell("mv #{mysql_cmd}.bak #{mysql_cmd}") end @@ -697,7 +697,7 @@ describe 'mysql_grant' do } MANIFEST it 'reset mysql::server config' do - apply_manifest(pp_four, catch_failures: true) + execute_manifest(pp_four, catch_failures: true) end end @@ -707,7 +707,7 @@ describe 'mysql_grant' do class { 'mysql::server': override_options => { 'root_password' => 'password' } } MANIFEST it 'setup mysql server' do - apply_manifest(pp_one, catch_failures: true) + execute_manifest(pp_one, catch_failures: true) end pp_two = <<-MANIFEST @@ -722,7 +722,7 @@ describe 'mysql_grant' do } MANIFEST it 'creates grant on missing table will fail' do - expect(apply_manifest(pp_two, expect_failures: true).stderr).to match(%r{Table 'grant_spec_db\.grant_spec_table' doesn't exist}) + expect(execute_manifest(pp_two, expect_failures: true).stderr).to match(%r{Table 'grant_spec_db\.grant_spec_table' doesn't exist}) end pp_three = <<-MANIFEST @@ -738,7 +738,7 @@ describe 'mysql_grant' do } MANIFEST it 'creates table' do - apply_manifest(pp_three, catch_failures: true) + execute_manifest(pp_three, catch_failures: true) end it 'has the table' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb index 463523a8e..327e02299 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb @@ -15,19 +15,8 @@ if fact('osfamily') =~ %r{RedHat} plugin_lib = 'auth_pam.so' end elsif fact('osfamily') =~ %r{Debian} - if fact('operatingsystem') =~ %r{Debian} - if fact('operatingsystemrelease') =~ %r{^6\.} - # Only available plugin is innodb which is already loaded and not unload- or reload-able - plugin = nil - elsif fact('operatingsystemrelease') =~ %r{^7\.} - plugin = 'example' - plugin_lib = 'ha_example.so' - end - elsif fact('operatingsystem') =~ %r{Ubuntu} - if fact('operatingsystemrelease') =~ %r{^10\.04} - # Only available plugin is innodb which is already loaded and not unload- or reload-able - plugin = nil - elsif fact('operatingsystemrelease') =~ %r{^16\.04} + if fact('operatingsystem') =~ %r{Ubuntu} + if fact('operatingsystemrelease') =~ %r{^16\.04|^18\.04} # On Xenial running 5.7.12, the example plugin does not appear to be available. plugin = 'validate_password' plugin_lib = 'validate_password.so' @@ -48,7 +37,7 @@ describe 'mysql_plugin' do class { 'mysql::server': } MANIFEST - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end end @@ -60,7 +49,7 @@ describe 'mysql_plugin' do } MANIFEST it 'works without errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'finds the plugin #stdout' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb index 507fcf881..58c33772e 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb @@ -7,7 +7,7 @@ describe 'mysql_user' do class { 'mysql::server': } MANIFEST it 'works with no errors' do - apply_manifest(pp_one, catch_failures: true) + execute_manifest(pp_one, catch_failures: true) end end @@ -19,7 +19,7 @@ describe 'mysql_user' do } MANIFEST it 'works without errors' do - apply_manifest(pp_two, catch_failures: true) + execute_manifest(pp_two, catch_failures: true) end it 'finds the user #stdout' do @@ -54,7 +54,7 @@ describe 'mysql_user' do } EOS - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'has the correct plugin' do @@ -88,7 +88,7 @@ describe 'mysql_user' do } MANIFEST it 'works without errors' do - apply_manifest(pp_three, catch_failures: true) + execute_manifest(pp_three, catch_failures: true) end it 'finds the user #stdout' do @@ -112,7 +112,7 @@ describe 'mysql_user' do } MANIFEST it 'works without errors' do - apply_manifest(pp_four, catch_failures: true) + execute_manifest(pp_four, catch_failures: true) end it 'finds the user #stdout' do @@ -150,7 +150,7 @@ describe 'mysql_user' do } MANIFEST it 'works without errors' do - apply_manifest(pp_five, catch_failures: true) + execute_manifest(pp_five, catch_failures: true) end it 'finds the user #stdout' do @@ -185,7 +185,7 @@ describe 'mysql_user' do } MANIFEST it 'works without errors' do - apply_manifest(pp_six, catch_failures: true) + execute_manifest(pp_six, catch_failures: true) end it 'finds the user #stdout' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb index 63ec2e32d..ddc8c7827 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb @@ -17,7 +17,7 @@ describe 'mysql::server' do end describe 'array entry' do - let(:params) { { override_options: { 'mysqld' => { 'replicate-do-db' => %w[base1 base2] } } } } + let(:params) { { override_options: { 'mysqld' => { 'replicate-do-db' => ['base1', 'base2'] } } } } it do is_expected.to contain_file('mysql-config-file').with_content( diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb index dba8672b1..1c2283bfa 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe 'mysql::bindings' do on_supported_os.each do |os, facts| + next if facts[:osfamily] == 'Archlinux' context "on #{os}" do let(:facts) do facts.merge(root_home: '/root') diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb index 6c651dcae..83eec9d72 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe 'mysql::client' do on_supported_os.each do |os, facts| + next if facts[:osfamily] == 'Archlinux' context "on #{os}" do let(:facts) do facts.merge(root_home: '/root') diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb index 3a64ac3c8..1a79ad789 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb @@ -27,7 +27,7 @@ describe 'mysql::server::monitor' do it { is_expected.to contain_mysql_grant('monitoruser@monitorhost/*.*').with( ensure: 'present', user: 'monitoruser@monitorhost', - table: '*.*', privileges: %w[PROCESS SUPER], + table: '*.*', privileges: ['PROCESS', 'SUPER'], require: 'Mysql_user[monitoruser@monitorhost]' ) } diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb index 07d4917a0..209f40f4f 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb @@ -205,7 +205,7 @@ describe 'mysql::server' do 'foo@localhost/somedb.*' => { 'user' => 'foo@localhost', 'table' => 'somedb.*', - 'privileges' => %w[SELECT UPDATE], + 'privileges' => ['SELECT', 'UPDATE'], 'options' => ['GRANT'], }, 'foo2@localhost/*.*' => { @@ -219,7 +219,7 @@ describe 'mysql::server' do it { is_expected.to contain_mysql_grant('foo@localhost/somedb.*').with( user: 'foo@localhost', table: 'somedb.*', - privileges: %w[SELECT UPDATE], options: ['GRANT'] + privileges: ['SELECT', 'UPDATE'], options: ['GRANT'] ) } it { diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml index 3248be5aa..e10d991db 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml @@ -2,7 +2,7 @@ # # Facts specified here will override the values provided by rspec-puppet-facts. --- -concat_basedir: "/tmp" +concat_basedir: "" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb index ab2550867..4b9ce7cdd 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb @@ -47,7 +47,7 @@ describe 'mysql::db', type: :define do end it 'imports sql scripts when more than one is specified' do - params['sql'] = %w[test_sql test_2_sql] + params['sql'] = ['test_sql', 'test_2_sql'] is_expected.to contain_exec('test_db-import').with_command('cat test_sql test_2_sql | mysql test_db') end @@ -70,6 +70,16 @@ describe 'mysql::db', type: :define do params['dbname'] = 'real_db' is_expected.to contain_mysql_database('real_db') end + + it 'uses tls_options for user when set' do + params['tls_options'] = ['SSL'] + is_expected.to contain_mysql_user('testuser@localhost').with_tls_options(['SSL']) + end + + it 'uses grant_options for grant when set' do + params['grant_options'] = ['GRANT'] + is_expected.to contain_mysql_grant('testuser@localhost/test_db.*').with_options(['GRANT']) + end end end end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_deepmerge_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_deepmerge_spec.rb new file mode 100644 index 000000000..e5e9a66ef --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_deepmerge_spec.rb @@ -0,0 +1,94 @@ +#! /usr/bin/env ruby -S rspec # rubocop:disable Lint/ScriptPermission + +require 'spec_helper' + +describe 'mysql::deepmerge' do + it 'exists' do + is_expected.not_to eq(nil) + end + + it 'throws error with no arguments' do + is_expected.to run.with_params.and_raise_error(Puppet::ParseError) + end + + it 'throws error with only one argument' do + is_expected.to run.with_params('one' => 1).and_raise_error(Puppet::ParseError) + end + + it 'accepts empty strings as puppet undef' do + is_expected.to run.with_params({}, '') + end + + # rubocop:disable RSpec/NamedSubject + index_values = ['one', 'two', 'three'] + expected_values_one = ['1', '2', '2'] + it 'is able to mysql_deepmerge two hashes' do + new_hash = subject.execute({ 'one' => '1', 'two' => '1' }, 'two' => '2', 'three' => '2') + index_values.each_with_index do |index, expected| + expect(new_hash[index]).to eq(expected_values_one[expected]) + end + end + + it 'mysql_deepmerges multiple hashes' do + hash = subject.execute({ 'one' => 1 }, { 'one' => '2' }, 'one' => '3') + expect(hash['one']).to eq('3') + end + + it 'accepts empty hashes' do + is_expected.to run.with_params({}, {}, {}).and_return({}) + end + + expected_values_two = [1, 2, 'four' => 4] + it 'mysql_deepmerges subhashes' do + hash = subject.execute({ 'one' => 1 }, 'two' => 2, 'three' => { 'four' => 4 }) + index_values.each_with_index do |index, expected| + expect(hash[index]).to eq(expected_values_two[expected]) + end + end + + it 'appends to subhashes' do + hash = subject.execute({ 'one' => { 'two' => 2 } }, 'one' => { 'three' => 3 }) + expect(hash['one']).to eq('two' => 2, 'three' => 3) + end + + expected_values_three = [1, 'dos', { 'four' => 4, 'five' => 5 }] + it 'appends to subhashes 2' do + hash = subject.execute({ 'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }, 'two' => 'dos', 'three' => { 'five' => 5 }) + index_values.each_with_index do |index, expected| + expect(hash[index]).to eq(expected_values_three[expected]) + end + end + + index_values_two = ['key1', 'key2'] + expected_values_four = [{ 'a' => 1, 'b' => 99 }, 'c' => 3] + it 'appends to subhashes 3' do + hash = subject.execute({ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, 'key1' => { 'b' => 99 }) + index_values_two.each_with_index do |index, expected| + expect(hash[index]).to eq(expected_values_four[expected]) + end + end + + it 'equates keys mod dash and underscore #value' do + hash = subject.execute({ 'a-b-c' => 1 }, 'a_b_c' => 10) + expect(hash['a_b_c']).to eq(10) + end + it 'equates keys mod dash and underscore #not' do + hash = subject.execute({ 'a-b-c' => 1 }, 'a_b_c' => 10) + expect(hash).not_to have_key('a-b-c') + end + + index_values_three = ['a_b_c', 'b-c-d'] + expected_values_five = [10, { 'e-f-g' => 3, 'c_d_e' => 12 }] + index_values_error = ['a-b-c', 'b_c_d'] + index_values_three.each_with_index do |index, expected| + it 'keeps style of the last when keys are equal mod dash and underscore #value' do + hash = subject.execute({ 'a-b-c' => 1, 'b_c_d' => { 'c-d-e' => 2, 'e-f-g' => 3 } }, 'a_b_c' => 10, 'b-c-d' => { 'c_d_e' => 12 }) + expect(hash[index]).to eq(expected_values_five[expected]) + end + it 'keeps style of the last when keys are equal mod dash and underscore #not' do + hash = subject.execute({ 'a-b-c' => 1, 'b_c_d' => { 'c-d-e' => 2, 'e-f-g' => 3 } }, 'a_b_c' => 10, 'b-c-d' => { 'c_d_e' => 12 }) + expect(hash).not_to have_key(index_values_error[expected]) + end + end + # rubocop:enable RSpec/NamedSubject +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_dirname_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_dirname_spec.rb new file mode 100644 index 000000000..3e407ec0c --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_dirname_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe 'mysql::dirname' do + it 'exists' do + is_expected.not_to eq(nil) + end + + it 'raises a ArgumentError if there is less than 1 arguments' do + is_expected.to run.with_params.and_raise_error(ArgumentError) + end + + it 'raises a ArgumentError if there is more than 1 arguments' do + is_expected.to run.with_params('foo', 'bar').and_raise_error(ArgumentError) + end + + it 'returns path of file' do + is_expected.to run.with_params('spec/functions/mysql_dirname_spec.rb').and_return('spec/functions') + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_password_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_password_spec.rb new file mode 100644 index 000000000..8ca4fb859 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_password_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'mysql::password' do + it 'exists' do + is_expected.not_to eq(nil) + end + + it 'raises a ArgumentError if there is less than 1 arguments' do + is_expected.to run.with_params.and_raise_error(ArgumentError) + end + + it 'raises a ArgumentError if there is more than 1 arguments' do + is_expected.to run.with_params('foo', 'bar').and_raise_error(ArgumentError) + end + + it 'converts password into a hash' do + is_expected.to run.with_params('password').and_return('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19') + end + + it 'converts an empty password into a empty string' do + is_expected.to run.with_params('').and_return('') + end + + it 'does not convert a password that is already a hash' do + is_expected.to run.with_params('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19').and_return('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19') + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_strip_hash_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_strip_hash_spec.rb new file mode 100644 index 000000000..be6704653 --- /dev/null +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/functions/mysql_strip_hash_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'mysql::strip_hash' do + it 'exists' do + is_expected.not_to eq(nil) + end + + it 'raises a ArgumentError if there is less than 1 arguments' do + is_expected.to run.with_params.and_raise_error(ArgumentError) + end + + it 'raises a ArgumentError if there is more than 1 arguments' do + is_expected.to run.with_params({ 'foo' => 1 }, 'bar' => 2).and_raise_error(ArgumentError) + end + + it 'raises a ArgumentError if argument is not a hash' do + is_expected.to run.with_params('foo').and_raise_error(ArgumentError) + end + + it 'passes a hash without blanks through' do + is_expected.to run.with_params('one' => 1, 'two' => 2, 'three' => 3).and_return('one' => 1, 'two' => 2, 'three' => 3) + end + + it 'removes blank hash elements' do + is_expected.to run.with_params('one' => 1, 'two' => '', 'three' => nil, 'four' => 4).and_return('one' => 1, 'three' => nil, 'four' => 4) + end +end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb index c20a31773..84de0e8d6 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb @@ -1,5 +1,12 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' + +begin + require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) +rescue LoadError => loaderror + warn "Could not require spec_helper_local: #{loaderror.message}" +end + include RspecPuppetFacts default_facts = { @@ -20,5 +27,19 @@ end RSpec.configure do |c| c.default_facts = default_facts + c.before :each do + # set to strictest setting for testing + # by default Puppet runs at warning level + Puppet.settings[:strict] = :warning + end end + +def ensure_module_defined(module_name) + module_name.split('::').reduce(Object) do |last_module, next_module| + last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module) + last_module.const_get(next_module) + end +end + +# 'spec_overrides' from sync.yml will appear below this line require 'spec_helper_local' diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb index be0f74b48..d1fb56c7b 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb @@ -1,11 +1,16 @@ +require 'beaker-pe' +require 'beaker-puppet' require 'puppet' require 'beaker-rspec' require 'beaker/puppet_install_helper' require 'beaker/module_install_helper' require 'beaker/i18n_helper' -require 'beaker/task_helper' +require 'beaker-task_helper' +require 'beaker/testmode_switcher' +require 'beaker/testmode_switcher/dsl' run_puppet_install_helper +configure_type_defaults_on(hosts) install_ca_certs unless pe_install? install_bolt_on(hosts) unless pe_install? install_module_on(hosts) @@ -23,10 +28,12 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do - run_puppet_access_login(user: 'admin') if pe_install? && puppet_version =~ %r{(5\.\d\.\d)} + run_puppet_access_login(user: 'admin') if pe_install? && (Gem::Version.new(puppet_version) >= Gem::Version.new('5.0.0')) hosts.each do |host| # This will be removed, this is temporary to test localisation. - if (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (puppet_version >= '4.10.5' && puppet_version < '5.2.0') + if (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && + (Gem::Version.new(puppet_version) >= Gem::Version.new('4.10.5') && + Gem::Version.new(puppet_version) < Gem::Version.new('5.2.0')) on(host, 'mkdir /opt/puppetlabs/puppet/share/locale/ja') on(host, 'touch /opt/puppetlabs/puppet/share/locale/ja/puppet.po') end @@ -48,10 +55,10 @@ end shared_examples 'a idempotent resource' do it 'applies with no errors' do - apply_manifest(pp, catch_failures: true) + execute_manifest(pp, catch_failures: true) end it 'applies a second time without changes', :skip_pup_5016 do - apply_manifest(pp, catch_changes: true) + execute_manifest(pp, catch_changes: true) end end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb index e2c01ea13..e30159e54 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb @@ -8,7 +8,7 @@ describe Facter::Util::Fact.to_s do describe 'mysqld_version' do context 'with value' do before :each do - Facter::Util::Resolution.stubs(:exec).with('mysqld -V 2>/dev/null').returns('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona Server (GPL), Release 37.9, Revision efa0073)') + Facter::Util::Resolution.stubs(:exec).with('mysqld --no-defaults -V 2>/dev/null').returns('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona Server (GPL), Release 37.9, Revision efa0073)') end it { expect(Facter.fact(:mysqld_version).value).to eq('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona Server (GPL), Release 37.9, Revision efa0073)') diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb index c2ad8895d..0d86b9628 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb @@ -28,8 +28,8 @@ describe Puppet::Parser::Functions.function(:mysql_deepmerge) do expect { scope.function_mysql_deepmerge([{}, '']) }.not_to raise_error end - index_values = %w[one two three] - expected_values_one = %w[1 2 2] + index_values = ['one', 'two', 'three'] + expected_values_one = ['1', '2', '2'] it 'is able to mysql_deepmerge two hashes' do new_hash = scope.function_mysql_deepmerge([{ 'one' => '1', 'two' => '1' }, { 'two' => '2', 'three' => '2' }]) index_values.each_with_index do |index, expected| @@ -67,7 +67,7 @@ describe Puppet::Parser::Functions.function(:mysql_deepmerge) do end end - index_values_two = %w[key1 key2] + index_values_two = ['key1', 'key2'] expected_values_four = [{ 'a' => 1, 'b' => 99 }, 'c' => 3] it 'appends to subhashes 3' do hash = scope.function_mysql_deepmerge([{ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, { 'key1' => { 'b' => 99 } }]) diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb index b1794f8b1..85c4d44a2 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb @@ -16,11 +16,11 @@ describe 'the mysql_password function' do end it 'raises a ParseError if there is more than 1 arguments' do - expect { scope.function_mysql_password(%w[foo bar]) }.to(raise_error(Puppet::ParseError)) + expect { scope.function_mysql_password(['foo', 'bar']) }.to(raise_error(Puppet::ParseError)) end it 'converts password into a hash' do - result = scope.function_mysql_password(%w[password]) + result = scope.function_mysql_password(['password']) expect(result).to(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19')) end diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb index ffa624444..4e29f33af 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Puppet::Type.type(:mysql_database).provider(:mysql) do let(:defaults_file) { '--defaults-extra-file=/root/.my.cnf' } - let(:parsed_databases) { %w[information_schema mydb mysql performance_schema test] } + let(:parsed_databases) { ['information_schema', 'mydb', 'mysql', 'performance_schema', 'test'] } let(:provider) { resource.provider } let(:instance) { provider.class.instances.first } let(:resource) do @@ -13,7 +13,6 @@ describe Puppet::Type.type(:mysql_database).provider(:mysql) do ) end let(:raw_databases) do - # rubocop:disable Layout/IndentHeredoc <<-SQL_OUTPUT information_schema mydb diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb index 84d7b63b3..a6049cbf7 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb @@ -52,7 +52,6 @@ describe Puppet::Type.type(:mysql_user).provider(:mysql) do let(:newhash) { '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5' } let(:raw_users) do - # rubocop:disable Layout/IndentHeredoc <<-SQL_OUTPUT root@127.0.0.1 root@::1 @@ -65,7 +64,7 @@ usvn_user@localhost # rubocop:enable Layout/IndentHeredoc end - let(:parsed_users) { %w[root@127.0.0.1 root@::1 @localhost debian-sys-maint@localhost root@localhost usvn_user@localhost @vagrant-ubuntu-raring-64] } + let(:parsed_users) { ['root@127.0.0.1', 'root@::1', '@localhost', 'debian-sys-maint@localhost', 'root@localhost', 'usvn_user@localhost', '@vagrant-ubuntu-raring-64'] } let(:provider) { resource.provider } let(:instance) { provider.class.instances.first } let(:resource) do @@ -183,6 +182,12 @@ usvn_user@localhost provider.expects(:exists?).returns(false) expect(provider.destroy).to be_truthy end + it 'removes a user using IF EXISTS' do + provider.class.instance_variable_set(:@mysqld_version_string, '5.7.1') + + provider.class.expects(:mysql_caller).with("DROP USER IF EXISTS 'joe'@'localhost'", 'system') + expect(provider.destroy).to be_truthy + end end describe 'exists?' do @@ -362,9 +367,7 @@ usvn_user@localhost end end - %w[max_user_connections max_connections_per_hour max_queries_per_hour - max_updates_per_hour].each do |property| - + ['max_user_connections', 'max_connections_per_hour', 'max_queries_per_hour', 'max_updates_per_hour'].each do |property| describe property do it "returns #{property}" do expect(instance.send(property.to_s.to_sym)).to eq('10') diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb index 793f1a029..acf47a2dd 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb @@ -86,9 +86,9 @@ describe Puppet::Type.type(:mysql_grant) do it 'to upcase and ordered' do user = Puppet::Type.type(:mysql_grant).new( name: 'foo@localhost/*.*', table: ['*.*'], user: 'foo@localhost', - privileges: %w[select Insert] + privileges: ['select', 'Insert'] ) - expect(user[:privileges]).to eq(%w[INSERT SELECT]) + expect(user[:privileges]).to eq(['INSERT', 'SELECT']) end it 'ordered including column privileges' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb index 0c900b0c7..c491d8cf9 100644 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb @@ -43,6 +43,11 @@ describe Puppet::Type.type(:mysql_user) do user[:password_hash] = 'foo' expect(user[:password_hash]).to eq('foo') end + + it 'accepts an empty password' do + user[:password_hash] = '' + expect(user[:password_hash]).to eq('') + end end context 'using foo@LocalHost' do diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb index 9a9df12d1..0e2adafc7 100755 --- a/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb +++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb @@ -28,6 +28,11 @@ echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACK echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE <%- end -%> +<% if @prescript -%> +<%- [@prescript].flatten.compact.each do |script|%> +<%= script %> +<%- end -%> +<% end -%> # Ensure backup directory exist. mkdir -p $DIR @@ -54,6 +59,12 @@ ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --skip-routines" <% end -%> <% end -%> +<%- if @optional_args and @optional_args.is_a?(Array) -%> +<%- @optional_args.each do |arg| -%> +ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS <%= arg %>" +<%- end -%> +<%- end -%> + ##### STOP CONFIG #################################################### PATH=<%= @execpath %> diff --git a/modules/vulnerabilities/unix/webapp/onlinestore/secgen_metadata.xml b/modules/vulnerabilities/unix/webapp/onlinestore/secgen_metadata.xml index 4e5929412..cad0e5754 100644 --- a/modules/vulnerabilities/unix/webapp/onlinestore/secgen_metadata.xml +++ b/modules/vulnerabilities/unix/webapp/onlinestore/secgen_metadata.xml @@ -144,7 +144,7 @@ - .*/mysql_wheezy.* + .*/mysql.* diff --git a/scenarios/test_scenario.xml b/scenarios/test_scenario.xml index f10d41d6d..2508d486b 100644 --- a/scenarios/test_scenario.xml +++ b/scenarios/test_scenario.xml @@ -7,9 +7,11 @@ userspice - + - + + +