diff --git a/lib/puppet/type/mysql_grant.rb b/lib/puppet/type/mysql_grant.rb index b66dbd4..e6fb75d 100644 --- a/lib/puppet/type/mysql_grant.rb +++ b/lib/puppet/type/mysql_grant.rb @@ -3,9 +3,7 @@ Puppet::Type.newtype(:mysql_grant) do @doc = "Manage a MySQL user's rights." ensurable - autorequire(:file) do - '/root/.my.cnf' - end + autorequire(:file) { '/root/.my.cnf' } def initialize(*args) super @@ -38,6 +36,10 @@ Puppet::Type.newtype(:mysql_grant) do newproperty(:privileges, :array_matching => :all) do desc 'Privileges for user' + + munge do |value| + value.upcase + end end newproperty(:table) do diff --git a/spec/system/types/mysql_grant_spec.rb b/spec/system/types/mysql_grant_spec.rb index ffde940..a3bdf82 100644 --- a/spec/system/types/mysql_grant_spec.rb +++ b/spec/system/types/mysql_grant_spec.rb @@ -283,5 +283,32 @@ describe 'mysql_grant' do 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