lib/puppet/resource/catalog.rb
def write_resource_file
    # resourcefile contains resources that may be UTF-8 names
    # https://puppet.com/docs/puppet/latest/configuration.html#resourcefile
    resourcefile = Puppet.settings.setting(:resourcefile)
    Puppet::FileSystem.open(resourcefile.value, resourcefile.mode.to_i(8), "w:UTF-8") do |f|
      to_print = resources.map do |resource|
        next unless resource.managed?
        if resource.name_var
          "#{resource.type}[#{resource[resource.name_var]}]"
        else
          "#{resource.ref.downcase}"
        end
      end.compact
      f.puts to_print.join("\n")
    end
  rescue => detail
    Puppet.err _("Could not create resource file %{file}: %{detail}") % { file: Puppet[:resourcefile], detail: detail }
  end
# Store the list of resources we manage
Store the list of resources we manage
Store the list of resources we manage
def write_resource_file
    resourcefile = Puppet.settings.setting(:resourcefile)
    Puppet::FileSystem.open(resourcefile.value, resourcefile.mode.to_i(8), "w:UTF-8") do |f|
      to_print = resources.map do |resource|
        next unless resource.managed?
        if resource.name_var
          "#{resource.type}[#{resource[resource.name_var]}]"
        else
          "#{resource.ref.downcase}"
        end
      end.compact
      f.puts to_print.join("\n")
    end
  rescue => detail
    Puppet.err _("Could not create resource file %{file}: %{detail}") % { file: Puppet[:resourcefile], detail: detail }
  end
def write_resource_file resourcefile = Puppet . settings . setting ( :resourcefile ) Puppet :: FileSystem . open ( resourcefile . value , resourcefile . mode . to_i ( 8 ) , "w:UTF-8" ) do | f | to_print = resources . map do | resource | next unless resource . managed? if resource . name_var "#{resource.type}[#{resource[resource.name_var]}]" else "#{resource.ref.downcase}" end end . compact f . puts to_print . join ( "\n" ) end rescue => detail Puppet . err _ ( "Could not create resource file %{file}: %{detail}" ) % { file : Puppet [ :resourcefile ] , detail : detail } end
Store the list of resources we manage
Store the list of resources we manage
# resourcefile contains resources that may be UTF-8 names # https://puppet.com/docs/puppet/latest/configuration.html#resourcefile