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: Created March 20, 2015, 11:28 a.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 ) inherits private::rietveld { 6 ) inherits private::rietveld {
7 7
8 include nginx 8 include nginx
9 $django_home = '/home/rietveld/django-gae2django' 9 $django_home = '/home/rietveld/django-gae2django'
10 $rietveld_home = "${django_home}/examples/rietveld" 10 $rietveld_home = "${django_home}/examples/rietveld"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ensure => running, 78 ensure => running,
79 hasstatus => false, 79 hasstatus => false,
80 require => [Package['gunicorn'], File['/etc/init.d/rietveld']] 80 require => [Package['gunicorn'], File['/etc/init.d/rietveld']]
81 } 81 }
82 82
83 exec {'set_superuser': 83 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", 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 cwd => "${rietveld_home}", 85 cwd => "${rietveld_home}",
86 require => Exec['install_rietveld'], 86 require => Exec['install_rietveld'],
87 } 87 }
88
89 file {"${rietveld_home}/fixtures":
90 ensure => directory,
91 owner => 'rietveld',
92 mode => 0750,
93 require => Exec['install_rietveld'],
94 }
95
96 define fixture(
97 $ensure = present,
98 $source = undef,
99 $content = undef,
100 ) {
101
102 # Note that $script will return EXIT_SUCCESS when the .type is
103 # not recognized - although no action is done then. Thus we enforce
104 # JSON here, which is the default for command "dumpdata" anyway:
105 $script = "${rietveld::rietveld_home}/manage.py"
106 $destination = "${rietveld::rietveld_home}/fixtures/$name.json"
107
108 exec {$destination:
109 command => shellquote($script, 'loaddata', $destination),
110 cwd => $rietveld::rietveld_home,
111 refreshonly => true,
112 user => 'rietveld',
113 }
114
115 file {$destination:
116 ensure => $ensure,
117 content => $content,
118 source => $source,
119 owner => 'rietveld',
120 mode => 0640,
121 notify => $ensure ? {
122 present => Exec[$destination],
123 default => [],
124 }
125 }
126 }
127
128 $fixtures = hiera('rietveld_fixtures', {})
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