Skip to content

Commit d6e7d52

Browse files
author
Ashley Penney
committed
Merge pull request #342 from apenney/fix/privileges
Fix an issue with lowercase privileges.
2 parents cec288d + 047bff1 commit d6e7d52

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source 'https://rubygems.org'
22

33
group :development, :test do
4+
gem 'mime-types', '<2.0', :require => false
45
gem 'rake', :require => false
56
gem 'rspec-puppet', :require => false
67
gem 'puppetlabs_spec_helper', :require => false

lib/puppet/type/mysql_grant.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
@doc = "Manage a MySQL user's rights."
44
ensurable
55

6-
autorequire(:file) do
7-
'/root/.my.cnf'
8-
end
6+
autorequire(:file) { '/root/.my.cnf' }
97

108
def initialize(*args)
119
super
@@ -38,6 +36,10 @@ def initialize(*args)
3836

3937
newproperty(:privileges, :array_matching => :all) do
4038
desc 'Privileges for user'
39+
40+
munge do |value|
41+
value.upcase
42+
end
4143
end
4244

4345
newproperty(:table) do

spec/system/types/mysql_grant_spec.rb

+27
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,32 @@ class { 'mysql::server': }
283283
end
284284
end
285285

286+
describe 'lower case privileges' do
287+
it 'create ALL privs' do
288+
pp = <<-EOS
289+
mysql_grant { 'lowercase@localhost/*.*':
290+
user => 'lowercase@localhost',
291+
privileges => 'ALL',
292+
table => '*.*',
293+
}
294+
EOS
295+
296+
puppet_apply(pp)
297+
end
298+
299+
it 'create lowercase all privs' do
300+
pp = <<-EOS
301+
mysql_grant { 'lowercase@localhost/*.*':
302+
user => 'lowercase@localhost',
303+
privileges => 'all',
304+
table => '*.*',
305+
}
306+
EOS
307+
308+
puppet_apply(pp) do |r|
309+
r.exit_code.should be_zero
310+
end
311+
end
312+
end
286313

287314
end

0 commit comments

Comments
 (0)