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?
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 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!
Nick - already did earlier today and clicked on the confirm in the email.