| 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) |
| } |