diff options
author | Harish Ramachandran <harish@gitlab.com> | 2019-07-26 12:20:17 -0400 |
---|---|---|
committer | Harish Ramachandran <harish@gitlab.com> | 2019-07-26 12:20:17 -0400 |
commit | d42fa7e201f40848b721ccb1a79e5c267703fa8b (patch) | |
tree | ff866b2e90447f7a7c0383a648a2d5ea09fa8fd1 /ee/lib | |
parent | b35fc437d20d67878a8c6175322daeba4afbe445 (diff) | |
download | gitlab-ce-d42fa7e201f40848b721ccb1a79e5c267703fa8b.tar.gz |
Refactor rake task for easier readability
Diffstat (limited to 'ee/lib')
-rw-r--r-- | ee/lib/tasks/gitlab/ldap.rake | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/ee/lib/tasks/gitlab/ldap.rake b/ee/lib/tasks/gitlab/ldap.rake index 0e1416acf48..7ea20df1327 100644 --- a/ee/lib/tasks/gitlab/ldap.rake +++ b/ee/lib/tasks/gitlab/ldap.rake @@ -2,20 +2,16 @@ namespace :gitlab do namespace :ldap do desc 'GitLab | LDAP | Run a GroupSync' task group_sync: :gitlab_environment do - if Gitlab::Auth::LDAP::Config.group_sync_enabled? - $stdout.puts 'LDAP GroupSync is enabled.' - $stdout.puts 'Starting GroupSync...' - - begin - EE::Gitlab::Auth::LDAP::Sync::Groups.execute - $stdout.puts 'Finished GroupSync.' - rescue => exception - warn "The GroupSync failed with the following error: #{exception}" - end - - else + if !Gitlab::Auth::LDAP::Config.group_sync_enabled? $stdout.puts 'LDAP GroupSync is not enabled.' + exit 1 end + + $stdout.puts 'LDAP GroupSync is enabled.' + $stdout.puts 'Starting GroupSync...' + + EE::Gitlab::Auth::LDAP::Sync::Groups.execute + $stdout.puts 'Finished GroupSync.' end end end |