Method: Puppet::Util::Settings#to_config

Defined in:
lib/vendor/puppet/util/settings.rb

#to_configObject

Convert our list of config settings into a configuration file.



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/vendor/puppet/util/settings.rb', line 567

def to_config
  str = %{The configuration file for #{Puppet[:name]}.  Note that this file
is likely to have unused configuration parameters in it; any parameter that's
valid anywhere in Puppet can be in any config file, even if it's not used.

Every section can specify three special parameters: owner, group, and mode.
These parameters affect the required permissions of any files specified after
their specification.  Puppet will sometimes use these parameters to check its
own configured state, so they can be used to make Puppet a bit more self-managing.

Generated on #{Time.now}.

}.gsub(/^/, "# ")

#         Add a section heading that matches our name.
if @config.include?(:run_mode)
str += "[#{self[:run_mode]}]\n"
  end
  eachsection do |section|
    persection(section) do |obj|
      str += obj.to_config + "\n" unless ReadOnly.include? obj.name or obj.name == :genconfig
    end
  end

  return str
end