Skip to content

Fix an issue with lowercase privileges. #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

group :development, :test do
gem 'mime-types', '<2.0', :require => false
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
Expand Down
8 changes: 5 additions & 3 deletions lib/puppet/type/mysql_grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
@doc = "Manage a MySQL user's rights."
ensurable

autorequire(:file) do
'/root/.my.cnf'
end
autorequire(:file) { '/root/.my.cnf' }

def initialize(*args)
super
Expand Down Expand Up @@ -38,6 +36,10 @@ def initialize(*args)

newproperty(:privileges, :array_matching => :all) do
desc 'Privileges for user'

munge do |value|
value.upcase
end
end

newproperty(:table) do
Expand Down
27 changes: 27 additions & 0 deletions spec/system/types/mysql_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,32 @@ class { 'mysql::server': }
end
end

describe 'lower case privileges' do
it 'create ALL privs' do
pp = <<-EOS
mysql_grant { 'lowercase@localhost/*.*':
user => 'lowercase@localhost',
privileges => 'ALL',
table => '*.*',
}
EOS

puppet_apply(pp)
end

it 'create lowercase all privs' do
pp = <<-EOS
mysql_grant { 'lowercase@localhost/*.*':
user => 'lowercase@localhost',
privileges => 'all',
table => '*.*',
}
EOS

puppet_apply(pp) do |r|
r.exit_code.should be_zero
end
end
end

end