Portál AbcLinuxu, 12. května 2025 11:34

Dotaz: Redmine plugin error

16.2.2015 16:51 majales | skóre: 29 | blog: Majales
Redmine plugin error
Přečteno: 344×
Odpovědět | Admin
Zdravím, Snažím se nainstalovat plugin Redmine Stealth a nemůžu se zbavit chyby při přihlášení k admin účtu redmine.
Chyba z production.log

Started GET "/redmine/" for 192.168.0.24 at 2015-02-16 16:07:37 +0100
Processing by WelcomeController#index as HTML
  Current user: admin (id=1)
  Rendered welcome/index.html.erb within layouts/base (4.4ms)
Completed 500 Internal Server Error in 56.0ms

ActionController::RoutingError (No route matches {:controller=>"stealth", :action=>"toggle"}):
  lib/redmine/menu_manager.rb:150:in `render_single_menu_node'
  lib/redmine/menu_manager.rb:102:in `render_menu_node'
  lib/redmine/menu_manager.rb:91:in `block in render_menu'
  lib/redmine/menu_manager.rb:168:in `block in menu_items_for'
  lib/redmine/menu_manager.rb:165:in `each'
  lib/redmine/menu_manager.rb:165:in `menu_items_for'
  lib/redmine/menu_manager.rb:90:in `render_menu'
  app/views/layouts/base.html.erb:23:in `_app_views_layouts_base_html_erb__3845021773723747168_53411720'
Moje instalace remine na Debianu Wheezy s použitím wheezy backports:
Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.6
  Environment                    production
  Database adapter               MySQL
Plugin je upravená verze pro Redmine 2.5 odsud:

https://github.com/mlutfy/redmine_stealth/tree/redmine-2.5

Nevíte někdo co ta chyba znamená? Nějak na to po usilovném hledání na netu nemůžu přijít.
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

16.2.2015 17:13 TTTTTTTT
Rozbalit Rozbalit vše Re: Redmine plugin error
Odpovědět | | Sbalit | Link | Blokovat | Admin
Chyba typicky vznikne při generování odkazu - v aplikaci (zde zjevně v menu) je požadován odkaz na controller 'stealth' a akci 'toggle'. Aplikace neví, jak má vypadat URL, která na to odkazuje. V config/routes.rb by mělo být mapování, ale zřejmě se špatně načetlo (nebo je ten odkaz špatně). Zkus, co řekne rake routes v adresáři s redmine.
16.2.2015 19:35 majales | skóre: 29 | blog: Majales
Rozbalit Rozbalit vše Re: Redmine plugin error
V config/routes.rb je:
  Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
    file = File.join(plugin_dir, "config/routes.rb")
    if File.exists?(file)
      begin
        instance_eval File.read(file)
      rescue Exception => e
        puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
        exit 1
      end
    end
  end
end
Když spustím
rake routes RAILS_ENV=production
tak tam nikde ten redmine stealth plugin není.

V /plugins/redmine_stealth/config/routes.rb je pak:
if Rails::VERSION::MAJOR >= 3

  RedmineApp::Application.routes.draw do
    match '/stealth/toggle', :to => 'stealth#toggle'
  end

else

  ActionController::Routing::Routes.draw do |map|
    map.connect '/stealth/toggle',
      :controller => 'stealth', :action => 'toggle',
      :conditions => { :method => :post }
  end

end
Nejsem schopen posoudit kde by mohla být chyba. Práva na adresáře v redmine/lib/plugins jsou taky všude stejné. Vlastník je root a práva 755.
16.2.2015 20:48 TTTTTTTT
Rozbalit Rozbalit vše Re: Redmine plugin error
Od pohledu to vypadá v pořádku. Zkusil jsem nainstalovat plugin do čistého Redmine a též mi funguje (zkoušel jsem jen jestli se zobrazí /welcome, ne samotnou funkcionalitu). V rake routes mám na posledním řádku
                        stealth_toggle              /stealth/toggle(.:format)
Můžete zkusit zjistit, jestli se provede ten kód v config/routes.rb z pluginu. V lepší společnosti se to dělá debuggerem,já většinou do kódu připíšu raise "checkpoint" a koukám, jestli to vyhodí tuhle výjimku.

Nesedí mi verze Redmine a Rails - Redmine 2.5.1 má Rails 3.2.17, release, který používá Rails 3.2.6 je přes dva roky starý a odpovídá verzi redmine ~2.1.
16.2.2015 21:28 majales | skóre: 29 | blog: Majales
Rozbalit Rozbalit vše Re: Redmine plugin error
Redmine jsem instaloval takto:

 aptitude install -t wheezy-backports redmine redmine-mysql mysql-server
The following NEW packages will be installed:
  binutils{a} build-essential{a} bundler{a} bzip2{a} ca-certificates{a} cpp{a} cpp-4.7{a} dbconfig-common{a} dpkg-dev{a} fakeroot{a} g++{a} g++-4.7{a} gcc{a}
  gcc-4.7{a} heirloom-mailx{a} javascript-common{a} less{a} libaio1{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a}
  libc-dev-bin{a} libc6-dev{a} libcurl3{a} libdbd-mysql-perl{a} libdbi-perl{a} libdpkg-perl{a} libev4{a} libfcgi-ruby1.9.1{a} libfcgi0ldbl{a}
  libfile-fcntllock-perl{a} libgmp10{a} libgnutls-deb0-28{a} libgomp1{a} libhogweed2{a} libhtml-template-perl{a} libitm1{a} libjs-jquery{a} libjs-jquery-ui{a}
  libjs-prototype{a} libjs-scriptaculous{a} libldap-2.4-2{a} libmpc2{a} libmpfr4{a} libmysqlclient18{a} libnettle4{a} libquadmath0{a} librtmp0{a} libruby1.9.1{a}
  libsasl2-2{a} libsasl2-modules{a} libssh2-1{a} libstdc++6-4.7-dev{a} libtasn1-6{a} libtimedate-perl{a} libyaml-0-2{a} linux-libc-dev{a} make{a} manpages-dev{a}
  mysql-client{a} mysql-client-5.5{a} mysql-common{a} mysql-server mysql-server-5.5{a} mysql-server-core-5.5{a} openssl{a} patch{a} psmisc{a} rake{a} redmine
  redmine-mysql ruby{a} ruby-actionmailer-3.2{a} ruby-actionpack-3.2{a} ruby-activemodel-3.2{a} ruby-activerecord-3.2{a} ruby-activesupport-3.2{a} ruby-arel{a}
  ruby-awesome-nested-set{a} ruby-blankslate{a} ruby-builder{a} ruby-coderay{a} ruby-dev{a} ruby-erubis{a} ruby-hike{a} ruby-hmac{a} ruby-hoe{a} ruby-i18n{a}
  ruby-journey{a} ruby-jquery-rails{a} ruby-json{a} ruby-mail{a} ruby-mime-types{a} ruby-minitest{a} ruby-multi-json{a} ruby-mysql{a} ruby-net-ldap{a} ruby-oj{a}
  ruby-openid{a} ruby-passenger{a} ruby-polyglot{a} ruby-rack{a} ruby-rack-cache{a} ruby-rack-openid{a} ruby-rack-ssl{a} ruby-rack-test{a} ruby-rails-observers{a}
  ruby-railties-3.2{a} ruby-sass{a} ruby-sass-rails{a} ruby-sprockets{a} ruby-sqlite3{a} ruby-thor{a} ruby-tilt{a} ruby-treetop{a} ruby-tzinfo{a} ruby-yajl{a}
  ruby1.9.1{a} ruby1.9.1-dev{a} rubygems-integration{a} sudo{a} unzip{a} wwwconfig-common{a} zip{a}
The following packages will be upgraded:
  libp11-kit0
1 packages upgraded, 124 newly installed, 0 to remove and 16 not upgraded
Balíček rails tam ale v závislostech není. Naistaluje se rails jako součást redmine?

