Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/rietveld/manifests/init.pp

Issue 6389439060246528: Issue 2186 - Integrate Django fixture upload with Rietveld (Closed)
Patch Set: Issue 2186 - Integrate Django fixture upload with Rietveld Created March 20, 2015, 12:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 class rietveld( 1 class rietveld(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $is_default=false 5 $is_default = false,
6 $fixtures = hiera('rietveld::fixtures', {}),
6 ) inherits private::rietveld { 7 ) inherits private::rietveld {
7 8
8 include nginx 9 include nginx
9 $django_home = '/home/rietveld/django-gae2django' 10 $django_home = '/home/rietveld/django-gae2django'
10 $rietveld_home = "${django_home}/examples/rietveld" 11 $rietveld_home = "${django_home}/examples/rietveld"
11 12
12 Exec { 13 Exec {
13 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 14 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
14 } 15 }
15 16
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ensure => running, 79 ensure => running,
79 hasstatus => false, 80 hasstatus => false,
80 require => [Package['gunicorn'], File['/etc/init.d/rietveld']] 81 require => [Package['gunicorn'], File['/etc/init.d/rietveld']]
81 } 82 }
82 83
83 exec {'set_superuser': 84 exec {'set_superuser':
84 command => "echo \"from django.db import DEFAULT_DB_ALIAS as database; from django.contrib.auth.models import User; User.objects.db_manager(database).create _superuser('admin', 'admins@adblockplus.org', '${admin_password}')\" | ./manage. py shell", 85 command => "echo \"from django.db import DEFAULT_DB_ALIAS as database; from django.contrib.auth.models import User; User.objects.db_manager(database).create _superuser('admin', 'admins@adblockplus.org', '${admin_password}')\" | ./manage. py shell",
85 cwd => "${rietveld_home}", 86 cwd => "${rietveld_home}",
86 require => Exec['install_rietveld'], 87 require => Exec['install_rietveld'],
87 } 88 }
89
90 file {"${rietveld_home}/fixtures":
91 ensure => directory,
92 owner => 'rietveld',
93 mode => 0750,
94 require => Exec['install_rietveld'],
95 }
96
97 define fixture(
98 $ensure = present,
99 $source = undef,
100 $content = undef,
101 ) {
102
103 # Note that $script will return EXIT_SUCCESS when the .type is
104 # not recognized - although no action is done then. Thus we enforce
105 # JSON here, which is the default for command "dumpdata" anyway:
106 $script = "${rietveld::rietveld_home}/manage.py"
107 $destination = "${rietveld::rietveld_home}/fixtures/$name.json"
108
109 exec {$destination:
110 command => shellquote($script, 'loaddata', $destination),
111 cwd => $rietveld::rietveld_home,
112 refreshonly => true,
113 user => 'rietveld',
114 }
115
116 file {$destination:
117 ensure => $ensure,
118 content => $content,
119 source => $source,
120 owner => 'rietveld',
121 mode => 0640,
122 notify => $ensure ? {
123 present => Exec[$destination],
Felix Dahlke 2015/03/21 21:08:52 So, when the fixture changes, the loaddata call is
mathias 2015/03/21 23:16:47 Indeed it does. Of course this is still not meant
124 default => [],
125 }
126 }
127 }
128
129 create_resources(rietveld::fixture, $fixtures)
88 } 130 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld