Left: | ||
Right: |
OLD | NEW |
---|---|
(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 } | |
OLD | NEW |