Když hledám balíček rails ukáže se mi jako nenainstalovaný:
aptitude search rails
p   libgettext-rails-ruby                                                       - Transitional package for ruby-gettext-rails
p   libgettext-rails-ruby-doc                                                   - Transitional package for ruby-gettext-rails
p   libgettext-rails-ruby1.8                                                    - Transitional package for ruby-gettext-rails
p   liblocale-rails-ruby                                                        - Transitional package for ruby-locale-rails
p   liblocale-rails-ruby1.8                                                     - Transitional package for ruby-locale-rails
p   rails                                                                       - MVC ruby based framework geared for web application development
p   rails-doc                                                                   - Transitional package for rails
p   rails-ruby1.8                                                               - Transitional package for rails
p   rails3                                                                      - MVC ruby based framework geared for web application development
p   ruby-gettext-rails                                                          - Gettext support for Rails >= 2.3
i A ruby-jquery-rails                                                           - jQuery for Rails 3
p   ruby-locale-rails                                                           - Pure ruby library with basic functions for Rails localization
p   ruby-rails-2.3                                                              - MVC ruby based framework geared for web application development
p   ruby-rails-3.2                                                              - MVC ruby based framework geared for web application development
i A ruby-rails-observers                                                        - toolkit to build Rails observers (part of Rails)
i A ruby-sass-rails                                                             - Sass adapter for the Rails asset pipeline
p   vim-rails                                                                   - vim development tools for Rails development
p   vistrails                                                                   - Science visualisation workflow toolkit
Balíček rails3 je pak nenainstalovaný a ukazuje verzi 3.2.6.
aptitude show rails3
Package: rails3
State: not installed
Version: 3.2.6-1
Priority: optional
Section: ruby
Maintainer: Debian Ruby Extras Maintainers < pkg-ruby-extras-maininers(AT)lists.alioth.debian.org >
Architecture: all
Uncompressed Size: 26.6 k
Depends: ruby-rails-3.2
Description: MVC ruby based framework geared for web application development
 Rails is a full-stack, open-source web framework in Ruby for writing real-world applications.

 Being a full-stack framework means that all layers are built to work seamlessly together. That way you don't repeat yourself and you can use a single language from top
 to bottom. Everything from templates to control flow to business logic is written in Ruby.

 This package is a convenience metapackage that depends on ruby-rails-3.2.
Homepage: http://www.rubyonrails.org

Tak se v tom docela ztrácím.
16.2.2015 22:35 TTTTTTTT
Rozbalit Rozbalit vše Re: Redmine plugin error
Ruby mají vlastní balíčkovací systém - rubygems, balíčku se říká gem. gem list vypíše nainstalované gemy. Debian dokáže některé gemy instalovat jako apt-balíky a koukám, že existuje package rubygems-integration, která gemy nainstalované debianem přidává do rubygems. Nepoužívám to, ani nevím, jak (dobře) to funguje.

Redmine používá bundler, což je nástroj, který si vynutí použítí konkrétních verzí gemů podle souboru Gemfile. Pokud gemy nebo jejich verze chybí, nainstaluje je lokálně (k redmine) nebo globálně (mezi systémové gemy). Redmine jde zdá se spustit i bez bundleru, pak zřejmě vezme zavděk verzemi gemů, které najde - to zřejmě způsobilo ten nesoulad verzí. Těžko říct, jestli i tu chybu. Dokážu si představit, že mu vadí, že dostal "náhodné" závislosti.

Zkusil bych, jak to funguje s lokálním serverem, který jde spustit pomocí rails s -e production, resp. bundle exec rails s -e production. Druhý příkaz by měl vynutit použití bundleru. Pokud si bude stěžovat, že mu něco chybí jde to doinstalovat bundle install.

16.2.2015 22:51 majales | skóre: 29 | blog: Majales
Rozbalit Rozbalit vše Re: Redmine plugin error
Redmine samotný funguje bezvadně. Bez jakéhokoliv pluginu. Ještě mě napadlo zda není problém v té cestě. Na té mojí instalaci je cesta k pluginům /usr/share/redmine/lib/plugins/ , ale cesta v /usr/share/redmine/config/routes.rb je "plugins/*". Konkrétně mám na mysli toto:
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
Je tedy Rails.root opravdu /usr/share/redmine/lib/ ?
16.2.2015 23:49 TTT
Rozbalit Rozbalit vše Re: Redmine plugin error
No, to patrně problém je :-) redmine/lib/plugins jsou pluginy do rails, které používá redmine. redmine/plugins jsou pluginy do redmine - tam by měl být i ten instalovaný. Strukturu mají podobnou, proto ho zřejmě najde i v lib/plugins, ale už mu nenačte cesty.
16.2.2015 23:57 majales | skóre: 29 | blog: Majales
Rozbalit Rozbalit vše Re: Redmine plugin error
Tak po přepsání cesty v /usr/share/redmine/config/routes.rb zase o krůček dál.

