Commit c619706f514b1ca0a56cc76ecd4a274301aedaef
Committed by
Luciano Prestes
1 parent
e85beced
Exists in
master
and in
89 other branches
Creating colab user for gitlab indexing
Changing the way the colab user was created by changing the approach to using a json file together with the command colab-admin loaddata Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
2 changed files
with
25 additions
and
4 deletions
Show diff stats
cookbooks/colab/recipes/default.rb
| @@ -53,12 +53,20 @@ template '/etc/colab/settings.d/00-database.yaml' do | @@ -53,12 +53,20 @@ template '/etc/colab/settings.d/00-database.yaml' do | ||
| 53 | notifies :restart, 'service[colab]' | 53 | notifies :restart, 'service[colab]' |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | -execute 'create-admin-token-colab' do | ||
| 57 | - user = "admin-gitlab" | ||
| 58 | - email = "admin-gitlab@admin.com" | 56 | +template '/tmp/admin-gitlab.json' do |
| 57 | + | ||
| 59 | password = SecureRandom.random_number.to_s | 58 | password = SecureRandom.random_number.to_s |
| 60 | 59 | ||
| 61 | - command "echo \"from colab.accounts.models import User; User.objects.create_superuser(\'#{user}\', \'#{email}\', \'#{password}\')\" | colab-admin shell" | 60 | + variables( |
| 61 | + :password => password | ||
| 62 | + ) | ||
| 63 | +end | ||
| 64 | + | ||
| 65 | +execute 'create-admin-token-colab' do | ||
| 66 | + command "colab-admin loaddata admin-gitlab.json" | ||
| 67 | + | ||
| 68 | + cwd '/tmp' | ||
| 69 | + user 'root' | ||
| 62 | end | 70 | end |
| 63 | 71 | ||
| 64 | execute 'create-admin-token-gitlab' do | 72 | execute 'create-admin-token-gitlab' do |
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +[ | ||
| 2 | + { | ||
| 3 | + "model": "accounts.user", | ||
| 4 | + "fields": { | ||
| 5 | + "username": "admin-gitlab", | ||
| 6 | + "first_name": "Admin", | ||
| 7 | + "last_name": "Gitlab", | ||
| 8 | + "email": "admin-gitlab@admin.com", | ||
| 9 | + "password": "<%= @password %>", | ||
| 10 | + "modified": "2015-06-11 14:22:00.332432+00" | ||
| 11 | + } | ||
| 12 | + } | ||
| 13 | +] | ||
| 0 | \ No newline at end of file | 14 | \ No newline at end of file |