Merge pull request #759 from mhaskel/merge_3.6.x

Merge 3.6.x
This commit is contained in:
Hunter Haugen 2015-09-24 11:45:31 -07:00
commit 1823c7cd64
5 changed files with 36 additions and 11 deletions

View file

@ -1,3 +1,13 @@
## 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 ## 2015-08-10 - Supported Release 3.6.0
### Summary ### Summary
This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances. This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances.

View file

@ -65,10 +65,10 @@ Puppet::Type.newtype(:mysql_grant) do
# If at least one special char is used, string must be quoted # If at least one special char is used, string must be quoted
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827 # http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-]+)/.match(value) if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[2] user_part = matches[2]
host_part = matches[3] host_part = matches[3]
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value) elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[1] user_part = matches[1]
host_part = matches[2] host_part = matches[2]
elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value) elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value)
@ -87,6 +87,11 @@ Puppet::Type.newtype(:mysql_grant) do
end end
end end
end end
munge do |value|
matches = /^((['`"]?).*\2)@(.+)$/.match(value)
"#{matches[1]}@#{matches[3].downcase}"
end
end end
newproperty(:options, :array_matching => :all) do newproperty(:options, :array_matching => :all) do

View file

@ -14,10 +14,10 @@ Puppet::Type.newtype(:mysql_user) do
# If at least one special char is used, string must be quoted # If at least one special char is used, string must be quoted
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827 # http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
if matches = /^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-]+)/.match(value) if matches = /^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[2] user_part = matches[2]
host_part = matches[3] host_part = matches[3]
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value) elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[1] user_part = matches[1]
host_part = matches[2] host_part = matches[2]
elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value) elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value)
@ -38,7 +38,7 @@ Puppet::Type.newtype(:mysql_user) do
end end
munge do |value| munge do |value|
matches = /^((['`"]?).*\2)@([\w%\.:\-]+)/.match(value) matches = /^((['`"]?).*\2)@(.+)$/.match(value)
"#{matches[1]}@#{matches[3].downcase}" "#{matches[1]}@#{matches[3].downcase}"
end end
end end

View file

@ -1,12 +1,16 @@
{ {
"name": "puppetlabs-mysql", "name": "puppetlabs-mysql",
"version": "3.6.0", "version": "3.6.1",
"author": "Puppet Labs", "author": "Puppet Labs",
"summary": "Installs, configures, and manages the MySQL service.", "summary": "Installs, configures, and manages the MySQL service.",
"license": "Apache-2.0", "license": "Apache-2.0",
"source": "git://github.com/puppetlabs/puppetlabs-mysql.git", "source": "git://github.com/puppetlabs/puppetlabs-mysql.git",
"project_page": "http://github.com/puppetlabs/puppetlabs-mysql", "project_page": "http://github.com/puppetlabs/puppetlabs-mysql",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
],
"operatingsystem_support": [ "operatingsystem_support": [
{ {
"operatingsystem": "RedHat", "operatingsystem": "RedHat",
@ -81,9 +85,5 @@
"version_requirement": ">= 3.0.0 < 5.0.0" "version_requirement": ">= 3.0.0 < 5.0.0"
} }
], ],
"description": "Mysql module", "description": "Mysql module"
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
]
} }

View file

@ -51,6 +51,16 @@ describe Puppet::Type.type(:mysql_user) do
end end
end end
context 'using foo@192.168.1.0/255.255.255.0' do
before :each do
@user = Puppet::Type.type(:mysql_user).new(:name => 'foo@192.168.1.0/255.255.255.0', :password_hash => 'pass')
end
it 'should create the user with the netmask' do
expect(@user[:name]).to eq('foo@192.168.1.0/255.255.255.0')
end
end
context 'using allo_wed$char@localhost' do context 'using allo_wed$char@localhost' do
before :each do before :each do
@user = Puppet::Type.type(:mysql_user).new(:name => 'allo_wed$char@localhost', :password_hash => 'pass') @user = Puppet::Type.type(:mysql_user).new(:name => 'allo_wed$char@localhost', :password_hash => 'pass')