Teď to vypadá takhle:
Dir.glob File.expand_path("lib/plugins/*", Rails.root) do |plugin_dir|
Redmine už s admin účtem naběhne, ale po aplikování stealth (v češtině "Zapnout neviditelnost") v menu napravo nahoře vypíše "Failed to toggle stealth mode".

V logu je pak:
Started POST "/redmine/stealth/toggle" for 192.168.0.24 at 2015-02-16 23:55:32 +0100

ActionController::RoutingError (uninitialized constant StealthController):
  /usr/lib/ruby/vendor_ruby/active_support/inflector/methods.rb:229:in `block in constantize'
  /usr/lib/ruby/vendor_ruby/active_support/inflector/methods.rb:228:in `each'
  /usr/lib/ruby/vendor_ruby/active_support/inflector/methods.rb:228:in `constantize'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:69:in `controller_reference'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:54:in `controller'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:32:in `call'
  /usr/lib/ruby/vendor_ruby/journey/router.rb:68:in `block in call'
  /usr/lib/ruby/vendor_ruby/journey/router.rb:56:in `each'
  /usr/lib/ruby/vendor_ruby/journey/router.rb:56:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/routing/route_set.rb:600:in `call'
  /usr/lib/ruby/vendor_ruby/rack/openid.rb:98:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  /usr/lib/ruby/vendor_ruby/rack/etag.rb:23:in `call'
  /usr/lib/ruby/vendor_ruby/rack/conditionalget.rb:35:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/head.rb:14:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/params_parser.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/flash.rb:242:in `call'
  /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:205:in `context'
  /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:200:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/cookies.rb:338:in `call'
  /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:64:in `call'
  /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:405:in `_run__4126075576736393965__call__4557526292318625602__callbacks'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:405:in `__run_callback'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:385:in `_run_call_callbacks'
  /usr/lib/ruby/vendor_ruby/active_support/callbacks.rb:81:in `run_callbacks'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/callbacks.rb:27:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/remote_ip.rb:31:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:26:in `call_app'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:16:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/request_id.rb:22:in `call'
  /usr/lib/ruby/vendor_ruby/rack/methodoverride.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/rack/runtime.rb:17:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/cache/strategy/local_cache.rb:72:in `call'
  /usr/lib/ruby/vendor_ruby/rack/lock.rb:15:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/static.rb:62:in `call'
  /usr/lib/ruby/vendor_ruby/rack/cache/context.rb:136:in `forward'
  /usr/lib/ruby/vendor_ruby/rack/cache/context.rb:143:in `pass'
  /usr/lib/ruby/vendor_ruby/rack/cache/context.rb:155:in `invalidate'
  /usr/lib/ruby/vendor_ruby/rack/cache/context.rb:71:in `call!'
  /usr/lib/ruby/vendor_ruby/rack/cache/context.rb:51:in `call'
  /usr/lib/ruby/vendor_ruby/rails/engine.rb:479:in `call'
  /usr/lib/ruby/vendor_ruby/rails/application.rb:220:in `call'
  /usr/lib/ruby/vendor_ruby/rails/railtie/configurable.rb:30:in `method_missing'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

17.2.2015 12:38 majales | skóre: 29 | blog: Majales
Rozbalit Rozbalit vše Re: Redmine plugin error
Tak jsem to vyřešil. V souboru /usr/share/redmine/config/environment.rb stojí toto:
    "Please, put your Redmine plugins in the `plugins` directory at the root of your " +
    "Redmine directory (#{File.join(Rails.root, "plugins")})"
Takže jsem vytvořil adresář /usr/share/redmine/plugins/ A do něj gitem naklonoval znovu Remine Stealth plugin ( v původním umístění v /usr/share/redmine/lib/plugins/ jsem Remine Stealth smazal)

A po restartu apache vše funguje. Díky za pomoc a vysvětlení.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.