Commit 5203965684a607935b68a3db1c34b5872e47cc0a
1 parent
c619706f
Exists in
master
and in
89 other branches
Verify if gitlab admin already exists
Using not_if to verify if the user exists Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
cookbooks/colab/recipes/default.rb
| ... | ... | @@ -76,6 +76,12 @@ execute 'create-admin-token-gitlab' do |
| 76 | 76 | |
| 77 | 77 | command "RAILS_ENV=production bundle exec rails runner \"User.create(name: \'#{name}\', username: \'#{name}\', email: \'#{email}\', password: \'#{password}\', admin: \'true\')\"" |
| 78 | 78 | |
| 79 | + user_exist = Dir.chdir '/usr/lib/gitlab' do | |
| 80 | + `RAILS_ENV=production bundle exec rails runner \"puts User.find_by_email(\'admin-gitlab@admin.com\').nil?\"`.strip | |
| 81 | + end | |
| 82 | + | |
| 83 | + not_if {user_exist == "false"} | |
| 84 | + | |
| 79 | 85 | cwd '/usr/lib/gitlab' |
| 80 | 86 | user 'git' |
| 81 | 87 | end | ... | ... |