@@ -39,7 +39,11 @@ def self.valid_file_checksum_types
3939
4040 AS_DURATION = %q{This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).}
4141
42- define_settings ( :main ,
42+ # @api public
43+ # @param args [Puppet::Settings] the settings object to define default settings for
44+ # @return void
45+ def self . initialize_default_settings! ( settings )
46+ settings . define_settings ( :main ,
4347 :confdir => {
4448 :default => nil ,
4549 :type => :directory ,
@@ -76,7 +80,7 @@ def self.valid_file_checksum_types
7680 }
7781 )
7882
79- define_settings ( :main ,
83+ settings . define_settings ( :main ,
8084 :logdir => {
8185 :default => nil ,
8286 :type => :directory ,
@@ -167,7 +171,7 @@ def self.valid_file_checksum_types
167171 }
168172 )
169173
170- define_settings ( :main ,
174+ settings . define_settings ( :main ,
171175 :priority => {
172176 :default => nil ,
173177 :type => :priority ,
@@ -488,12 +492,12 @@ def self.valid_file_checksum_types
488492 :hiera_config => {
489493 :default => lambda do
490494 config = nil
491- codedir = Puppet . settings [ :codedir ]
495+ codedir = settings [ :codedir ]
492496 if codedir . is_a? ( String )
493497 config = File . expand_path ( File . join ( codedir , 'hiera.yaml' ) )
494498 config = nil unless Puppet ::FileSystem . exist? ( config )
495499 end
496- config = File . expand_path ( File . join ( Puppet . settings [ :confdir ] , 'hiera.yaml' ) ) if config . nil?
500+ config = File . expand_path ( File . join ( settings [ :confdir ] , 'hiera.yaml' ) ) if config . nil?
497501 config
498502 end ,
499503 :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it." ,
@@ -547,7 +551,7 @@ def self.valid_file_checksum_types
547551 :http_proxy_password => {
548552 :default => "none" ,
549553 :hook => proc do |value |
550- if Puppet . settings [ :http_proxy_password ] =~ /[@!# \/ ]/
554+ if settings [ :http_proxy_password ] =~ /[@!# \/ ]/
551555 raise "Passwords set in the http_proxy_password setting must be valid as part of a URL, and any reserved characters must be URL-encoded. We received: #{ value } "
552556 end
553557 end ,
@@ -677,7 +681,7 @@ def self.valid_file_checksum_types
677681 }
678682 )
679683
680- define_settings ( :main ,
684+ settings . define_settings ( :main ,
681685 # Whether the application management feature is on or off - now deprecated and always on.
682686 :app_management => {
683687 :default => false ,
@@ -687,7 +691,7 @@ def self.valid_file_checksum_types
687691 }
688692 )
689693
690- Puppet . define_settings ( :module_tool ,
694+ settings . define_settings ( :module_tool ,
691695 :module_repository => {
692696 :default => 'https://forgeapi.puppet.com' ,
693697 :desc => "The module repository" ,
@@ -710,7 +714,7 @@ def self.valid_file_checksum_types
710714 }
711715 )
712716
713- Puppet . define_settings (
717+ settings . define_settings (
714718 :main ,
715719
716720 # We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
@@ -1002,7 +1006,7 @@ def self.valid_file_checksum_types
10021006 }
10031007 )
10041008
1005- define_settings (
1009+ settings . define_settings (
10061010 :ca ,
10071011 :ca_name => {
10081012 :default => "Puppet CA: $certname" ,
@@ -1150,7 +1154,7 @@ def self.valid_file_checksum_types
11501154
11511155 # Define the config default.
11521156
1153- define_settings ( :application ,
1157+ settings . define_settings ( :application ,
11541158 :config_file_name => {
11551159 :type => :string ,
11561160 :default => Puppet ::Settings . default_config_file_name ,
@@ -1180,7 +1184,7 @@ def self.valid_file_checksum_types
11801184 }
11811185 )
11821186
1183- define_settings ( :environment ,
1187+ settings . define_settings ( :environment ,
11841188 :manifest => {
11851189 :default => nil ,
11861190 :type => :file_or_directory ,
@@ -1223,7 +1227,7 @@ def self.valid_file_checksum_types
12231227 }
12241228 )
12251229
1226- define_settings ( :master ,
1230+ settings . define_settings ( :master ,
12271231 :user => {
12281232 :default => "puppet" ,
12291233 :desc => "The user Puppet Server will run as. Used to ensure
@@ -1435,7 +1439,7 @@ def self.valid_file_checksum_types
14351439 }
14361440 )
14371441
1438- define_settings ( :device ,
1442+ settings . define_settings ( :device ,
14391443 :devicedir => {
14401444 :default => "$vardir/devices" ,
14411445 :type => :directory ,
@@ -1450,7 +1454,7 @@ def self.valid_file_checksum_types
14501454 }
14511455 )
14521456
1453- define_settings ( :agent ,
1457+ settings . define_settings ( :agent ,
14541458 :node_name_value => {
14551459 :default => "$certname" ,
14561460 :desc => "The explicit value used for the node name for all requests the agent
@@ -1836,7 +1840,7 @@ def self.valid_file_checksum_types
18361840
18371841 # Plugin information.
18381842
1839- define_settings (
1843+ settings . define_settings (
18401844 :main ,
18411845 :plugindest => {
18421846 :type => :directory ,
@@ -1890,7 +1894,7 @@ def self.valid_file_checksum_types
18901894
18911895 # Central fact information.
18921896
1893- define_settings (
1897+ settings . define_settings (
18941898 :main ,
18951899 :factpath => {
18961900 :type => :path ,
@@ -1907,7 +1911,7 @@ def self.valid_file_checksum_types
19071911 }
19081912 )
19091913
1910- define_settings (
1914+ settings . define_settings (
19111915 :transaction ,
19121916 :tags => {
19131917 :default => "" ,
@@ -1935,7 +1939,7 @@ def self.valid_file_checksum_types
19351939 }
19361940 )
19371941
1938- define_settings (
1942+ settings . define_settings (
19391943 :main ,
19401944 :external_nodes => {
19411945 :default => "none" ,
@@ -1960,7 +1964,7 @@ def self.valid_file_checksum_types
19601964 }
19611965 )
19621966
1963- define_settings (
1967+ settings . define_settings (
19641968 :ldap ,
19651969 :ldapssl => {
19661970 :default => false ,
@@ -2029,7 +2033,7 @@ def self.valid_file_checksum_types
20292033 }
20302034 )
20312035
2032- define_settings ( :master ,
2036+ settings . define_settings ( :master ,
20332037 :storeconfigs => {
20342038 :default => false ,
20352039 :type => :boolean ,
@@ -2062,7 +2066,7 @@ def self.valid_file_checksum_types
20622066 }
20632067 )
20642068
2065- define_settings ( :parser ,
2069+ settings . define_settings ( :parser ,
20662070 :max_errors => {
20672071 :default => 10 ,
20682072 :desc => <<-'EOT'
@@ -2104,7 +2108,7 @@ def self.valid_file_checksum_types
21042108 EOT
21052109 }
21062110 )
2107- define_settings ( :puppetdoc ,
2111+ settings . define_settings ( :puppetdoc ,
21082112 :document_all => {
21092113 :default => false ,
21102114 :type => :boolean ,
@@ -2113,7 +2117,7 @@ def self.valid_file_checksum_types
21132117 }
21142118 )
21152119
2116- define_settings (
2120+ settings . define_settings (
21172121 :main ,
21182122 :rich_data => {
21192123 :default => false ,
@@ -2130,5 +2134,5 @@ def self.valid_file_checksum_types
21302134 EOT
21312135 }
21322136 )
2133-
2137+ end
21342138end
0 commit comments