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

Delta Between Two Patch Sets: modules/sitescripts/manifests/formmail.pp

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

Powered by Google App Engine
This is Rietveld