Skip to content

Commit

Permalink
Try to avoid create_resources() function
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Feb 26, 2024
1 parent 226a718 commit c9f74a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
6 changes: 5 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
}

if !empty($programs) {
create_resources(haproxy::program, $programs)
$programs.each |String $program, Hash $attributes| {
Resource['haproxy::program'] { $program:
*=> $attributes,
}
}
}
}

Expand Down
21 changes: 14 additions & 7 deletions manifests/program.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# @summary Program definition
#
# A command to be executed by haproxy master process
#
# @param command
# A command to be executed by haproxy master process
# @param user
# @param group
# @param options
# @param instance
# haproxy instance
# @param config_file
# Path to haproxy config
# @see https://www.haproxy.com/documentation/haproxy-configuration-tutorials/programs/
# @example
# haproxy::program { 'hello':
Expand Down Expand Up @@ -30,11 +37,11 @@
order => "40-program-${name}",
target => $_config_file,
content => epp('haproxy/haproxy_program.epp', {
'name' => $name,
'command' => $command,
'user' => $user,
'group' => $group,
'options' => $options,
'name' => $name,
'command' => $command,
'user' => $user,
'group' => $group,
'options' => $options,
}),
}
}

0 comments on commit c9f74a0

Please sign in to comment.