tainewoo / redmine_ldap_sync

A redmine plugin to synchronize both users and groups with an ldap server, forked from thorin which is unmaintained.
http://www.redmine.org/plugins/redmine_ldap_sync
GNU General Public License v3.0
17 stars 13 forks source link

NoMethodError undefined method 'fetch' #5

Open yuxinvalo opened 4 years ago

yuxinvalo commented 4 years ago

Hi, think to contribute this plugin, it helps a lot! But there is a problem when I try to test it. Problem reproduce:

  1. I finish configurations
  2. I use a redmine user without group or with group and execute
  3. No thing happened and in the console, I got msg like : image

In redmine production.log :

Rendered plugins/redmine_ldap_sync/app/views/ldap_settings/edit.html.erb within layouts/admin (97.9ms) Rendered admin/_menu.html.erb (9.2ms) Rendering layouts/base.html.erb Rendered layouts/base.html.erb (156.1ms) Completed 200 OK in 435ms (Views: 237.7ms | ActiveRecord: 80.3ms) Started GET "/admin/ldap_sync/base_settings.js" for 127.0.0.1 at 2020-02-26 21:33:44 +0530 Processing by LdapSettingsController#base_settings as JS Current user: admin (id=1) Rendering plugins/redmine_ldap_sync/app/views/ldap_settings/base_settings.js.erb Rendered plugins/redmine_ldap_sync/app/views/ldap_settings/base_settings.js.erb (7.7ms) Completed 200 OK in 123ms (Views: 49.7ms | ActiveRecord: 48.2ms) Started PUT "/admin/ldap_sync/2/test.text" for 127.0.0.1 at 2020-02-26 21:34:00 +0530 Processing by LdapSettingsController#test as TEXT Parameters: {"id"=>"2"} Current user: admin (id=1) Completed 500 Internal Server Error in 81ms (ActiveRecord: 52.7ms)

