Skip to content

Fix gitlab:setup task on fresh installation

gitlab-qa-bot requested to merge github/fork/dasbh/master into master

Created by: dasbh

Fresh installation from master throws below error on gitlab:setup task

$bundle exec rake gitlab:setup RAILS_ENV=production

This will rebuild an authorized_keys file.                                  
You will lose any data stored in /home/git/.ssh/authorized_keys.            
Do you want to continue (yes/no)? yes                                       

Mysql2::Error: Table 'gitlabhq_production.keys' doesn't exist: SHOW FULL FIELDS FROM `keys`
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `query'
......................[truncated trace] ....
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/querying.rb:8:in `find_each'
/home/git/gitlab/lib/tasks/gitlab/shell.rake:35:in `setup'
/home/git/gitlab/lib/tasks/gitlab/setup.rake:4:in `block (2 levels) in <top (required)>'
Tasks: TOP => gitlab:setup
(See full trace by running task with --trace)

This looks like task gitlab:setup invokes wrong setup method.. aparent from trace (/home/git/gitlab/lib/tasks/gitlab/shell.rake:35:in `setup') and falls over because there no tables on db.

Further verified by running

$bundle exec rake gitlab:shell:setup RAILS_ENV=production 

This simple pull request is to rename setup to setup_db so that it does not collide with setup method in shell.rake

I have verified this changes and successfully installed gitlab from master with gitlab-shell.

Merge request reports