diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-30 10:41:45 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-30 10:41:45 +0200 |
commit | 53ef1de4fcdc7ea0f94ae8fe73f9a2b46e376223 (patch) | |
tree | f465ad9e05aebdc173b311841896b6660256c52d /db/fixtures | |
parent | 68aa43fdbde279b2d990e4108da03c4e6bd8034d (diff) | |
download | gitlab-ce-53ef1de4fcdc7ea0f94ae8fe73f9a2b46e376223.tar.gz |
Fix production admin fixture to use the new `Users::CreateService`
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'db/fixtures')
-rw-r--r-- | db/fixtures/production/001_admin.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb index b37dc794015..1c7c89f7bbd 100644 --- a/db/fixtures/production/001_admin.rb +++ b/db/fixtures/production/001_admin.rb @@ -12,10 +12,12 @@ else user_args[:password] = ENV['GITLAB_ROOT_PASSWORD'] end -user = User.new(user_args) -user.skip_confirmation! +# Only admins can create other admin users in Users::CreateService so to solve +# the chicken-and-egg problem, we pass a non-persisted admin user to the service. +transient_admin = User.new(admin: true) +user = Users::CreateService.new(transient_admin, user_args.merge!(skip_confirmation: true)).execute -if user.save +if user.persisted? puts "Administrator account created:".color(:green) puts puts "login: root".color(:green) |