Skip to content

Commit 43bb932

Browse files
committed
Try to avoid create_resources() function
1 parent 226a718 commit 43bb932

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

manifests/config.pp

+5-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@
8484
}
8585

8686
if !empty($programs) {
87-
create_resources(haproxy::program, $programs)
87+
$programs.each |String $program, Hash $attributes| {
88+
Resource['haproxy::program'] { $program:
89+
*=> $attributes,
90+
}
91+
}
8892
}
8993
}
9094

manifests/program.pp

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# @summary Program definition
22
#
3-
# A command to be executed by haproxy master process
4-
#
3+
# @param command
4+
# A command to be executed by haproxy master process
5+
# @param user
6+
# User account used for executing command
7+
# @param group
8+
# Assigned group
9+
# @param options
10+
# By default, the process manager stops and recreates child programs at haproxy reload.
11+
# In order to disable this, set this parameter to `no option start-on-reload`
12+
# @param instance
13+
# haproxy instance
14+
# @param config_file
15+
# Path to haproxy config
516
# @see https://www.haproxy.com/documentation/haproxy-configuration-tutorials/programs/
617
# @example
718
# haproxy::program { 'hello':
@@ -30,11 +41,11 @@
3041
order => "40-program-${name}",
3142
target => $_config_file,
3243
content => epp('haproxy/haproxy_program.epp', {
33-
'name' => $name,
34-
'command' => $command,
35-
'user' => $user,
36-
'group' => $group,
37-
'options' => $options,
44+
'name' => $name,
45+
'command' => $command,
46+
'user' => $user,
47+
'group' => $group,
48+
'options' => $options,
3849
}),
3950
}
4051
}

0 commit comments

Comments
 (0)