NoMethodError (undefined method `fetch' for nil:NilClass):

plugins/redmine_ldap_sync/app/controllers/ldap_settings_controller.rb:83:in test' lib/redmine/sudo_mode.rb:65:insudo_mode' plugins/redmine_dmsf/lib/redmine_dmsf/webdav/custom_middleware.rb:72:in `call'

Redmine version: Environment: Redmine version 4.1.0.stable Ruby version 2.4.9-p362 (2019-10-02) [x86_64-linux-gnu] Rails version 5.2.4.1 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.9.3 Mercurial 3.7.3 Cvs 1.12.13 Bazaar 2.7.0 Git 2.24.1 Filesystem
Redmine plugins: redmine_dmsf 2.4.2 redmine_ldap_sync 2.2.0 redmine_omniauth_gitlab 0.0.1

tainewoo commented 4 years ago

Hi,

sorry for late response due to lots of problems these months.

Please check your LDAP settings: Administration - LDAP Authentication Possibly the Account/Password is not set and saved before you tried to perform the LDAP sync test.

MEschenbacher commented 4 years ago

I'm encountering the same issue when trying to test the ldap sync on the ldap sync test panel. Manually synching users with the plugin works fine as well as ldap authentication for users.

However performing an ldap sync test for any existing user results in a similar 500 error:

Started PUT "/admin/ldap_sync/1/test.text" for 2001:db8::1 at 2020-07-13 14:10:23 +0200
Processing by LdapSettingsController#test as TEXT
  Parameters: {"id"=>"1"}
  Current user: myuser (id=164)
Completed 500 Internal Server Error in 14ms (ActiveRecord: 6.0ms)

NoMethodError (undefined method `fetch' for nil:NilClass):

plugins/redmine_ldap_sync/app/controllers/ldap_settings_controller.rb:83:in `test'
lib/redmine/sudo_mode.rb:65:in `sudo_mode'
ghost commented 4 years ago

Same issue : `Completed 500 Internal Server Error in 15ms (ActiveRecord: 2.8ms)

NoMethodError (undefined method `fetch' for nil:NilClass):

plugins/redmine_ldap_sync/app/controllers/ldap_settings_controller.rb:83:in test' LDAP configuration is good, as i can login using my ldap credential. But ldap_sync don't work.

Environment: Redmine version 4.1.1.stable.19939 Ruby version 2.7.0-p0 (2019-12-25) [x86_64-linux-gnu] Rails version 5.2.4.2 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.13.0 Git 2.25.1 Filesystem
Redmine plugins: additionals 2.0.24 redmine_banner 0.3.4 redmine_ldap_sync 2.2.0 redmine_lightbox2 0.5.1 scrum 0.20.0

Tx, Patrice

financelurker commented 3 years ago

same here

Env:

Environment:
  Redmine version                4.2.3.stable
  Ruby version                   2.6.8-p205 (2021-07-07) [x86_64-linux]
  Rails version                  5.2.6
  Environment                    production
  Database adapter               PostgreSQL

when dry-running the sync_users rake task I get the following:

rake redmine:plugins:ldap_sync:sync_users RAILS_ENV=production DRY_RUN=true --trace
** Invoke redmine:plugins:ldap_sync:sync_users (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:plugins:ldap_sync:sync_users

!!! Dry-run execution !!!
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1828: warning: already initialized constant User::HABTM_Groups
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1828: warning: previous definition of HABTM_Groups was here
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1828: warning: already initialized constant Group::HABTM_Users
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1828: warning: previous definition of HABTM_Users was here
Synchronizing '... LDAP' users...
-- Found 15 users active, 0 locked and 0 deleted on ldap
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Could not create user '...': ""
-- Updating user 'mark.weiss' (Mark Weiss)...
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "users_users" does not exist
LINE 1: SELECT "users".* FROM "users" INNER JOIN "users_users" ON "u...
                                                 ^
: SELECT "users".* FROM "users" INNER JOIN "users_users" ON "users"."id" = "users_users"."group_id" WHERE "users"."type" IN ('Group', 'GroupBuiltin', 'GroupAnonymous', 'GroupNonMember') AND "users_users"."user_id" = $1
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `exec_params'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `block (2 levels) in exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:610:in `block in exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log'
/.../ruby/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:609:in `exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `execute_and_clear'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:81:in `exec_query'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:478:in `select'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:70:in `select_all'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:106:in `select_all'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/querying.rb:41:in `find_by_sql'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:560:in `block in exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:584:in `skip_query_cache_if_necessary'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:547:in `exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/association_relation.rb:34:in `exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:422:in `load'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:200:in `records'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:195:in `to_ary'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_association.rb:306:in `find_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/has_many_through_association.rb:211:in `find_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_association.rb:272:in `load_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_proxy.rb:46:in `load_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_proxy.rb:1004:in `records'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:133:in `map'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:133:in `groups_changes'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:167:in `sync_user_groups'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:118:in `block in sync_user'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:376:in `with_ldap_connection'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:105:in `sync_user'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:97:in `block (2 levels) in sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:95:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:95:in `block in sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:386:in `block in with_ldap_connection'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap.rb:716:in `block in open'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap/instrumentation.rb:19:in `instrument'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap.rb:711:in `open'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:384:in `with_ldap_connection'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:64:in `sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/tasks/ldap_sync.rake:29:in `block (5 levels) in <top (required)>'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/tasks/ldap_sync.rake:27:in `block (4 levels) in <top (required)>'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/.../ruby/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/.../ruby/bin/rake:23:in `load'
/.../ruby/bin/rake:23:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "users_users" does not exist
LINE 1: SELECT "users".* FROM "users" INNER JOIN "users_users" ON "u...
                                                 ^
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `exec_params'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `block (2 levels) in exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:610:in `block in exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log'
/.../ruby/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log'
/.../ruby/lib/ruby/gems/2.6.0/gems/activesupport-5.2.6/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:609:in `exec_no_cache'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `execute_and_clear'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:81:in `exec_query'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:478:in `select'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:70:in `select_all'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:106:in `select_all'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/querying.rb:41:in `find_by_sql'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:560:in `block in exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:584:in `skip_query_cache_if_necessary'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:547:in `exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/association_relation.rb:34:in `exec_queries'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:422:in `load'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:200:in `records'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:195:in `to_ary'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_association.rb:306:in `find_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/has_many_through_association.rb:211:in `find_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_association.rb:272:in `load_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_proxy.rb:46:in `load_target'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/associations/collection_proxy.rb:1004:in `records'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:133:in `map'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:133:in `groups_changes'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:167:in `sync_user_groups'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:118:in `block in sync_user'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:376:in `with_ldap_connection'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:105:in `sync_user'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:97:in `block (2 levels) in sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:95:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:95:in `block in sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:386:in `block in with_ldap_connection'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap.rb:716:in `block in open'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap/instrumentation.rb:19:in `instrument'
/.../ruby/lib/ruby/gems/2.6.0/gems/net-ldap-0.17.0/lib/net/ldap.rb:711:in `open'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/entity_manager.rb:384:in `with_ldap_connection'
/.../redmine/plugins/redmine_ldap_sync/lib/ldap_sync/infectors/auth_source_ldap.rb:64:in `sync_users'
/.../redmine/plugins/redmine_ldap_sync/lib/tasks/ldap_sync.rake:29:in `block (5 levels) in <top (required)>'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:71:in `each'
/.../redmine/plugins/redmine_ldap_sync/lib/tasks/ldap_sync.rake:27:in `block (4 levels) in <top (required)>'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/.../ruby/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/.../ruby/lib/ruby/gems/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/.../ruby/bin/rake:23:in `load'
/.../ruby/bin/rake:23:in `<main>'
Tasks: TOP => redmine:plugins:ldap_sync:sync_users

Which seems odd, because I've previously executed rake redmine:plugins:migrate RAILS_ENV=production (although there was no output when executing this statement).

Btw: my LDAP authentication configuration is working - users can log in and the users are created at first login. So, the communication Redmine<>LDAP is working and should not be the cause of this.

I've tried to migrate down and up again:

root@redmine-5fd869ff68-trhpp:/.../redmine# bundle exec rake redmine:plugins:migrate NAME=redmine_ldap_sync VERSION=0 RAILS_ENV=production
== 20170524063056 RenameAccountDisabledTest: reverting ========================
-- Updating settings for '... LDAP'
   -> 0.0040s
== 20170524063056 RenameAccountDisabledTest: reverted (0.0676s) ===============

== 201503252355 AddUsersSearchScope: reverting ================================
== 201503252355 AddUsersSearchScope: reverted (0.0000s) =======================

== 201302212308 EnableSyncOnLogin: reverting ==================================
== 201302212308 EnableSyncOnLogin: reverted (0.0000s) =========================

== 201302202301 ChangeSettingIdFromNameToAuthSourceId: reverting ==============
-- Updating settings for '... LDAP'
   -> 0.0029s
== 201302202301 ChangeSettingIdFromNameToAuthSourceId: reverted (0.0058s) =====

== 201302052050 UpdateUserGroupFields: reverting ==============================
== 201302052050 UpdateUserGroupFields: reverted (0.0000s) =====================

== 201211202050 UpdateCheckBoxValues: reverting ===============================
== 201211202050 UpdateCheckBoxValues: reverted (0.0000s) ======================

== 201202082153 AddAccountFlagsSetting: reverting =============================
== 201202082153 AddAccountFlagsSetting: reverted (0.0000s) ====================

== 201201302250 RemoveAttrPrefixSettings: reverting ===========================
-- Updating settings for '... LDAP'
   -> 0.0048s
== 201201302250 RemoveAttrPrefixSettings: reverted (0.0083s) ==================

== 201201291950 RenameMustBeMemberOfAndAddToGroupSettings: reverting ==========
-- Updating settings for '... LDAP'
   -> 0.0048s
== 201201291950 RenameMustBeMemberOfAndAddToGroupSettings: reverted (0.0083s) =

== 201201071359 UpdateAttributesToSync: reverting =============================
== 201201071359 UpdateAttributesToSync: reverted (0.0000s) ====================

== 201201010043 CreateLdapCacheDir: reverting =================================
== 201201010043 CreateLdapCacheDir: reverted (0.0000s) ========================

== 201111271700 AddGroupMembershipSetting: reverting ==========================
== 201111271700 AddGroupMembershipSetting: reverted (0.0000s) =================

== 201110050735 AddUserMemberidSetting: reverting =============================
== 201110050735 AddUserMemberidSetting: reverted (0.0000s) ====================

== 201108021245 ChangeSettingsName: reverting =================================
== 201108021245 ChangeSettingsName: reverted (0.0000s) ========================

root@redmine-5fd869ff68-trhpp:/.../redmine# bundle exec rake redmine:plugins:migrate NAME=redmine_ldap_sync RAILS_ENV=production
== 201108021245 ChangeSettingsName: migrating =================================
-- Updating settings for '... LDAP'
   -> 0.0052s
== 201108021245 ChangeSettingsName: migrated (0.0657s) ========================

== 201110050735 AddUserMemberidSetting: migrating =============================
-- Updating settings for '... LDAP'
   -> 0.0048s
== 201110050735 AddUserMemberidSetting: migrated (0.0086s) ====================

== 201111271700 AddGroupMembershipSetting: migrating ==========================
-- Updating settings for '... LDAP'
   -> 0.0043s
== 201111271700 AddGroupMembershipSetting: migrated (0.0081s) =================

== 201201010043 CreateLdapCacheDir: migrating =================================
-- Creating path '/.../redmine/tmp/ldap_cache'
   -> 0.0001s
== 201201010043 CreateLdapCacheDir: migrated (0.0002s) ========================

== 201201071359 UpdateAttributesToSync: migrating =============================
-- Updating settings for '... LDAP'
   -> 0.0041s
== 201201071359 UpdateAttributesToSync: migrated (0.0082s) ====================

== 201201291950 RenameMustBeMemberOfAndAddToGroupSettings: migrating ==========
-- Updating settings for '... LDAP'
   -> 0.0055s
== 201201291950 RenameMustBeMemberOfAndAddToGroupSettings: migrated (0.0094s) =

== 201201302250 RemoveAttrPrefixSettings: migrating ===========================
-- Updating settings for '... LDAP'
   -> 0.0055s
== 201201302250 RemoveAttrPrefixSettings: migrated (0.0100s) ==================

== 201202082153 AddAccountFlagsSetting: migrating =============================
-- Updating settings for '... LDAP'
   -> 0.0058s
== 201202082153 AddAccountFlagsSetting: migrated (0.0101s) ====================

== 201211202050 UpdateCheckBoxValues: migrating ===============================
-- Updating settings for '... LDAP'
   -> 0.0058s
== 201211202050 UpdateCheckBoxValues: migrated (0.0105s) ======================

== 201302052050 UpdateUserGroupFields: migrating ==============================
-- Updating settings for '... LDAP'
   -> 0.0046s
== 201302052050 UpdateUserGroupFields: migrated (0.0079s) =====================

== 201302202301 ChangeSettingIdFromNameToAuthSourceId: migrating ==============
-- Updating settings for '... LDAP'
   -> 0.0041s
== 201302202301 ChangeSettingIdFromNameToAuthSourceId: migrated (0.0073s) =====

== 201302212308 EnableSyncOnLogin: migrating ==================================
-- Updating settings for '... LDAP'
   -> 0.0043s
== 201302212308 EnableSyncOnLogin: migrated (0.0088s) =========================

== 201503252355 AddUsersSearchScope: migrating ================================
-- Updating settings for '... LDAP'
   -> 0.0041s
== 201503252355 AddUsersSearchScope: migrated (0.0090s) =======================

== 20170524063056 RenameAccountDisabledTest: migrating ========================
-- Updating settings for '... LDAP'
   -> 0.0059s
== 20170524063056 RenameAccountDisabledTest: migrated (0.0108s) ===============

But the result is the same...