Skip to content
Snippets Groups Projects
Select Git revision
  • 94d66be375b108c61bd05fc08b59e87c6d8fc81c
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

encode.c

Blame
  • 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 %>