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

Side by Side Diff: modules/sitescripts/manifests/formmail.pp

Issue 29438564: #301 - Provision formmail templates with absolute paths (Closed)
Patch Set: For comments 7 and 8 Created March 7, 2018, 11:08 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 | « hiera/roles/web/acceptableads.yaml ('k') | modules/sitescripts/manifests/init.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Class: sitescripts::formmail
2 #
3 # Manage formmail templates resources.
4 #
5 # === Parameters:
6 #
7 # [*directory*]
8 # Custom parameter for formmail templates' directory.
9 #
10 # [*ensure*]
11 # General target policy for Puppet resources, supported values include
12 # "present", "latest", "absent" and "purged"
13 #
14 class sitescripts::formmail(
15 $directory = {},
16 $ensure = 'present',
17 ) {
18
19 include sitescripts
20 include stdlib
21 include spawn_fcgi
22
23 ensure_resource('file', $title, merge({
24 'ensure' => ensure_directory_state($ensure),
25 'path' => "${::sitescripts::directory_path}/formmail",
26 }, $directory))
27
28 $directory_path = getparam(File[$title], 'path')
29 $templates_raw = hiera_hash('sitescripts::formmail::templates', {})
30
31 $templates = parsejson(inline_template('<%= require "json";
32 @templates_raw.map do |key, value|
33 value["path"] ||= "#{@directory_path}/#{key}"
34 ["#{@title}##{key}", value]
35 end.to_h.to_json
36 %>'))
37
38 create_resources('file', $templates, {
39 ensure => ensure_file_state($ensure),
40 tag => 'formmail_template',
41 notify => Service['spawn-fcgi'],
42 })
43
44 File[$title] -> File<|tag == 'formmail_template' |>
45 File[$title] <- File[$::sitescripts::title]
46 }
OLDNEW
« no previous file with comments | « hiera/roles/web/acceptableads.yaml ('k') | modules/sitescripts/manifests/init.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld