Mongodb output plugin fails with authentication

Description

Using following connection string for uri configuration against mongodb configured with authentication:
uri => 'mongodb://test:test@localhost:27017/db/'
I get this error:
Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments calling `add_auth` (3 for 4)

Bug or am I miss something?

Activity

Show:
bitsofinfo
September 20, 2013, 2:03 PM
Edited

Looking at mongodb.rb ~lines 36 -> 44, if I output the parsed auths to STDOUT I get 2 of them in that loop

{:db_name=>"myDBFromConfig", :username=>"myUsernameFromConfig", assword=>"myPWFromConfig"}
{:db_name=>nil, :username=>nil, assword=>nil, :source=>nil}

So I have no idea why its applying every auth it gets from the parser, or why the parser yields 2... one that is good and one that is full of nulls,, however its the last one that is tripping the error you see above.

Maybe change to this

if !auth['db_name'].nil?
conn.add_auth(auth['db_name'], auth['username'], auth['password'], nil)
end

Confirmed the above fixes it, I'll make a patch

bitsofinfo
September 20, 2013, 3:47 PM
Nick Ethier
September 20, 2013, 5:52 PM

@bitsofinfo Thanks for the patch! Before I get it merged, could you please make sure you've completed step 2 in our CONTRIBUTING.md doc?

Thanks again!

bitsofinfo
September 20, 2013, 6:34 PM

Nick - already did earlier today and clicked on the confirm in the email.

Nick Ethier
September 20, 2013, 6:44 PM
Fixed

Assignee

Jordan Sissel

Reporter

peruggini

Labels

None

Fix versions

Affects versions

Configure