djcas9 / legacy-snorby

!! DO NOT USE THIS - THIS REPO HAS MOVED - https://github.com/Snorby/snorby !!
http://www.snorby.org
59 stars 14 forks source link

Snorby installation only works with local Mysql server #11

Open NicoDR opened 14 years ago

NicoDR commented 14 years ago

Altough the config/database.yml file supports remote mysql servers (and part of the installation does too) lib/tasks/install_snorby.rake contains a hardcode system call to mysql which assumes a local database:

13: system("mysql -u #{@dbconfig['production']['username']} --password=#{@dbconfig['production']['password']} #{@dbconfig['production']['database']} < #{RAILS_ROOT}/db/create_mysql") ... 25: system("mysql -u #{@dbconfig['production']['username']} --password=#{@dbconfig['production']['password']} #{@dbconfig['production']['database']} < #{RAILS_ROOT}/db/create_mysql")

Replacing these lines with:

13: system("mysql -u #{@dbconfig['production']['username']} --password=#{@dbconfig['production']['password']} --host=#{@dbconfig['production']['host']} #{@dbconfig['production']['database']} < #{RAILS_ROOT}/db/create_mysql") ... 25: system("mysql -u #{@dbconfig['production']['username']} --password=#{@dbconfig['production']['password']} --host=#{@dbconfig['production']['host']} #{@dbconfig['production']['database']} < #{RAILS_ROOT}/db/create_mysql")

fixed the issue in my case, but somebody with more knowledge of Ruby should make this conditional so the '---host' part only gets added when the user defines a host in the database.yml file.

djcas9 commented 14 years ago

NicoDR,

Thank you for pointing this out. I will be adding your supplied changes and fixing the rake task.