I removed the duplicate code on 7b3574c6ce711ab75cddadafcd5afca633c97484.
The validation seems to be working ok.


On 14 August 2013 09:57, Bruno Savioli de Almeida <bruno@savioli.org> wrote:

> I'll see what I can do... I just found out that the validation is not
> working for the table grants...
>
>
> On 13 August 2013 19:43, Ashley Penney <notifications@github.com> wrote:
>
>> In lib/puppet/provider/database_grant/mysql.rb:
>>
>> > @@ -182,16 +235,31 @@ def validate_privs(set_privs, all_privs)
>> >      invalid_privs = Array.new
>> >      hints = Array.new
>> >      # Test each of the user provided privs to see if they exist in all_privs
>> > -    set_privs.each do |priv|
>> > -      invalid_privs << priv unless all_privs.include?(priv)
>> > -      hints << "#{priv}_priv" if all_privs.include?("#{priv}_priv")
>> > -    end
>> > -    unless invalid_privs.empty?
>> > -      # Print a decently helpful and gramatically correct error message
>> > -      hints = "Did you mean '#{hints.join(',')}'?" unless hints.empty?
>> > -      p = invalid_privs.size > 1 ? ['s', 'are not valid'] : ['', 'is not valid']
>> > -      detail = ["The privilege#{p[0]} '#{invalid_privs.join(',')}' #{p[1]}."]
>> > -      fail [detail, hints].join(' ')
>> > +    case name[:type]
>>
>> Is there any way to collapse this down? There's so much duplication here
>> and I can't help but think it could be made a bit more DRY.
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/puppetlabs/puppetlabs-mysql/pull/242/files#r5744550>
>> .
>>
>
>
>
> --
> - Bruno
>



-- 
- Bruno