未定义的方法`attr_accessible'对于UserTeam(call' UserTeam.connection'建立连接):Class

时间:2015-01-05 23:15:59

标签: gitlab

接下来:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.x-or-7.x-to-7.6.md

我将gitlab从6.9升级到7.6,而unicorn和sidekiq现在拒绝启动:

Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran. Starting both the GitLab Unicorn and Sidekiqmaster failed to start, check stderr log for details . The GitLab Unicorn web server is not running. The GitLab Sidekiq job dispatcher with pid 5705 is running.

错误日志(unicorn.stderr.logsidekiq.log)中的错误是undefined method 'attr_accessible' for UserTeam (call 'UserTeam.connection' to establish a connection):Class

gitlab信息(sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production):

(in /home/git/gitlab)

System information
System:     Ubuntu 12.04
Current User:   git
Using RVM:  no
Ruby Version:   2.1.5p273
Gem Version:    2.2.2
Bundler Version:1.7.11
Rake Version:   10.3.2
Sidekiq Version:2.17.8

GitLab information
Version:    7.6.2
Revision:   43180c6
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        https://gitlab.example.com
HTTP Clone URL: /gitlab.example.com/some-project.git
SSH Clone URL:  git@gitlab.example.com:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    2.4.0
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git

unicorn.stderr.log:

/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `attr_accessible' for UserTeam (call 'UserTeam.connection' to establish a connection):Class (NoMethodError) from /home/git/gitlab/app/models/deprecated/user_team.rb:17:in `<class:UserTeam>' from /home/git/gitlab/app/models/deprecated/user_team.rb:16:in `<top (required)>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:348:in `require_or_load' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:307:in `depend_on' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:225:in `require_dependency' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `each' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `block in eager_load!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `each' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `eager_load!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:346:in `eager_load!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `each' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers' from /usr/local/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each' from /usr/local/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component' from /usr/local/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from' from /usr/local/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component' from /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each' from /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `call' from /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component' from /usr/local/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each' from /usr/local/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `public_send' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `method_missing' from /home/git/gitlab/config/environment.rb:5:in `<top (required)>' from config.ru:13:in `require' from config.ru:13:in `block in <main>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize' from config.ru:1:in `new' from config.ru:1:in `<main>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `eval' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `block in builder' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn_rails:139:in `call' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn_rails:139:in `block in rails_builder' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `call' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `build_app!' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:140:in `start' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/bin/unicorn_rails:209:in `<top (required)>' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in `load' from /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in `<main>'

sidekiq:

undefined method `attr_accessible' for UserTeam (call 'UserTeam.connection' to establish a connection):Class /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing' /home/git/gitlab/app/models/deprecated/user_team.rb:17:in `<class:UserTeam>' /home/git/gitlab/app/models/deprecated/user_team.rb:16:in `<top (required)>' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:348:in `require_or_load' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:307:in `depend_on' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:225:in `require_dependency' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `each' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `block in eager_load!' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `each' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `eager_load!' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/engine.rb:346:in `eager_load!' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `each' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers' /usr/local/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each' /usr/local/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component' /usr/local/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from' /usr/local/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component' /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each' /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `call' /usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component' /usr/local/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each' /usr/local/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `public_send' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `method_missing' /home/git/gitlab/config/environment.rb:5:in `<top (required)>' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-2.17.8/lib/sidekiq/cli.rb:204:in `require' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-2.17.8/lib/sidekiq/cli.rb:204:in `boot_system' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-2.17.8/lib/sidekiq/cli.rb:42:in `parse' /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-2.17.8/bin/sidekiq:7:in `<top (required)>' /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/sidekiq:23:in `load' /home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/sidekiq:23:in `<main>'

我还必须将r​​uby从1.9.3升级到2.1.5,但在那里的任何步骤中都没有错误,在gems安装或db:migrate任务期间也没有错误。

1 个答案:

答案 0 :(得分:0)

对于遇到相同问题的任何人,此处的解决方法是删除/home/git/gitlab/app/models/deprecated