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: Created March 20, 2015, 11:28 a.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
@@ -85,4 +85,46 @@
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],
+ default => [],
+ }
+ }
+ }
+
+ $fixtures = hiera('rietveld_fixtures', {})
+ 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