ajvb / kala

Modern Job Scheduler
MIT License
2.13k stars 187 forks source link

when jobDBPassword=""or not input jobDBPassword para #154

Closed JasonShenShen closed 7 years ago

JasonShenShen commented 7 years ago

//my redis is not set passwd for connection ./kala run -p 40001 --jobDB=redis --jobDBAddress=192.168.6.151:6379 FATA[0000] ERR Client sent AUTH, but no password is set

./kala run -p 40001 --jobDB=redis --jobDBAddress=192.168.6.151:6379 --jobDBPassword="" panic: runtime error: invalid memory address or nil pointer dereference

  1. Because of default jobDBPassword is 'password'
  2. Because of DialOption in kala/job/storage/redis.go is nil and redigo/redis will get error in calling Dial func. //redigo/redis/conn.go for _, option := range options { option.f(&do) }

fixed

  1. I think we should change the default password to be empty string instead of password.
  2. Instead of using Newnopass, I think we should do the if-else in the redis.New() on checking whether the DialOption is nil. --- golang struct can not check whether it is nil when struct initialized, and DialOption struct also can not compare with empty DialOption struct because of the f func in it. So, I add para in redis.New() instead of add redis.Newnopass function.

Please check if it needs merge, Thanks.

ajvb commented 7 years ago

@JasonShenShen thank you for your PR!