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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/rietveld/manifests/init.pp
===================================================================
--- a/modules/rietveld/manifests/init.pp
+++ b/modules/rietveld/manifests/init.pp
@@ -2,7 +2,8 @@
$domain,
$certificate,
$private_key,
- $is_default=false
+ $is_default = false,
+ $fixtures = hiera('rietveld::fixtures', {}),
) inherits private::rietveld {
include nginx
@@ -85,4 +86,45 @@
cwd => "${rietveld_home}",
require => Exec['install_rietveld'],
}
+
+ file {"${rietveld_home}/fixtures":
+ ensure => directory,
+ owner => 'rietveld',
+ mode => 0750,
+ require => Exec['install_rietveld'],
+ }
+
+ define fixture(
+ $ensure = present,
+ $source = undef,
+ $content = undef,
+ ) {
+
+ # Note that $script will return EXIT_SUCCESS when the .type is
+ # not recognized - although no action is done then. Thus we enforce
+ # JSON here, which is the default for command "dumpdata" anyway:
+ $script = "${rietveld::rietveld_home}/manage.py"
+ $destination = "${rietveld::rietveld_home}/fixtures/$name.json"
+
+ exec {$destination:
+ command => shellquote($script, 'loaddata', $destination),
+ cwd => $rietveld::rietveld_home,
+ refreshonly => true,
+ user => 'rietveld',
+ }
+
+ file {$destination:
+ ensure => $ensure,
+ content => $content,
+ source => $source,
+ owner => 'rietveld',
+ mode => 0640,
+ notify => $ensure ? {
+ 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
+ default => [],
+ }
+ }
+ }
+
+ create_resources(rietveld::fixture, $fixtures)
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld