@@ -65,29 +65,30 @@ def self.default_vendormoduledir
6565
6666 AS_DURATION = %q{This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).}
6767
68- define_settings ( :main ,
69- :facterng => {
68+ # @api public
69+ # @param args [Puppet::Settings] the settings object to define default settings for
70+ # @return void
71+ def self . initialize_default_settings! ( settings )
72+ settings . define_settings ( :main ,
73+ :facterng => {
7074 :default => false ,
7175 :type => :boolean ,
7276 :desc => 'Whether to enable a pre-Facter 4.0 release of Facter (distributed as
7377 the "facter-ng" gem). This is not necessary if Facter 3.x or later is installed.
7478 This setting is still experimental.' ,
7579 :hook => proc do |value |
76- if value
77- begin
78- ORIGINAL_FACTER = Object . const_get ( :Facter )
79- Object . send ( :remove_const , :Facter )
80- require 'facter-ng'
81- rescue LoadError
82- Object . const_set ( :Facter , ORIGINAL_FACTER )
83- raise ArgumentError , 'facter-ng could not be loaded'
84- end
85- end
86- end
87- }
88- )
89-
90- define_settings ( :main ,
80+ if value
81+ begin
82+ original_facter = Object . const_get ( :Facter )
83+ Object . send ( :remove_const , :Facter )
84+ require 'facter-ng'
85+ rescue LoadError
86+ Object . const_set ( :Facter , original_facter )
87+ raise ArgumentError , 'facter-ng could not be loaded'
88+ end
89+ end
90+ end
91+ } ,
9192 :confdir => {
9293 :default => nil ,
9394 :type => :directory ,
@@ -124,7 +125,7 @@ def self.default_vendormoduledir
124125 }
125126 )
126127
127- define_settings ( :main ,
128+ settings . define_settings ( :main ,
128129 :logdir => {
129130 :default => nil ,
130131 :type => :directory ,
@@ -228,7 +229,7 @@ def self.default_vendormoduledir
228229 }
229230 )
230231
231- define_settings ( :main ,
232+ settings . define_settings ( :main ,
232233 :priority => {
233234 :default => nil ,
234235 :type => :priority ,
@@ -551,12 +552,12 @@ def self.default_vendormoduledir
551552 :hiera_config => {
552553 :default => lambda do
553554 config = nil
554- codedir = Puppet . settings [ :codedir ]
555+ codedir = settings [ :codedir ]
555556 if codedir . is_a? ( String )
556557 config = File . expand_path ( File . join ( codedir , 'hiera.yaml' ) )
557558 config = nil unless Puppet ::FileSystem . exist? ( config )
558559 end
559- config = File . expand_path ( File . join ( Puppet . settings [ :confdir ] , 'hiera.yaml' ) ) if config . nil?
560+ config = File . expand_path ( File . join ( settings [ :confdir ] , 'hiera.yaml' ) ) if config . nil?
560561 config
561562 end ,
562563 :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it." ,
@@ -620,7 +621,7 @@ def self.default_vendormoduledir
620621 :http_proxy_password => {
621622 :default => "none" ,
622623 :hook => proc do |value |
623- if Puppet . settings [ :http_proxy_password ] =~ /[@!# \/ ]/
624+ if settings [ :http_proxy_password ] =~ /[@!# \/ ]/
624625 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 } "
625626 end
626627 end ,
@@ -764,7 +765,7 @@ def self.default_vendormoduledir
764765 }
765766 )
766767
767- Puppet . define_settings ( :module_tool ,
768+ settings . define_settings ( :module_tool ,
768769 :module_repository => {
769770 :default => 'https://forgeapi.puppet.com' ,
770771 :desc => "The module repository" ,
@@ -783,7 +784,7 @@ def self.default_vendormoduledir
783784 }
784785 )
785786
786- Puppet . define_settings (
787+ settings . define_settings (
787788 :main ,
788789
789790 # We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
@@ -1094,7 +1095,7 @@ def self.default_vendormoduledir
10941095 }
10951096 )
10961097
1097- define_settings (
1098+ settings . define_settings (
10981099 :ca ,
10991100 :ca_name => {
11001101 :default => "Puppet CA: $certname" ,
@@ -1212,7 +1213,7 @@ def self.default_vendormoduledir
12121213
12131214 # Define the config default.
12141215
1215- define_settings ( :application ,
1216+ settings . define_settings ( :application ,
12161217 :config_file_name => {
12171218 :type => :string ,
12181219 :default => Puppet ::Settings . default_config_file_name ,
@@ -1237,7 +1238,7 @@ def self.default_vendormoduledir
12371238 } ,
12381239 )
12391240
1240- define_settings ( :environment ,
1241+ settings . define_settings ( :environment ,
12411242 :manifest => {
12421243 :default => nil ,
12431244 :type => :file_or_directory ,
@@ -1280,7 +1281,7 @@ def self.default_vendormoduledir
12801281 }
12811282 )
12821283
1283- define_settings ( :master ,
1284+ settings . define_settings ( :master ,
12841285 :user => {
12851286 :default => "puppet" ,
12861287 :desc => "The user Puppet Server will run as. Used to ensure
@@ -1337,13 +1338,23 @@ def self.default_vendormoduledir
13371338 overridden by more specific settings (see `ca_port`, `report_port`)." ,
13381339 } ,
13391340 :node_name => {
1340- :default => "cert" ,
1341+ :default => 'cert' ,
1342+ :type => :enum ,
1343+ :values => [ 'cert' , 'facter' ] ,
1344+ :deprecated => :completely ,
1345+ :hook => proc { |val |
1346+ if val != 'cert'
1347+ Puppet . deprecation_warning ( "The node_name setting is deprecated and will be removed in a future release." )
1348+ end
1349+ } ,
13411350 :desc => "How the puppet master determines the client's identity
13421351 and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest,
13431352 in particular for determining which 'node' statement applies to the client.
13441353 Possible values are 'cert' (use the subject's CN in the client's
13451354 certificate) and 'facter' (use the hostname that the client
1346- reported in its facts)" ,
1355+ reported in its facts).
1356+
1357+ This setting is deprecated, please use explicit fact matching for classification." ,
13471358 } ,
13481359 :bucketdir => {
13491360 :default => "$vardir/bucket" ,
@@ -1466,14 +1477,23 @@ def self.default_vendormoduledir
14661477 :desc => "Where the fileserver configuration is stored." ,
14671478 } ,
14681479 :strict_hostname_checking => {
1469- :default => false ,
1480+ :default => true ,
1481+ :type => :boolean ,
14701482 :desc => "Whether to only search for the complete
1471- hostname as it is in the certificate when searching for node information
1472- in the catalogs." ,
1483+ hostname as it is in the certificate when searching for node information
1484+ in the catalogs or to match dot delimited segments of the cert's certname
1485+ and the hostname, fqdn, and/or domain facts.
1486+
1487+ This setting is deprecated and will be removed in a future release." ,
1488+ :hook => proc { |val |
1489+ if val != true
1490+ Puppet . deprecation_warning ( "Setting strict_hostname_checking to false is deprecated and will be removed in a future release. Please use regular expressions in your node declarations or explicit fact matching for classification (though be warned that fact based classification may be considered insecure)." )
1491+ end
1492+ }
14731493 }
14741494 )
14751495
1476- define_settings ( :device ,
1496+ settings . define_settings ( :device ,
14771497 :devicedir => {
14781498 :default => "$vardir/devices" ,
14791499 :type => :directory ,
@@ -1488,7 +1508,7 @@ def self.default_vendormoduledir
14881508 }
14891509 )
14901510
1491- define_settings ( :agent ,
1511+ settings . define_settings ( :agent ,
14921512 :node_name_value => {
14931513 :default => "$certname" ,
14941514 :desc => "The explicit value used for the node name for all requests the agent
@@ -1841,7 +1861,7 @@ def self.default_vendormoduledir
18411861
18421862 # Plugin information.
18431863
1844- define_settings (
1864+ settings . define_settings (
18451865 :main ,
18461866 :plugindest => {
18471867 :type => :directory ,
@@ -1884,7 +1904,7 @@ def self.default_vendormoduledir
18841904
18851905 # Central fact information.
18861906
1887- define_settings (
1907+ settings . define_settings (
18881908 :main ,
18891909 :factpath => {
18901910 :type => :path ,
@@ -1901,7 +1921,7 @@ def self.default_vendormoduledir
19011921 }
19021922 )
19031923
1904- define_settings (
1924+ settings . define_settings (
19051925 :transaction ,
19061926 :tags => {
19071927 :default => "" ,
@@ -1929,7 +1949,7 @@ def self.default_vendormoduledir
19291949 }
19301950 )
19311951
1932- define_settings (
1952+ settings . define_settings (
19331953 :main ,
19341954 :external_nodes => {
19351955 :default => "none" ,
@@ -1954,7 +1974,7 @@ def self.default_vendormoduledir
19541974 }
19551975 )
19561976
1957- define_settings (
1977+ settings . define_settings (
19581978 :ldap ,
19591979 :ldapssl => {
19601980 :default => false ,
@@ -2023,7 +2043,7 @@ def self.default_vendormoduledir
20232043 }
20242044 )
20252045
2026- define_settings ( :master ,
2046+ settings . define_settings ( :master ,
20272047 :storeconfigs => {
20282048 :default => false ,
20292049 :type => :boolean ,
@@ -2041,7 +2061,7 @@ def self.default_vendormoduledir
20412061 require 'puppet/node/facts'
20422062 if value
20432063 Puppet ::Resource ::Catalog . indirection . set_global_setting ( :cache_class , :store_configs )
2044- Puppet . settings . override_default ( :catalog_cache_terminus , :store_configs )
2064+ settings . override_default ( :catalog_cache_terminus , :store_configs )
20452065 Puppet ::Node ::Facts . indirection . set_global_setting ( :cache_class , :store_configs )
20462066 Puppet ::Resource . indirection . set_global_setting ( :terminus_class , :store_configs )
20472067 end
@@ -2056,7 +2076,7 @@ def self.default_vendormoduledir
20562076 }
20572077 )
20582078
2059- define_settings ( :parser ,
2079+ settings . define_settings ( :parser ,
20602080 :max_errors => {
20612081 :default => 10 ,
20622082 :desc => <<-'EOT'
@@ -2108,7 +2128,7 @@ def self.default_vendormoduledir
21082128 EOT
21092129 }
21102130 )
2111- define_settings ( :puppetdoc ,
2131+ settings . define_settings ( :puppetdoc ,
21122132 :document_all => {
21132133 :default => false ,
21142134 :type => :boolean ,
@@ -2117,7 +2137,7 @@ def self.default_vendormoduledir
21172137 }
21182138 )
21192139
2120- define_settings (
2140+ settings . define_settings (
21212141 :main ,
21222142 :rich_data => {
21232143 :default => true ,
@@ -2134,5 +2154,5 @@ def self.default_vendormoduledir
21342154 EOT
21352155 }
21362156 )
2137-
2157+ end
21382158end
0 commit comments