Administration Users function fails

Added by Alan Chandler over 3 years ago

I have just migrated by redmine installation version 1.3.2 from apache passenger under Debian Squeeze to a new virtual machine running Nginx, Thin and Debian Wheezy

In essence I untarred the latest release (2.5.1) into the /var/www/redmine directory and added the agile plugin. I copied over my sqlite database, files subdirectory and config/configuration.yml and config/database.yml files to the new environment. I also copied over the files from the A1 theme (which I use) into the theme directory. I then ran bundle install and the rake migration scripts as per the instructions for upgrading redmine.

The only other difference is that the application was previously accessed as a subdirectory of my main domain (under https), but has now got a subdomain of its own where it is under root on the new server.

Mostly it is working well. (I did have a problem with forms being submitted as http rather than https, but resolved that with nginx passing the X_FORWARDED_PROTO header as "HTTPS" )

However, when I try and access the user list from Admin, I get

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

And when I look in the log I see the following

Started GET "/users" for 82.14.222.143 at 2014-04-23 10:40:41 +0000
Processing by UsersController#index as HTML
  Current user: alan (id=2)
  Rendered users/index.html.erb within layouts/admin (29.1ms)
Completed 500 Internal Server Error in 43.0ms

ActionView::Template::Error (undefined method `utc?' for 1318238653:Fixnum):
    43:   <td class="email"><%= mail_to(h(user.mail)) %></td>
    44:   <td class="tick"><%= checked_image user.admin? %></td>
    45:   <td class="created_on"><%= format_time(user.created_on) %></td>
    46:   <td class="last_login_on"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
    47:     <td class="buttons">
    48:       <%= change_status_link(user) %>
    49:       <%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %>
  lib/redmine/i18n.rb:70:in `format_time'
  app/views/users/index.html.erb:46:in `block in _app_views_users_index_html_erb__3951960837736324679_69836100'
  app/views/users/index.html.erb:38:in `each'
  app/views/users/index.html.erb:38:in `_app_views_users_index_html_erb__3951960837736324679_69836100'
  app/controllers/users_controller.rb:55:in `block (2 levels) in index'
  app/controllers/users_controller.rb:52:in `index'

running the script/about for my environment gives

sh: 1: svn: not found
sh: 1: darcs: not found
sh: 1: hg: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
sh: 1: git: not found
Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.17
  Environment                    production
  Database adapter               SQLite
SCM:
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.2.0-light

I don't know how to program in ruby at all, so the above has little meaning to me. I just suspect I should have installed something and haven't - this is a brand new virtual machine and this migration is the first of a series I intend to do in order to move off the old one.

Can someone advise what I should have installed and haven't

Thanks

Alan Chandler

Replies (2)

RE: Administration Users function fails - Added by Alan Chandler over 3 years ago

I discovered that if I gave myself a timezone (I am the only user) then the error message changed

Started GET "/users" for 82.14.222.143 at 2014-04-23 13:08:26 +0000
Processing by UsersController#index as HTML
  Current user: alan (id=2)
  Rendered users/index.html.erb within layouts/admin (40.6ms)
Completed 500 Internal Server Error in 63.2ms

ActionView::Template::Error (undefined method `in_time_zone' for 1318238653:Fixnum):
    43:   <td class="email"><%= mail_to(h(user.mail)) %></td>
    44:   <td class="tick"><%= checked_image user.admin? %></td>
    45:   <td class="created_on"><%= format_time(user.created_on) %></td>
    46:   <td class="last_login_on"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
    47:     <td class="buttons">
    48:       <%= change_status_link(user) %>
    49:       <%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %>
  lib/redmine/i18n.rb:70:in `format_time'
  app/views/users/index.html.erb:46:in `block in _app_views_users_index_html_erb__4109866020730747586_60314200'
  app/views/users/index.html.erb:38:in `each'
  app/views/users/index.html.erb:38:in `_app_views_users_index_html_erb__4109866020730747586_60314200'
  app/controllers/users_controller.rb:55:in `block (2 levels) in index'
  app/controllers/users_controller.rb:52:in `index'

now the undefined method is in_time_zone as opposed to utc?

I can see (without really understanding ruby) how that makes sense, because the line in question is


local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)

As far as I can see, this field "time" in question comes out of the database, in app/controllers/users_controller.rb, but I am not sure if I can follow the path any further.

I went back to the old virtual machine where the old version of redmine is sitting, but that has the very same line in i18n.rb, and that one appears to work.

RE: Administration Users function fails [SOLVED] - Added by Alan Chandler over 3 years ago

I have found what the problem is.

Firstly I was wrong about me being the only user. I had forgotten that there where other users who I had set up who either never logged on or only did so once a long time ago. This may be even before I migrated from BTMantis several years ago. I posted some issues with the migration script then.

When I examined the last_logon_time for these old users they had fixed number last logon times.

The thing that may be suspicious was the end of the first line of the error message

ActionView::Template::Error (undefined method `in_time_zone' for 1318238653:Fixnum):

and then finding that that value was for one of these old users.

I deleted these old users from the database and it appears to work.

(1-2/2)