Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-04-13 12:50:00 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-04-13 12:50:00 +0300
commit8b4705fea6297a23f708c59cbce3c8a3115128c0 (patch)
tree8c13a7e6649d9a07d6aa751390453760836fa121 /db/migrate
parentf64db1fab95751bc2b1cf04641bb031d6289d16b (diff)
Make migration work if LDAP is disabled
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20150411000035_fix_identities.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb
index b65ad138b0f..297e7eaa5e9 100644
--- a/db/migrate/20150411000035_fix_identities.rb
+++ b/db/migrate/20150411000035_fix_identities.rb
@@ -9,9 +9,14 @@ class FixIdentities < ActiveRecord::Migration
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
- new_provider = Gitlab.config.ldap.servers.first.last['provider_name']
+ new_provider = if Gitlab.config.ldap.enabled
+ first_ldap_server = Gitlab.config.ldap.servers.values.first
+ first_ldap_server['provider_name']
+ else
+ 'ldapmain'
+ end
- # Delete duplicate identities
+ # Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities