instructure / analytics

The official analytics package for Instructure's Canvas LMS.
GNU Affero General Public License v3.0
35 stars 34 forks source link

undefined method `register' for Analytics::Permissions:Module (NoMethodError) #6

Closed xaviaracil closed 7 years ago

xaviaracil commented 7 years ago

Hi all,

After installing the analytics module and restarting canvas_init I got the following error:

  Message from application: undefined method `register' for Analytics::Permissions:Module (NoMethodError)
  /var/canvas/gems/plugins/analytics/lib/analytics/engine.rb:44:in `block in <class:Engine>'
  /var/canvas/gems/autoextend/lib/autoextend.rb:8:in `extend'
  /var/canvas/gems/autoextend/lib/autoextend.rb:37:in `block in const_added'
  /var/canvas/gems/autoextend/lib/autoextend.rb:33:in `each'
  /var/canvas/gems/autoextend/lib/autoextend.rb:33:in `const_added'
  /var/canvas/gems/autoextend/lib/autoextend.rb:118:in `notify_autoextend_of_new_constant'
  /var/canvas/gems/autoextend/lib/autoextend.rb:131:in `block in new_constants_in'
  /var/canvas/gems/autoextend/lib/autoextend.rb:128:in `each'
  /var/canvas/gems/autoextend/lib/autoextend.rb:128:in `new_constants_in'
  /var/canvas/gems/autoextend/lib/autoextend.rb:145:in `require_or_load'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:494:in `load_missing_constant'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:184:in `const_missing'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:526:in `load_missing_constant'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:184:in `const_missing'
  /var/canvas/app/models/role_override.rb:69:in `<class:RoleOverride>'
  /var/canvas/app/models/role_override.rb:19:in `<top (required)>'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:360:in `require_or_load'
  /var/canvas/gems/autoextend/lib/autoextend.rb:145:in `block in require_or_load'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:647:in `new_constants_in'
  /var/canvas/gems/autoextend/lib/autoextend.rb:128:in `new_constants_in'
  /var/canvas/gems/autoextend/lib/autoextend.rb:145:in `require_or_load'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:317:in `depend_on'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:233:in `require_dependency'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:471:in `each'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:471:in `block in eager_load!'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:469:in `each'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:469:in `eager_load!'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/engine.rb:346:in `eager_load!'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application/finisher.rb:56:in `each'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers'
  /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
  /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
  /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
  /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
  /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
  /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
  /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
  /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing'
  /var/canvas/config/environment.rb:11:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
  /var/canvas/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

My guess is that it's confusing /var/canvas/gems/plugins/analytics/lib/analytics/permissions.rb with /var/canvas/lib/permissions.rbfrom canvas-lms.

Using stable branches both in canvas-lms and analytics.

Thanks in advance,

Xavi

xaviaracil commented 7 years ago

Changing Permissions.register for ::Permissions.register in /var/canvas/gems/plugins/analytics/lib/analytics/engine.rb worked for me.

I'd make a pull request if you agree.

simonista commented 7 years ago

Hey @xaviaracil, this is already fixed in master: https://github.com/instructure/analytics/commit/25ced53494b2833e6a0aa31f6679aa86bee5f3ca. it will be in the 2/18 release to stable, but it should be fine to cherry-pick over as well.