Skip to content

Commit c12a8fb

Browse files
authored
Merge pull request #871 from dn1s/mysqluser_char_length
MODULES-3697 Changed puppet fail behaviour for mysql create user and grant if user name is longer than 16 chars
2 parents 20dc64f + 0f4877d commit c12a8fb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/puppet/type/mysql_grant.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ def initialize(*args)
8080

8181
mysql_version = Facter.value(:mysql_version)
8282
unless mysql_version.nil?
83-
if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 and user_part.size > 16
83+
if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 and user_part.size > 16
8484
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 16 characters')
85+
elsif Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 and user_part.size > 32
86+
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 32 characters')
8587
elsif Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 and user_part.size > 80
8688
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 80 characters')
8789
end

lib/puppet/type/mysql_user.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929

3030
mysql_version = Facter.value(:mysql_version)
3131
unless mysql_version.nil?
32-
if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 and user_part.size > 16
32+
if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 and user_part.size > 16
3333
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 16 characters')
34+
elsif Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 and user_part.size > 32
35+
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 32 characters')
3436
elsif Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 and user_part.size > 80
3537
raise(ArgumentError, 'MySQL usernames are limited to a maximum of 80 characters')
3638
end

0 commit comments

Comments
 (0)