Skip to content

Commit f80390b

Browse files
authored
Merge pull request #1043 from hunner/release_5.2.0
(MODULES-6312) Release 5.2.0
2 parents a2dd06e + 59539cf commit f80390b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+732
-801
lines changed

.gitignore

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
#This file is generated by ModuleSync, do not edit.
2-
pkg/
3-
Gemfile.lock
4-
Gemfile.local
5-
vendor/
6-
spec/fixtures/manifests/
7-
spec/fixtures/modules/
8-
log/
9-
junit/
10-
.vagrant/
1+
# This file is generated by ModuleSync, do not edit.
2+
*.iml
3+
.*.sw[op]
4+
.DS_Store
115
.bundle/
12-
coverage/
13-
log/
146
.idea/
157
.metadata
16-
*.iml
17-
.*.sw[op]
8+
.vagrant/
189
.yardoc
1910
.yardwarns
20-
.DS_Store
11+
Gemfile.local
12+
Gemfile.lock
13+
bin/
14+
coverage/
15+
doc/
16+
junit/
17+
log/
18+
pkg/
19+
spec/fixtures/manifests/
20+
spec/fixtures/modules/
2121
tmp/
2222
vendor/
23-
doc/
2423

.rubocop_todo.yml

Lines changed: 0 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,167 +0,0 @@
1-
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2017-12-06 17:18:57 +0000 using RuboCop version 0.51.0.
4-
# The point is for the user to remove these configuration records
5-
# one by one as the offenses are removed from the code base.
6-
# Note that changes in the inspected code, or installation of new
7-
# versions of RuboCop, may require this file to be generated again.
8-
9-
# Offense count: 2
10-
# Cop supports --auto-correct.
11-
# Configuration parameters: EnforcedStyle, SupportedStyles.
12-
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
13-
Layout/IndentHeredoc:
14-
Exclude:
15-
- 'spec/unit/puppet/provider/mysql_database/mysql_spec.rb'
16-
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'
17-
18-
# Offense count: 1
19-
Lint/AmbiguousRegexpLiteral:
20-
Exclude:
21-
- 'spec/unit/puppet/type/mysql_grant_spec.rb'
22-
23-
# Offense count: 1
24-
Lint/RescueWithoutErrorClass:
25-
Exclude:
26-
- 'lib/facter/mysql_server_id.rb'
27-
28-
# Offense count: 16
29-
Lint/ReturnInVoidContext:
30-
Exclude:
31-
- 'lib/puppet/provider/mysql_database/mysql.rb'
32-
- 'lib/puppet/provider/mysql_user/mysql.rb'
33-
34-
# Offense count: 1
35-
# Cop supports --auto-correct.
36-
Lint/ScriptPermission:
37-
Exclude:
38-
- 'spec/unit/puppet/functions/mysql_deepmerge_spec.rb'
39-
40-
# Offense count: 1
41-
Lint/UselessAssignment:
42-
Exclude:
43-
- 'spec/unit/puppet/functions/mysql_deepmerge_spec.rb'
44-
45-
# Offense count: 56
46-
# Configuration parameters: Blacklist.
47-
# Blacklist: END, (?-mix:EO[A-Z]{1})
48-
Naming/HeredocDelimiterNaming:
49-
Exclude:
50-
- 'lib/puppet/parser/functions/mysql_deepmerge.rb'
51-
- 'lib/puppet/parser/functions/mysql_dirname.rb'
52-
- 'lib/puppet/parser/functions/mysql_password.rb'
53-
- 'lib/puppet/parser/functions/mysql_strip_hash.rb'
54-
- 'spec/acceptance/locales_spec.rb'
55-
- 'spec/acceptance/mysql_backup_spec.rb'
56-
- 'spec/acceptance/mysql_db_spec.rb'
57-
- 'spec/acceptance/mysql_server_spec.rb'
58-
- 'spec/acceptance/sql_task_spec.rb'
59-
- 'spec/acceptance/types/mysql_database_spec.rb'
60-
- 'spec/acceptance/types/mysql_grant_spec.rb'
61-
- 'spec/acceptance/types/mysql_plugin_spec.rb'
62-
- 'spec/acceptance/types/mysql_user_spec.rb'
63-
- 'spec/classes/mysql_server_account_security_spec.rb'
64-
- 'spec/classes/mysql_server_backup_spec.rb'
65-
66-
# Offense count: 6
67-
# Cop supports --auto-correct.
68-
# Configuration parameters: AutoCorrect.
69-
Performance/HashEachMethods:
70-
Exclude:
71-
- 'lib/puppet/parser/functions/mysql_strip_hash.rb'
72-
- 'lib/puppet/provider/mysql_database/mysql.rb'
73-
- 'lib/puppet/provider/mysql_grant/mysql.rb'
74-
- 'lib/puppet/provider/mysql_plugin/mysql.rb'
75-
- 'lib/puppet/provider/mysql_user/mysql.rb'
76-
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'
77-
78-
# Offense count: 40
79-
# Configuration parameters: Prefixes.
80-
# Prefixes: when, with, without
81-
RSpec/ContextWording:
82-
Exclude:
83-
- 'spec/acceptance/mysql_backup_spec.rb'
84-
- 'spec/acceptance/types/mysql_user_spec.rb'
85-
- 'spec/classes/graceful_failures_spec.rb'
86-
- 'spec/classes/mycnf_template_spec.rb'
87-
- 'spec/classes/mysql_server_backup_spec.rb'
88-
- 'spec/classes/mysql_server_mysqltuner_spec.rb'
89-
- 'spec/classes/mysql_server_spec.rb'
90-
- 'spec/unit/facter/mysql_server_id_spec.rb'
91-
- 'spec/unit/puppet/type/mysql_grant_spec.rb'
92-
- 'spec/unit/puppet/type/mysql_user_spec.rb'
93-
94-
# Offense count: 56
95-
# Configuration parameters: Max.
96-
RSpec/ExampleLength:
97-
Exclude:
98-
- 'spec/acceptance/mysql_backup_spec.rb'
99-
- 'spec/acceptance/types/mysql_database_spec.rb'
100-
- 'spec/acceptance/types/mysql_grant_spec.rb'
101-
- 'spec/acceptance/types/mysql_plugin_spec.rb'
102-
- 'spec/acceptance/types/mysql_user_spec.rb'
103-
- 'spec/classes/mysql_server_backup_spec.rb'
104-
- 'spec/classes/mysql_server_monitor_spec.rb'
105-
- 'spec/classes/mysql_server_spec.rb'
106-
- 'spec/unit/puppet/provider/mysql_database/mysql_spec.rb'
107-
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'
108-
- 'spec/unit/puppet/type/mysql_grant_spec.rb'
109-
110-
# Offense count: 3
111-
# Configuration parameters: CustomTransform, IgnoreMethods.
112-
RSpec/FilePath:
113-
Exclude:
114-
- 'spec/unit/facter/mysql_server_id_spec.rb'
115-
- 'spec/unit/facter/mysql_version_spec.rb'
116-
- 'spec/unit/facter/mysqld_version_spec.rb'
117-
118-
# Offense count: 41
119-
# Configuration parameters: AssignmentOnly.
120-
RSpec/InstanceVariable:
121-
Exclude:
122-
- 'spec/acceptance/mysql_server_spec.rb'
123-
- 'spec/unit/puppet/type/mysql_database_spec.rb'
124-
- 'spec/unit/puppet/type/mysql_grant_spec.rb'
125-
- 'spec/unit/puppet/type/mysql_plugin_spec.rb'
126-
- 'spec/unit/puppet/type/mysql_user_spec.rb'
127-
128-
# Offense count: 42
129-
RSpec/MultipleExpectations:
130-
Max: 4
131-
132-
# Offense count: 42
133-
# Configuration parameters: Max.
134-
RSpec/NestedGroups:
135-
Exclude:
136-
- 'spec/acceptance/mysql_backup_spec.rb'
137-
- 'spec/classes/mycnf_template_spec.rb'
138-
- 'spec/classes/mysql_server_backup_spec.rb'
139-
- 'spec/classes/mysql_server_spec.rb'
140-
141-
# Offense count: 2
142-
RSpec/RepeatedExample:
143-
Exclude:
144-
- 'spec/classes/mysql_server_account_security_spec.rb'
145-
146-
# Offense count: 3
147-
RSpec/ScatteredLet:
148-
Exclude:
149-
- 'spec/unit/puppet/provider/mysql_database/mysql_spec.rb'
150-
- 'spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb'
151-
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'
152-
153-
# Offense count: 1
154-
Style/CommentedKeyword:
155-
Exclude:
156-
- 'spec/spec_helper_acceptance.rb'
157-
158-
# Offense count: 7
159-
# Cop supports --auto-correct.
160-
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
161-
# SupportedStyles: slashes, percent_r, mixed
162-
Style/RegexpLiteral:
163-
Exclude:
164-
- 'spec/acceptance/types/mysql_grant_spec.rb'
165-
- 'spec/classes/mycnf_template_spec.rb'
166-
- 'spec/classes/mysql_server_backup_spec.rb'
167-
- 'spec/unit/puppet/type/mysql_grant_spec.rb'

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ sudo: false
44
language: ruby
55
cache: bundler
66
script: "bundle exec rake release_checks"
7-
#Inserting below due to the following issue: https://github.com/travis-ci/travis-ci/issues/3531#issuecomment-88311203
8-
before_install:
9-
- gem update bundler
107
matrix:
118
fast_finish: true
129
include:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
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/)
44
and this project adheres to [Semantic Versioning](http://semver.org).
55

6+
## Supported Release [5.2.0]
7+
8+
### Added
9+
- Compatibility for puppet-staging 3.0.0
10+
11+
### Fixed
12+
- Centralize all mysql command calls for providers
13+
- Add paths to `mysql_datadir` provider for RedHat Software Collections
14+
615
## Supported Release [5.1.0]
716
### Summary
817
This release adds Tasks to the Mysql module.
@@ -843,5 +852,6 @@ configuration variables.
843852
## 2011-06-03 - Dan Bode <dan@puppetlabs.com> - 0.0.1
844853
* initial commit
845854

855+
[5.2.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.1.0...5.2.0
846856
[5.1.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.0.0...5.1.0
847857
[5.0.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/4.0.1...5.0.0

Gemfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,19 @@ def location_for(place_or_version, fake_version = nil)
2828
end
2929

3030
# Used for gem conditionals
31-
supports_windows = false
3231
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
3332
minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
3433

34+
# The following gems are not included by default as they require DevKit on Windows.
35+
# You should probably include them in a Gemfile.local or a ~/.gemfile
36+
#gem 'pry' #this may already be included in the gemfile
37+
#gem 'pry-stack_explorer', :require => false
38+
#if RUBY_VERSION =~ /^2/
39+
# gem 'pry-byebug'
40+
#else
41+
# gem 'pry-debugger'
42+
#end
43+
3544
group :development do
3645
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
3746
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
@@ -62,7 +71,6 @@ gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
6271
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION']
6372
gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION']
6473

65-
6674
# Evaluate Gemfile.local if it exists
6775
if File.exists? "#{__FILE__}.local"
6876
eval(File.read("#{__FILE__}.local"), binding)

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Puppet Module - puppetlabs-mysql
22

3-
Copyright 2017 Puppet, Inc.
3+
Copyright 2018 Puppet, Inc.
44

55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,8 @@ Testing on other platforms has been minimal and cannot be guaranteed.
13011301

13021302
**Note:** The mysqlbackup.sh does not work and is not supported on MySQL 5.7 and greater.
13031303

1304+
Debian 9 compatibility has not been fully verified.
1305+
13041306
## Development
13051307

13061308
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.
@@ -1324,3 +1326,4 @@ This module is based on work by David Schmitt. The following contributors have c
13241326
* Chris Weyl
13251327
* Daniël van Eeden
13261328
* Jan-Otto Kröpke
1329+
* Timothy Sven Nelson

lib/puppet/provider/mysql.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Puppet::Provider::Mysql < Puppet::Provider
77
ENV['PATH'] = ENV['PATH'] + ':/usr/libexec:/usr/local/libexec:/usr/local/bin'
88

99
# rubocop:disable Style/HashSyntax
10-
commands :mysql => 'mysql'
10+
commands :mysql_raw => 'mysql'
1111
commands :mysqld => 'mysqld'
1212
commands :mysqladmin => 'mysqladmin'
1313
# rubocop:enable Style/HashSyntax
@@ -54,8 +54,18 @@ def defaults_file
5454
self.class.defaults_file
5555
end
5656

57+
def self.mysql_caller(text_of_sql, type)
58+
if type.eql? 'system'
59+
mysql_raw([defaults_file, '--host=', system_database, '-e', text_of_sql].flatten.compact)
60+
elsif type.eql? 'regular'
61+
mysql_raw([defaults_file, '-NBe', text_of_sql].flatten.compact)
62+
else
63+
raise Puppet::Error, _("#mysql_caller: Unrecognised type '%{type}'" % { type: type })
64+
end
65+
end
66+
5767
def self.users
58-
mysql([defaults_file, '-NBe', "SELECT CONCAT(User, '@',Host) AS User FROM mysql.user"].compact).split("\n")
68+
mysql_caller("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').split("\n")
5969
end
6070

6171
# Optional parameter to run a statement on the MySQL system database.

lib/puppet/provider/mysql_database/mysql.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
Puppet::Type.type(:mysql_database).provide(:mysql, parent: Puppet::Provider::Mysql) do
33
desc 'Manages MySQL databases.'
44

5-
commands mysql: 'mysql'
5+
commands mysql_raw: 'mysql'
66

77
def self.instances
8-
mysql([defaults_file, '-NBe', 'show databases'].compact).split("\n").map do |name|
8+
mysql_caller('show databases', 'regular').split("\n").map do |name|
99
attributes = {}
10-
mysql([defaults_file, '-NBe', "show variables like '%_database'", name].compact).split("\n").each do |line|
10+
mysql_caller(["show variables like '%_database'", name], 'regular').split("\n").each do |line|
1111
k, v = line.split(%r{\s})
1212
attributes[k] = v
1313
end
@@ -29,7 +29,7 @@ def self.prefetch(resources)
2929
end
3030

3131
def create
32-
mysql([defaults_file, '-NBe', "create database if not exists `#{@resource[:name]}` character set `#{@resource[:charset]}` collate `#{@resource[:collate]}`"].compact)
32+
self.class.mysql_caller("create database if not exists `#{@resource[:name]}` character set `#{@resource[:charset]}` collate `#{@resource[:collate]}`", 'regular')
3333

3434
@property_hash[:ensure] = :present
3535
@property_hash[:charset] = @resource[:charset]
@@ -39,7 +39,7 @@ def create
3939
end
4040

4141
def destroy
42-
mysql([defaults_file, '-NBe', "drop database if exists `#{@resource[:name]}`"].compact)
42+
self.class.mysql_caller("drop database if exists `#{@resource[:name]}`", 'regular')
4343

4444
@property_hash.clear
4545
exists? ? (return false) : (return true)
@@ -52,13 +52,13 @@ def exists?
5252
mk_resource_methods
5353

5454
def charset=(value)
55-
mysql([defaults_file, '-NBe', "alter database `#{resource[:name]}` CHARACTER SET #{value}"].compact)
55+
self.class.mysql_caller("alter database `#{resource[:name]}` CHARACTER SET #{value}", 'regular')
5656
@property_hash[:charset] = value
5757
(charset == value) ? (return true) : (return false)
5858
end
5959

6060
def collate=(value)
61-
mysql([defaults_file, '-NBe', "alter database `#{resource[:name]}` COLLATE #{value}"].compact)
61+
self.class.mysql_caller("alter database `#{resource[:name]}` COLLATE #{value}", 'regular')
6262
@property_hash[:collate] = value
6363
(collate == value) ? (return true) : (return false)
6464
end

lib/puppet/provider/mysql_datadir/mysql.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,26 @@
55
initvars
66

77
# Make sure we find mysqld on CentOS and mysql_install_db on Gentoo and Solaris 11
8-
ENV['PATH'] = ENV['PATH'] + ':/usr/libexec:/usr/share/mysql/scripts:/opt/rh/mysql55/root/usr/bin:/opt/rh/mysql55/root/usr/libexec:/usr/mysql/5.5/bin:/usr/mysql/5.6/bin:/usr/mysql/5.7/bin'
8+
ENV['PATH'] = [
9+
ENV['PATH'],
10+
'/usr/libexec',
11+
'/usr/share/mysql/scripts',
12+
'/opt/rh/rh-mysql57/root/usr/bin',
13+
'/opt/rh/rh-mysql57/root/usr/libexec',
14+
'/opt/rh/rh-mysql56/root/usr/bin',
15+
'/opt/rh/rh-mysql56/root/usr/libexec',
16+
'/opt/rh/rh-mariadb101/root/usr/bin',
17+
'/opt/rh/rh-mariadb101/root/usr/libexec',
18+
'/opt/rh/rh-mariadb100/root/usr/bin',
19+
'/opt/rh/rh-mariadb100/root/usr/libexec',
20+
'/opt/rh/mysql55/root/usr/bin',
21+
'/opt/rh/mysql55/root/usr/libexec',
22+
'/opt/rh/mariadb55/root/usr/bin',
23+
'/opt/rh/mariadb55/root/usr/libexec',
24+
'/usr/mysql/5.5/bin',
25+
'/usr/mysql/5.6/bin',
26+
'/usr/mysql/5.7/bin',
27+
].join(':')
928

1029
commands mysqld: 'mysqld'
1130
optional_commands mysql_install_db: 'mysql_install_db'

0 commit comments

Comments
 (0)