dev/modules/sysconfig/manifests/django_init.pp
changeset 588 8e9ea314e06e
parent 587 a1aa29e7809f
child 593 8156e6e3c503
--- a/dev/modules/sysconfig/manifests/django_init.pp	Thu Feb 27 23:19:13 2014 +0100
+++ b/dev/modules/sysconfig/manifests/django_init.pp	Fri Feb 28 09:55:12 2014 +0100
@@ -1,9 +1,9 @@
 class sysconfig::django_init (
     $superuser_name = hiera('sysconfig::params::superuser_name',$sysconfig::params::superuser_name),
     $superuser_pw   = hiera('sysconfig::params::superuser_pw',$sysconfig::params::superuser_pw)
-){
+) inherits sysconfig::params {
     
-    notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }
+    notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }->
 
     exec { 'syncdb':
         command => '/srv/comt/bin/django syncdb --noinput --migrate',
@@ -17,10 +17,10 @@
     }
 
     exec { 'createsuperuser':
-        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',
+        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",
         cwd     => '/srv/comt',
         user    => 'vagrant',
-        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',
-        require => Exec['syncdb']
+        onlyif  => "/bin/echo \"from django.contrib.auth.models import User; exit(User.objects.filter(username='${superuser_name}').count())\" | /srv/comt/bin/django shell",
+       require => Exec['syncdb']
     }
 }
\ No newline at end of file