equal
deleted
inserted
replaced
1 class sysconfig::django_init ( |
1 class sysconfig::django_init ( |
2 $superuser_name = hiera('sysconfig::params::superuser_name',$sysconfig::params::superuser_name), |
2 $superuser_name = hiera('sysconfig::params::superuser_name',$sysconfig::params::superuser_name), |
3 $superuser_pw = hiera('sysconfig::params::superuser_pw',$sysconfig::params::superuser_pw) |
3 $superuser_pw = hiera('sysconfig::params::superuser_pw',$sysconfig::params::superuser_pw) |
4 ){ |
4 ) inherits sysconfig::params { |
5 |
5 |
6 notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true } |
6 notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> |
7 |
7 |
8 exec { 'syncdb': |
8 exec { 'syncdb': |
9 command => '/srv/comt/bin/django syncdb --noinput --migrate', |
9 command => '/srv/comt/bin/django syncdb --noinput --migrate', |
10 user => 'vagrant' |
10 user => 'vagrant' |
11 } |
11 } |
15 user => 'vagrant', |
15 user => 'vagrant', |
16 require => Exec['syncdb'] |
16 require => Exec['syncdb'] |
17 } |
17 } |
18 |
18 |
19 exec { 'createsuperuser': |
19 exec { 'createsuperuser': |
20 command => '/bin/echo "from django.contrib.auth.models import User; User.objects.create_superuser(\'$superuser_name\', \'admin@example.com\', \'$superuser_pw\')" | /srv/comt/bin/django shell', |
20 command => "/bin/echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${superuser_name}', 'admin@example.com', '${superuser_pw}')\" | /srv/comt/bin/django shell", |
21 cwd => '/srv/comt', |
21 cwd => '/srv/comt', |
22 user => 'vagrant', |
22 user => 'vagrant', |
23 unless => '/bin/echo "from django.contrib.auth.models import User; exit(0) if User.objects.filter(username=\'$superuser_name\').count() else exit(1)" | /srv/comt/bin/django shell', |
23 onlyif => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | /srv/comt/bin/django shell", |
24 require => Exec['syncdb'] |
24 require => Exec['syncdb'] |
25 } |
25 } |
26 } |
26 } |