mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
Stretch update merge: mysql & php for stretch, module conflicts and general cleanup
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
<xs:enumeration value="root_r"/>
|
||||
<xs:enumeration value="root_rw"/>
|
||||
<xs:enumeration value="root_rwx"/>
|
||||
<xs:enumeration value="various"/>
|
||||
<xs:enumeration value="none"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
@@ -137,7 +137,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
<% end %>
|
||||
<% else -%>
|
||||
<% if (@options.has_key? :ovirtuser) && (@options.has_key? :ovirtpass) %>
|
||||
<% if @ovirt_template and @ovirt_template.include? 'kali_linux_msf' %>
|
||||
<% if @ovirt_template and (@ovirt_template.include? 'kali_linux_msf' or @ovirt_template.include? 'debian_server' )%>
|
||||
<%= system.name %>.vm.provision 'shell', inline: "echo \"auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet static\n\taddress <%= resolve_network(selected_module)%>\" > /etc/network/interfaces"
|
||||
<%= system.name %>.vm.provision 'shell', inline: "echo '' > /etc/environment"
|
||||
<% elsif @ovirt_template and @ovirt_template.include? 'debian_desktop_kde' %>
|
||||
|
||||
@@ -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 <dan@puppetlabs.com> - 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)*
|
||||
|
||||
@@ -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(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
|
||||
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
|
||||
|
||||
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|
|
||||
|
||||
@@ -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 <blkperl@cat.pdx.edu>
|
||||
* (#13203) Add ssl support (f7e0ea5)
|
||||
|
||||
## 2012-03-18 - Nan Liu <nan@puppetlabs.com>
|
||||
* Travis ci before script needs success exit code. (0ea463b)
|
||||
|
||||
## 2012-03-18 - Nan Liu <nan@puppetlabs.com>
|
||||
* Fix Puppet 2.6 compilation issues. (9ebbbc4)
|
||||
|
||||
## 2012-03-16 - Nan Liu <nan@puppetlabs.com>
|
||||
* Add travis.ci for testing multiple puppet versions. (33c72ef)
|
||||
|
||||
## 2012-03-15 - William Van Hevelingen <blkperl@cat.pdx.edu>
|
||||
* (#13163) Datadir should be configurable (f353fc6)
|
||||
|
||||
## 2012-03-16 - Nan Liu <nan@puppetlabs.com>
|
||||
* Document create_resources dependency. (558a59c)
|
||||
|
||||
## 2012-03-16 - Nan Liu <nan@puppetlabs.com>
|
||||
* Fix spec test issues related to error message. (eff79b5)
|
||||
|
||||
## 2012-03-16 - Nan Liu <nan@puppetlabs.com>
|
||||
* Fix mysql service on Ubuntu. (72da2c5)
|
||||
|
||||
## 2012-03-16 - Dan Bode <dan@puppetlabs.com>
|
||||
* Add more spec test coverage (55e399d)
|
||||
|
||||
## 2012-03-16 - Nan Liu <nan@puppetlabs.com>
|
||||
* (#11963) Fix spec test due to path changes. (1700349)
|
||||
|
||||
## 2012-03-07 - François Charlier <fcharlier@ploup.net>
|
||||
* Add a test to check path for 'mysqld-restart' (b14c7d1)
|
||||
|
||||
## 2012-03-07 - François Charlier <fcharlier@ploup.net>
|
||||
* Fix path for 'mysqld-restart' (1a9ae6b)
|
||||
|
||||
## 2012-03-15 - Dan Bode <dan@puppetlabs.com>
|
||||
* Add rspec-puppet tests for mysql::config (907331a)
|
||||
|
||||
## 2012-03-15 - Dan Bode <dan@puppetlabs.com>
|
||||
* Moved class dependency between sever and config to server (da62ad6)
|
||||
|
||||
## 2012-03-14 - Dan Bode <dan@puppetlabs.com>
|
||||
* Notify mysql restart from set_mysql_rootpw exec (0832a2c)
|
||||
|
||||
## 2012-03-15 - Nan Liu <nan@puppetlabs.com>
|
||||
* Add documentation related to osfamily fact. (8265d28)
|
||||
|
||||
## 2012-03-14 - Dan Bode <dan@puppetlabs.com>
|
||||
* Mention osfamily value in failure message (e472d3b)
|
||||
|
||||
## 2012-03-14 - Dan Bode <dan@puppetlabs.com>
|
||||
* Fix bug when querying for all database users (015490c)
|
||||
|
||||
## 2012-02-09 - Nan Liu <nan@puppetlabs.com>
|
||||
* Major refactor of mysql module. (b1f90fd)
|
||||
|
||||
## 2012-01-11 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Ruby and Python's MySQL libraries are named differently on different distros. (1e926b4)
|
||||
|
||||
## 2012-01-11 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Per @ghoneycutt, we should fail explicitly and explain why. (09af083)
|
||||
|
||||
## 2012-01-11 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Removing duplicate declaration (7513d03)
|
||||
|
||||
## 2012-01-10 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Use socket value from params class instead of hardcoding. (663e97c)
|
||||
|
||||
## 2012-01-10 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Instead of hardcoding the config file target, pull it from mysql::params (031a47d)
|
||||
|
||||
## 2012-01-10 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* 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 <justin.ellison@buckle.com>
|
||||
* 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 <blkperl@cat.pdx.edu>
|
||||
* Changed the README to use markdown (3b7dfeb)
|
||||
|
||||
## 2012-02-04 - Daniel Black <grooverdan@users.sourceforge.net>
|
||||
* (#12412) mysqltuner.pl update (b809e6f)
|
||||
|
||||
## 2011-11-17 - Matthias Pigulla <mp@webfactory.de>
|
||||
* (#11363) Add two missing privileges to grant: event_priv, trigger_priv (d15c9d1)
|
||||
|
||||
## 2011-12-20 - Jeff McCune <jeff@puppetlabs.com>
|
||||
* (minor) Fixup typos in Modulefile metadata (a0ed6a1)
|
||||
|
||||
## 2011-12-19 - Carl Caum <carl@carlcaum.com>
|
||||
* Only notify Exec to import sql if sql is given (0783c74)
|
||||
|
||||
## 2011-12-19 - Carl Caum <carl@carlcaum.com>
|
||||
* (#11508) Only load sql_scripts on DB creation (e3b9fd9)
|
||||
|
||||
## 2011-12-13 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Require not needed due to implicit dependencies (3058feb)
|
||||
|
||||
## 2011-12-13 - Justin Ellison <justin.ellison@buckle.com>
|
||||
* Bug #11375: puppetlabs-mysql fails on CentOS/RHEL (a557b8d)
|
||||
|
||||
## 2011-06-03 - Dan Bode <dan@puppetlabs.com> - 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
|
||||
@@ -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.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 <<EOM
|
||||
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
|
||||
Please manually add it to your .sync.yml for now, and run `pdk update`:
|
||||
---
|
||||
Gemfile:
|
||||
optional:
|
||||
':development':
|
||||
- gem: 'github_changelog_generator'
|
||||
git: 'https://github.com/skywinder/github-changelog-generator'
|
||||
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
|
||||
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
|
||||
EOM
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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|
|
||||
|
||||
|
||||
@@ -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|
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
##
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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' }
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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'],
|
||||
}
|
||||
|
||||
|
||||
@@ -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'],
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Private class
|
||||
# @summary
|
||||
# Private class for installing java language bindings.
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::bindings::java {
|
||||
|
||||
package { 'mysql-connector-java':
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Private class
|
||||
# @summary
|
||||
# Private class for installing perl language bindings.
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::bindings::perl {
|
||||
|
||||
package{ 'perl_mysql':
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Private class
|
||||
# @summary
|
||||
# Private class for installing python language bindings
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::bindings::python {
|
||||
|
||||
package { 'python-mysqldb':
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# Private class
|
||||
# @summary
|
||||
# Private class for installing ruby language bindings
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::bindings::ruby {
|
||||
|
||||
package{ 'ruby_mysql':
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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}"],
|
||||
|
||||
@@ -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': {
|
||||
|
||||
@@ -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 <| |>
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 != '.' {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# @summary
|
||||
# Private class for managing MySQL package.
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::server::install {
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# @summary
|
||||
# Builds initial databases on installation.
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::server::installdb {
|
||||
$options = $mysql::server::options
|
||||
|
||||
@@ -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'],
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# @summary
|
||||
# Private class for managing the MySQL service
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
class mysql::server::service {
|
||||
$options = $mysql::server::options
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
include '::mysql::server'
|
||||
include '::mysql::server'
|
||||
include '::mysql::client'
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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]'
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)')
|
||||
|
||||
@@ -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 } }])
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user