Select Git revision
postgres.pike
-
Henrik (Grubba) Grubbström authored
Rev: lib/modules/Sql.pmod/postgres.pike:1.15
Henrik (Grubba) Grubbström authoredRev: lib/modules/Sql.pmod/postgres.pike:1.15
unitfile.erb 1.89 KiB
<%#
# Copyright © 2021-2023 Thomas Bellman, Linköping, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
#
-%>
<% resource_ref = "Systemd::%s[%s]" % [ @systemd_resource_type, @title, ]
unit_comments = [@comment].flatten.join("\n").split("\n")
unit_comments.collect! { |cline| "# " + cline }
unit_comments << "\n" if unit_comments.length > 0
-%>
<%= unit_comments.join("\n") -%>
<%# -%>
<%# -%>
<%# Loop over sections ('Unit', 'Service', et.c) -%>
<% @options.sort.each do |section_name, section_options|
next if section_name =~ /^#/
section_comments = (@options['#'+section_name] or []).flatten().
join("\n").split("\n")
-%>
<%= section_comments.collect { |cline| "# " + cline + "\n" }.join("") -%>
[<%= section_name %>]
<%# # Loop over options in section -%>
<% section_options.sort.each do |optname,value| -%>
<%
# Override instead of append to list option.
# This is only valid if called from systemd::unit_options, not when
# called from systemd::unit.
if optname =~ /^-(.*)/
if @systemd_resource_type == 'Unit_options'
optname = $1
-%>
<%= optname %>=
<% elsif @systemd_resource_type == 'Unit'
raise(Puppet::ParseError,
"#{resource_ref}: Bad option name, ``#{optname}''")
else
raise(Puppet::ParseError,
"#{resource_ref}: Internal error: bad value for $systemd_resource_type, ``#{systemd_resource_type}''")
-%>
<% end -%>
<% end -%>
<% next if optname =~ /^#/ -%>
<% opt_comments = (section_options['#'+optname] or []).flatten().
join("\n").split("\n")
-%>
<%= opt_comments.collect { |cline| "# " + cline + "\n" }.join("") -%>
<% [value].flatten.each do |v| -%>
<%= optname %>=<%= v %>
<% end -%>
<% end %>
<% end -%>
# Managed by Puppet: <%= resource_ref %>