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: New approach based on previous comments Created March 7, 2018, 3:57 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
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 # === Examples:
15 #
16 # filtermaster::repo_download {'exceptionrules':
mathias 2018/03/07 17:44:17 The example section should either vanish or contai
f.lopez 2018/03/07 23:01:48 Acknowledged.
17 # alias => 'exceptions',
18 # }
19 #
20 class sitescripts::formmail(
21 $directory = {},
22 $ensure = 'present',
23 ) {
24
25 include sitescripts
26 include stdlib
27 include spawn_fcgi
28
29 ensure_resource('file', $title, merge({
30 'ensure' => ensure_directory_state($ensure),
31 'path' => "${::sitescripts::directory_path}/formmail",
32 }, $directory))
33
34 $directory_path = getparam(File[$title], 'path')
35 $templates_raw = hiera_hash('sitescripts::formmail::templates', {})
36
37 $templates = parsejson(inline_template('<%= require "json";
mathias 2018/03/07 17:44:17 I will be so happy when the 4.x / future parser re
f.lopez 2018/03/07 23:01:48 Well I'm working on http://hub.eyeo.com/issues/125
38 @templates_raw.map do |key, value|
39 value["path"] ||= "#{@directory_path}/#{key}"
40 ["#{@title}##{key}", value]
41 end.to_h.to_json
42 %>'))
43
44 create_resources('file', $templates, {
45 ensure => ensure_file_state($ensure),
46 tag => 'formmail_template',
47 notify => Service['spawn-fcgi'],
48 })
49
50 File[$title] -> File<|tag == 'formmail_template' |>
51 File[$title] <- File[$::sitescripts::title]
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld