4 $path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', $sysconfig::params::path_to_virtualenv ) |
4 $path_to_virtualenv = hiera('sysconfig::params::path_to_virtualenv', $sysconfig::params::path_to_virtualenv ) |
5 ) inherits sysconfig::params { |
5 ) inherits sysconfig::params { |
6 |
6 |
7 notify {'django_init': name => "django init \$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> |
7 notify {'django_init': name => "django init \$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> |
8 |
8 |
9 exec { 'syncdb': |
9 exec { 'syncdb_without_south': |
10 command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput", |
10 command => "/usr/bin/python /srv/spel/dev/files/settings_south_syncdb.py -i /srv/spel/src/spel/settings.py && . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput", |
11 cwd => '/srv/spel/src', |
11 cwd => '/srv/spel/src', |
12 user => 'vagrant', |
12 user => 'vagrant', |
13 provider => 'shell' |
13 provider => 'shell'; |
|
14 } |
|
15 exec { 'syncdb_with_south': |
|
16 command => "/usr/bin/python /srv/spel/dev/files/settings_south_syncdb.py -r -i /srv/spel/src/spel/settings.py && . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py syncdb --noinput", |
|
17 cwd => '/srv/spel/src', |
|
18 user => 'vagrant', |
|
19 provider => 'shell', |
|
20 require => Exec['syncdb_without_south']; |
|
21 } |
|
22 exec { 'tricking_manage_py': |
|
23 command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py migrate --fake", |
|
24 cwd => '/srv/spel/src', |
|
25 user => 'vagrant', |
|
26 provider => 'shell', |
|
27 require => Exec['syncdb_with_south']; |
14 } |
28 } |
15 |
29 |
16 exec { 'loaddata': |
30 exec { 'loaddata': |
17 command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py loaddata roles_generic", |
31 command => ". ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py loaddata roles_generic", |
18 cwd => '/srv/spel/src', |
32 cwd => '/srv/spel/src', |
19 user => 'vagrant', |
33 user => 'vagrant', |
20 provider => 'shell', |
34 provider => 'shell', |
21 require => Exec['syncdb'] |
35 require => Exec['tricking_manage_py'] |
22 } |
36 } |
23 |
37 |
24 exec { 'createsuperuser': |
38 exec { 'createsuperuser': |
25 command => "/bin/echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${superuser_name}', 'admin@example.com', '${superuser_pw}')\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell", |
39 command => "/bin/echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${superuser_name}', 'admin@example.com', '${superuser_pw}')\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell", |
26 cwd => '/srv/spel/src', |
40 cwd => '/srv/spel/src', |
27 user => 'vagrant', |
41 user => 'vagrant', |
28 provider => 'shell', |
42 provider => 'shell', |
29 onlyif => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell", |
43 onlyif => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | . ${path_to_virtualenv}/bin/activate && ${path_to_virtualenv}/bin/python manage.py shell", |
30 require => Exec['syncdb'] |
44 require => Exec['tricking_manage_py'] |
31 } |
45 } |
32 |
46 |
33 } |
47 } |