puppet 6.12.0 → 6.13.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -12
  3. data/README.md +1 -1
  4. data/ext/project_data.yaml +1 -1
  5. data/lib/puppet.rb +22 -7
  6. data/lib/puppet/application/resource.rb +1 -1
  7. data/lib/puppet/configurer.rb +8 -13
  8. data/lib/puppet/defaults.rb +83 -49
  9. data/lib/puppet/environments.rb +26 -18
  10. data/lib/puppet/face/facts.rb +8 -5
  11. data/lib/puppet/file_system/memory_file.rb +6 -0
  12. data/lib/puppet/file_system/memory_impl.rb +13 -0
  13. data/lib/puppet/file_system/windows.rb +7 -10
  14. data/lib/puppet/http.rb +2 -0
  15. data/lib/puppet/http/client.rb +30 -0
  16. data/lib/puppet/http/errors.rb +2 -0
  17. data/lib/puppet/http/service.rb +61 -2
  18. data/lib/puppet/http/service/compiler.rb +86 -0
  19. data/lib/puppet/http/service/file_server.rb +85 -0
  20. data/lib/puppet/http/service/report.rb +4 -8
  21. data/lib/puppet/http/session.rb +8 -1
  22. data/lib/puppet/indirector/catalog/compiler.rb +10 -0
  23. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  24. data/lib/puppet/indirector/json.rb +1 -1
  25. data/lib/puppet/indirector/msgpack.rb +1 -1
  26. data/lib/puppet/network/http/connection.rb +4 -0
  27. data/lib/puppet/network/http/nocache_pool.rb +1 -0
  28. data/lib/puppet/network/http/pool.rb +5 -1
  29. data/lib/puppet/parser/ast/pops_bridge.rb +6 -11
  30. data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
  31. data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
  32. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
  33. data/lib/puppet/pops/parser/evaluating_parser.rb +5 -7
  34. data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
  35. data/lib/puppet/pops/types/type_calculator.rb +24 -0
  36. data/lib/puppet/pops/validation/checker4_0.rb +1 -1
  37. data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
  38. data/lib/puppet/provider/aix_object.rb +4 -2
  39. data/lib/puppet/provider/group/aix.rb +1 -0
  40. data/lib/puppet/provider/group/groupadd.rb +52 -24
  41. data/lib/puppet/provider/package/apt.rb +14 -3
  42. data/lib/puppet/provider/package/dnfmodule.rb +9 -2
  43. data/lib/puppet/provider/package/dpkg.rb +14 -7
  44. data/lib/puppet/provider/package/fink.rb +20 -3
  45. data/lib/puppet/provider/package/openbsd.rb +13 -1
  46. data/lib/puppet/provider/package/pkg.rb +18 -5
  47. data/lib/puppet/provider/package/yum.rb +9 -5
  48. data/lib/puppet/provider/user/aix.rb +1 -0
  49. data/lib/puppet/provider/user/directoryservice.rb +30 -5
  50. data/lib/puppet/provider/user/useradd.rb +6 -7
  51. data/lib/puppet/reports/store.rb +1 -1
  52. data/lib/puppet/settings.rb +2 -0
  53. data/lib/puppet/ssl/certificate.rb +2 -1
  54. data/lib/puppet/test/test_helper.rb +4 -0
  55. data/lib/puppet/transaction/resource_harness.rb +1 -1
  56. data/lib/puppet/type/group.rb +2 -2
  57. data/lib/puppet/type/package.rb +63 -9
  58. data/lib/puppet/type/user.rb +2 -2
  59. data/lib/puppet/util/log/destinations.rb +1 -1
  60. data/lib/puppet/util/pidlock.rb +26 -6
  61. data/lib/puppet/util/plist.rb +6 -0
  62. data/lib/puppet/util/storage.rb +0 -1
  63. data/lib/puppet/util/yaml.rb +1 -1
  64. data/lib/puppet/version.rb +1 -1
  65. data/locales/puppet.pot +127 -115
  66. data/man/man5/puppet.conf.5 +21 -7
  67. data/man/man8/puppet-agent.8 +1 -1
  68. data/man/man8/puppet-apply.8 +1 -1
  69. data/man/man8/puppet-catalog.8 +1 -1
  70. data/man/man8/puppet-config.8 +1 -1
  71. data/man/man8/puppet-describe.8 +1 -1
  72. data/man/man8/puppet-device.8 +1 -1
  73. data/man/man8/puppet-doc.8 +1 -1
  74. data/man/man8/puppet-epp.8 +1 -1
  75. data/man/man8/puppet-facts.8 +1 -1
  76. data/man/man8/puppet-filebucket.8 +1 -1
  77. data/man/man8/puppet-generate.8 +1 -1
  78. data/man/man8/puppet-help.8 +1 -1
  79. data/man/man8/puppet-key.8 +1 -1
  80. data/man/man8/puppet-lookup.8 +1 -1
  81. data/man/man8/puppet-man.8 +1 -1
  82. data/man/man8/puppet-module.8 +1 -1
  83. data/man/man8/puppet-node.8 +1 -1
  84. data/man/man8/puppet-parser.8 +1 -1
  85. data/man/man8/puppet-plugin.8 +1 -1
  86. data/man/man8/puppet-report.8 +1 -1
  87. data/man/man8/puppet-resource.8 +1 -1
  88. data/man/man8/puppet-script.8 +1 -1
  89. data/man/man8/puppet-ssl.8 +1 -1
  90. data/man/man8/puppet-status.8 +1 -1
  91. data/man/man8/puppet.8 +2 -2
  92. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +0 -35
  93. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +0 -37
  94. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +0 -37
  95. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +0 -35
  96. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +0 -33
  97. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +0 -35
  98. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +0 -35
  99. data/spec/integration/configurer_spec.rb +26 -7
  100. data/spec/integration/indirector/facts/facter_spec.rb +4 -0
  101. data/spec/unit/application/apply_spec.rb +2 -12
  102. data/spec/unit/application/resource_spec.rb +2 -2
  103. data/spec/unit/configurer/fact_handler_spec.rb +0 -4
  104. data/spec/unit/configurer_spec.rb +0 -3
  105. data/spec/unit/defaults_spec.rb +1 -1
  106. data/spec/unit/environments_spec.rb +57 -28
  107. data/spec/unit/face/facts_spec.rb +24 -20
  108. data/spec/unit/file_system_spec.rb +16 -2
  109. data/spec/unit/http/client_spec.rb +6 -0
  110. data/spec/unit/http/service/compiler_spec.rb +322 -0
  111. data/spec/unit/http/service/file_server_spec.rb +219 -0
  112. data/spec/unit/http/service/report_spec.rb +8 -1
  113. data/spec/unit/http/service_spec.rb +4 -0
  114. data/spec/unit/http/session_spec.rb +31 -0
  115. data/spec/unit/indirector/catalog/compiler_spec.rb +46 -29
  116. data/spec/unit/network/http/connection_spec.rb +23 -1
  117. data/spec/unit/network/http/nocache_pool_spec.rb +3 -3
  118. data/spec/unit/network/http/pool_spec.rb +32 -0
  119. data/spec/unit/node/facts_spec.rb +2 -1
  120. data/spec/unit/node_spec.rb +7 -4
  121. data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
  122. data/spec/unit/pops/validator/validator_spec.rb +7 -2
  123. data/spec/unit/provider/aix_object_spec.rb +16 -2
  124. data/spec/unit/provider/group/groupadd_spec.rb +167 -56
  125. data/spec/unit/provider/package/apt_spec.rb +13 -2
  126. data/spec/unit/provider/package/aptitude_spec.rb +1 -0
  127. data/spec/unit/provider/package/dnfmodule_spec.rb +22 -0
  128. data/spec/unit/provider/package/dpkg_spec.rb +28 -6
  129. data/spec/unit/provider/package/openbsd_spec.rb +17 -0
  130. data/spec/unit/provider/package/pkg_spec.rb +15 -1
  131. data/spec/unit/provider/package/yum_spec.rb +50 -0
  132. data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
  133. data/spec/unit/provider/user/useradd_spec.rb +13 -8
  134. data/spec/unit/puppet_pal_2pec.rb +3 -0
  135. data/spec/unit/puppet_pal_catalog_spec.rb +3 -0
  136. data/spec/unit/puppet_spec.rb +14 -0
  137. data/spec/unit/ssl/certificate_spec.rb +7 -0
  138. data/spec/unit/transaction/persistence_spec.rb +1 -10
  139. data/spec/unit/type/package_spec.rb +8 -0
  140. data/spec/unit/type/user_spec.rb +0 -1
  141. data/spec/unit/util/pidlock_spec.rb +38 -16
  142. data/spec/unit/util/plist_spec.rb +20 -0
  143. data/spec/unit/util/storage_spec.rb +1 -8
  144. metadata +10 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c121885834ded259f002e574ca1ada8dc8ad318668d1234baa71496c58c8fe34
4
- data.tar.gz: 71cfdf18ccace429a2d195a12152ab90b56b82f22435e3075db530ce511f5f34
3
+ metadata.gz: 77d2129b60ff6de7ba7a09cc3b6a5248977c58ae3787daf6d0cb2229c4bcc913
4
+ data.tar.gz: b69f4e35d6b46f3ee84c06f5179c30673ad1d893209d66397817810477bed9ff
5
5
  SHA512:
6
- metadata.gz: c2434c6af3a1a975b0c64a405651e28462ab6651ea6f735418ae30447110f4712f6d425221f981ebb0361183eda36ee1a501be4d6eea42cf89a259f5727f0a15
7
- data.tar.gz: ebcae5fa3568c1c96efec45dc5903f0c0ad1ca98b4d7dd26d7f1ec2122b8bc73fb3c062a668d58a979fa472d646b81b93c7d828c0bf3aa7a783f74f1200837d2
6
+ metadata.gz: b9f16ed09bc8bad983e06482145e6444e14bd871bde8ef01be4043dbcb8ec053e43af3c5b08417e8ca19e30400b847d14c39a302f1b96c84c7dd86154fdda7b1
7
+ data.tar.gz: 691779a9ace904f1f598fc86d0cbc670f46bd93b9f85d7a0414f6130b6e27078efc31a836424ebb876d364b55f7c38b71598e605c0e7f0b562035c5731be8e5a
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.12.0)
4
+ puppet (6.13.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  concurrent-ruby (~> 1.0)
7
7
  deep_merge (~> 1.0)
8
- facter (>= 2.4.0, < 4)
8
+ facter (>= 2.4.0, < 5)
9
9
  fast_gettext (~> 1.1)
10
10
  hiera (>= 3.2.1, < 4)
11
11
  httpclient (~> 2.8)
@@ -22,14 +22,14 @@ GEM
22
22
  artifactory (2.8.2)
23
23
  ast (2.4.0)
24
24
  coderay (1.1.2)
25
- concurrent-ruby (1.1.5)
25
+ concurrent-ruby (1.1.6)
26
26
  crack (0.4.3)
27
27
  safe_yaml (~> 1.0.0)
28
28
  csv (3.1.2)
29
29
  deep_merge (1.2.1)
30
30
  diff-lcs (1.3)
31
31
  docopt (0.6.1)
32
- facter (2.5.6)
32
+ facter (2.5.7)
33
33
  fast_gettext (1.1.2)
34
34
  gettext (3.2.9)
35
35
  locale (>= 2.0.5)
@@ -40,7 +40,7 @@ GEM
40
40
  locale
41
41
  hashdiff (1.0.0)
42
42
  hiera (3.6.0)
43
- hiera-eyaml (3.1.1)
43
+ hiera-eyaml (3.2.0)
44
44
  highline (~> 1.6.19)
45
45
  optimist
46
46
  highline (1.6.21)
@@ -49,15 +49,15 @@ GEM
49
49
  httpclient (2.8.3)
50
50
  json-schema (2.8.1)
51
51
  addressable (>= 2.4)
52
- locale (2.1.2)
52
+ locale (2.1.3)
53
53
  memory_profiler (0.9.14)
54
54
  method_source (0.9.2)
55
55
  minitar (0.9)
56
- msgpack (1.3.1)
56
+ msgpack (1.3.3)
57
57
  multi_json (1.14.1)
58
58
  mustache (1.1.1)
59
59
  optimist (3.0.0)
60
- packaging (0.99.52)
60
+ packaging (0.99.56)
61
61
  artifactory (~> 2)
62
62
  rake (>= 12.3)
63
63
  release-metrics
@@ -111,14 +111,14 @@ GEM
111
111
  unicode-display_width (~> 1.0, >= 1.0.1)
112
112
  rubocop-i18n (1.2.0)
113
113
  rubocop (~> 0.49.0)
114
- ruby-prof (1.1.0)
114
+ ruby-prof (1.2.0)
115
115
  ruby-progressbar (1.10.1)
116
116
  safe_yaml (1.0.5)
117
117
  semantic_puppet (1.0.2)
118
118
  text (1.3.1)
119
- unicode-display_width (1.6.0)
120
- vcr (5.0.0)
121
- webmock (3.7.6)
119
+ unicode-display_width (1.6.1)
120
+ vcr (5.1.0)
121
+ webmock (3.8.2)
122
122
  addressable (>= 2.3.6)
123
123
  crack (>= 0.3.2)
124
124
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Puppet
2
2
  ======
3
3
 
4
- [![Travis Status](https://travis-ci.org/puppetlabs/puppet.svg?branch=master)](https://travis-ci.org/puppetlabs/puppet)
4
+ [![Travis Status](https://travis-ci.com/puppetlabs/puppet.svg?branch=master)](https://travis-ci.com/puppetlabs/puppet)
5
5
  [![Appveyor Status](https://ci.appveyor.com/api/projects/status/cvhpypd4504sevqq/branch/master?svg=true)](https://ci.appveyor.com/project/puppetlabs/puppet/branch/master)
6
6
  [![Gem Version](https://badge.fury.io/rb/puppet.svg)](https://badge.fury.io/rb/puppet)
7
7
  [![Inline docs](https://inch-ci.org/github/puppetlabs/puppet.svg)](https://inch-ci.org/github/puppetlabs/puppet)
@@ -17,7 +17,7 @@ gem_forge_project: 'puppet'
17
17
  gem_required_ruby_version: '>= 2.3.0'
18
18
  gem_required_rubygems_version: '> 1.3.1'
19
19
  gem_runtime_dependencies:
20
- facter: ['> 2.0.1', '< 4']
20
+ facter: ['> 2.0.1', '< 5']
21
21
  hiera: ['>= 3.2.1', '< 4']
22
22
  semantic_puppet: '~> 1.0'
23
23
  fast_gettext: '~> 1.1'
data/lib/puppet.rb CHANGED
@@ -22,6 +22,7 @@ require 'puppet/external/pson/common'
22
22
  require 'puppet/external/pson/version'
23
23
  require 'puppet/external/pson/pure'
24
24
  require 'puppet/gettext/config'
25
+ require 'puppet/defaults'
25
26
 
26
27
 
27
28
  #------------------------------------------------------------
@@ -60,6 +61,14 @@ module Puppet
60
61
  @@settings
61
62
  end
62
63
 
64
+ # The puppetserver project has its own settings class that is thread-aware; this
65
+ # method is here to allow the puppetserver to define its own custom settings class
66
+ # for multithreaded puppet. It is not intended for use outside of the puppetserver
67
+ # implmentation.
68
+ def self.replace_settings_object(new_settings)
69
+ @@settings = new_settings
70
+ end
71
+
63
72
  # Get the value for a setting
64
73
  #
65
74
  # @param [Symbol] param the setting to retrieve
@@ -87,6 +96,7 @@ module Puppet
87
96
 
88
97
  # Store a new default value.
89
98
  def self.define_settings(section, hash)
99
+ Puppet.deprecation_warning('The method Puppet.define_settings is deprecated and will be removed in a future release')
90
100
  @@settings.define_settings(section, hash)
91
101
  end
92
102
 
@@ -121,8 +131,9 @@ module Puppet
121
131
  Puppet::Util::RunMode[@@settings.preferred_run_mode]
122
132
  end
123
133
 
124
- # Load all of the settings.
125
- require 'puppet/defaults'
134
+ # Modify the settings with defaults defined in `initialize_default_settings` method in puppet/defaults.rb. This can
135
+ # be used in the initialization of new Puppet::Settings objects in the puppetserver project.
136
+ Puppet.initialize_default_settings!(settings)
126
137
 
127
138
  # Now that settings are loaded we have the code loaded to be able to issue
128
139
  # deprecation warnings. Warn if we're on a deprecated ruby version.
@@ -137,19 +148,23 @@ module Puppet
137
148
  #
138
149
  # @api public
139
150
  # @param args [Array<String>] the command line arguments to use for initialization
151
+ # @param require_config [Boolean] controls loading of Puppet configuration files
152
+ # @param global_settings [Boolean] controls push to global context after settings object initialization
140
153
  # @return [void]
141
- def self.initialize_settings(args = [], require_config = true)
142
- do_initialize_settings_for_run_mode(:user, args, require_config)
154
+ def self.initialize_settings(args = [], require_config = true, push_settings_globally = true)
155
+ do_initialize_settings_for_run_mode(:user, args, require_config, push_settings_globally)
143
156
  end
144
157
 
145
158
  # private helper method to provide the implementation details of initializing for a run mode,
146
159
  # but allowing us to control where the deprecation warning is issued
147
- def self.do_initialize_settings_for_run_mode(run_mode, args, require_config = true)
160
+ def self.do_initialize_settings_for_run_mode(run_mode, args, require_config = true, push_settings_globally = true)
148
161
  Puppet.settings.initialize_global_settings(args, require_config)
149
162
  run_mode = Puppet::Util::RunMode[run_mode]
150
163
  Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(run_mode))
151
- push_context_global(Puppet.base_context(Puppet.settings), "Initial context after settings initialization")
152
- Puppet::Parser::Functions.reset
164
+ if push_settings_globally
165
+ push_context_global(Puppet.base_context(Puppet.settings), "Initial context after settings initialization")
166
+ Puppet::Parser::Functions.reset
167
+ end
153
168
  end
154
169
  private_class_method :do_initialize_settings_for_run_mode
155
170
 
@@ -5,7 +5,7 @@ class Puppet::Application::Resource < Puppet::Application
5
5
  attr_accessor :host, :extra_params
6
6
 
7
7
  def preinit
8
- @extra_params = []
8
+ @extra_params = [:provider]
9
9
  end
10
10
 
11
11
  option("--debug","-d")
@@ -1,5 +1,4 @@
1
1
  # The client for interacting with the puppetmaster config server.
2
- require 'sync'
3
2
  require 'timeout'
4
3
  require 'puppet/network/http_pool'
5
4
  require 'puppet/util'
@@ -468,21 +467,17 @@ class Puppet::Configurer
468
467
  ::Facter.clear
469
468
  facts = find_facts
470
469
 
471
- saved_fact_terminus = Puppet::Node::Facts.indirection.terminus_class
472
- begin
473
- Puppet::Node::Facts.indirection.terminus_class = :rest
470
+ client = Puppet.runtime['http']
471
+ session = client.create_session
472
+ puppet = session.route_to(:puppet)
474
473
 
475
- server = Puppet::Node::Facts::Rest.server
476
- Puppet.info(_("Uploading facts for %{node} to %{server}") % {
477
- node: facts.name,
478
- server: server})
474
+ Puppet.info(_("Uploading facts for %{node} to %{server}") % {
475
+ node: facts.name,
476
+ server: puppet.url.hostname})
479
477
 
480
- Puppet::Node::Facts.indirection.save(facts, nil, :environment => Puppet::Node::Environment.remote(@environment))
478
+ puppet.put_facts(facts.name, facts: facts, environment: Puppet.lookup(:current_environment).name.to_s)
481
479
 
482
- return true
483
- ensure
484
- Puppet::Node::Facts.indirection.terminus_class = saved_fact_terminus
485
- end
480
+ return true
486
481
  rescue => detail
487
482
  Puppet.log_exception(detail, _("Failed to submit facts: %{detail}") %
488
483
  { detail: detail })
@@ -65,26 +65,30 @@ module Puppet
65
65
 
66
66
  AS_DURATION = %q{This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).}
67
67
 
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 => {
70
74
  :default => false,
71
75
  :type => :boolean,
72
76
  :desc => 'Whether to enable a pre-Facter 4.0 release of Facter (distributed as
73
77
  the "facter-ng" gem). This is not necessary if Facter 3.x or later is installed.
74
- This setting is still experimental and has been only included on Windows builds',
78
+ This setting is still experimental.',
75
79
  :hook => proc do |value|
76
- if value && Puppet::Util::Platform.windows?
77
- begin
78
- require 'facter-ng'
79
- rescue LoadError
80
- raise ArgumentError, 'facter-ng could not be loaded'
81
- end
82
- end
83
- end
84
- }
85
- )
86
-
87
- 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
+ },
88
92
  :confdir => {
89
93
  :default => nil,
90
94
  :type => :directory,
@@ -121,7 +125,7 @@ module Puppet
121
125
  }
122
126
  )
123
127
 
124
- define_settings(:main,
128
+ settings.define_settings(:main,
125
129
  :logdir => {
126
130
  :default => nil,
127
131
  :type => :directory,
@@ -168,8 +172,8 @@ module Puppet
168
172
  valid = %w[deprecations undefined_variables undefined_resources]
169
173
  invalid = values - (values & valid)
170
174
  if not invalid.empty?
171
- raise ArgumentError, _("Cannot disable unrecognized warning types %{invalid}.") % { invalid: invalid.inspect } +
172
- ' ' + _("Valid values are %{values}.") % { values: valid.inspect}
175
+ raise ArgumentError, _("Cannot disable unrecognized warning types '%{invalid}'.") % { invalid: invalid.join(',') } +
176
+ ' ' + _("Valid values are '%{values}'.") % { values: valid.join(', ') }
173
177
  end
174
178
  end
175
179
  },
@@ -225,7 +229,7 @@ module Puppet
225
229
  }
226
230
  )
227
231
 
228
- define_settings(:main,
232
+ settings.define_settings(:main,
229
233
  :priority => {
230
234
  :default => nil,
231
235
  :type => :priority,
@@ -263,6 +267,13 @@ module Puppet
263
267
  major releases of Puppet. Should be used with caution, as in development
264
268
  features are experimental and can have unexpected effects."
265
269
  },
270
+ :versioned_environment_dirs => {
271
+ :default => false,
272
+ :type => :boolean,
273
+ :desc => "Whether or not to look for versioned environment directories,
274
+ symlinked from `$environmentpath/<environment>`. This is an experimental
275
+ feature and should be used with caution."
276
+ },
266
277
  :static_catalogs => {
267
278
  :default => true,
268
279
  :type => :boolean,
@@ -541,12 +552,12 @@ module Puppet
541
552
  :hiera_config => {
542
553
  :default => lambda do
543
554
  config = nil
544
- codedir = Puppet.settings[:codedir]
555
+ codedir = settings[:codedir]
545
556
  if codedir.is_a?(String)
546
557
  config = File.expand_path(File.join(codedir, 'hiera.yaml'))
547
558
  config = nil unless Puppet::FileSystem.exist?(config)
548
559
  end
549
- 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?
550
561
  config
551
562
  end,
552
563
  :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it.",
@@ -610,7 +621,7 @@ module Puppet
610
621
  :http_proxy_password =>{
611
622
  :default => "none",
612
623
  :hook => proc do |value|
613
- if Puppet.settings[:http_proxy_password] =~ /[@!# \/]/
624
+ if settings[:http_proxy_password] =~ /[@!# \/]/
614
625
  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}"
615
626
  end
616
627
  end,
@@ -754,7 +765,7 @@ API to expire the cache as needed
754
765
  }
755
766
  )
756
767
 
757
- Puppet.define_settings(:module_tool,
768
+ settings.define_settings(:module_tool,
758
769
  :module_repository => {
759
770
  :default => 'https://forgeapi.puppet.com',
760
771
  :desc => "The module repository",
@@ -773,7 +784,7 @@ API to expire the cache as needed
773
784
  }
774
785
  )
775
786
 
776
- Puppet.define_settings(
787
+ settings.define_settings(
777
788
  :main,
778
789
 
779
790
  # We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
@@ -854,13 +865,17 @@ This is useful for embedding a pre-shared key for autosigning policy executables
854
865
  ("challenge password") OID.
855
866
 
856
867
  Extension requests will be permanently embedded in the final certificate.
857
- Extension OIDs must be in the "ppRegCertExt" (`1.3.6.1.4.1.34380.1.1`) or
858
- "ppPrivCertExt" (`1.3.6.1.4.1.34380.1.2`) OID arcs. The ppRegCertExt arc is
868
+ Extension OIDs must be in the "ppRegCertExt" (`1.3.6.1.4.1.34380.1.1`),
869
+ "ppPrivCertExt" (`1.3.6.1.4.1.34380.1.2`), or
870
+ "ppAuthCertExt" (`1.3.6.1.4.1.34380.1.3`) OID arcs. The ppRegCertExt arc is
859
871
  reserved for four of the most common pieces of data to embed: `pp_uuid` (`.1`),
860
872
  `pp_instance_id` (`.2`), `pp_image_name` (`.3`), and `pp_preshared_key` (`.4`)
861
873
  --- in the YAML file, these can be referred to by their short descriptive names
862
874
  instead of their full OID. The ppPrivCertExt arc is unregulated, and can be used
863
- for site-specific extensions.
875
+ for site-specific extensions. The ppAuthCert arc is reserved for two pieces of
876
+ data to embed: `pp_authorization` (`.1`) and `pp_auth_role` (`.13`). As with
877
+ ppRegCertExt, in the YAML file, these can be referred to by their short
878
+ descriptive name instead of their full OID.
864
879
  EOT
865
880
  },
866
881
  :certdir => {
@@ -1080,7 +1095,7 @@ EOT
1080
1095
  }
1081
1096
  )
1082
1097
 
1083
- define_settings(
1098
+ settings.define_settings(
1084
1099
  :ca,
1085
1100
  :ca_name => {
1086
1101
  :default => "Puppet CA: $certname",
@@ -1198,7 +1213,7 @@ EOT
1198
1213
 
1199
1214
  # Define the config default.
1200
1215
 
1201
- define_settings(:application,
1216
+ settings.define_settings(:application,
1202
1217
  :config_file_name => {
1203
1218
  :type => :string,
1204
1219
  :default => Puppet::Settings.default_config_file_name,
@@ -1223,7 +1238,7 @@ EOT
1223
1238
  },
1224
1239
  )
1225
1240
 
1226
- define_settings(:environment,
1241
+ settings.define_settings(:environment,
1227
1242
  :manifest => {
1228
1243
  :default => nil,
1229
1244
  :type => :file_or_directory,
@@ -1266,7 +1281,7 @@ EOT
1266
1281
  }
1267
1282
  )
1268
1283
 
1269
- define_settings(:master,
1284
+ settings.define_settings(:master,
1270
1285
  :user => {
1271
1286
  :default => "puppet",
1272
1287
  :desc => "The user Puppet Server will run as. Used to ensure
@@ -1323,13 +1338,23 @@ EOT
1323
1338
  overridden by more specific settings (see `ca_port`, `report_port`).",
1324
1339
  },
1325
1340
  :node_name => {
1326
- :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
+ },
1327
1350
  :desc => "How the puppet master determines the client's identity
1328
1351
  and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest,
1329
1352
  in particular for determining which 'node' statement applies to the client.
1330
1353
  Possible values are 'cert' (use the subject's CN in the client's
1331
1354
  certificate) and 'facter' (use the hostname that the client
1332
- reported in its facts)",
1355
+ reported in its facts).
1356
+
1357
+ This setting is deprecated, please use explicit fact matching for classification.",
1333
1358
  },
1334
1359
  :bucketdir => {
1335
1360
  :default => "$vardir/bucket",
@@ -1452,14 +1477,23 @@ EOT
1452
1477
  :desc => "Where the fileserver configuration is stored.",
1453
1478
  },
1454
1479
  :strict_hostname_checking => {
1455
- :default => false,
1480
+ :default => true,
1481
+ :type => :boolean,
1456
1482
  :desc => "Whether to only search for the complete
1457
- hostname as it is in the certificate when searching for node information
1458
- 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
+ }
1459
1493
  }
1460
1494
  )
1461
1495
 
1462
- define_settings(:device,
1496
+ settings.define_settings(:device,
1463
1497
  :devicedir => {
1464
1498
  :default => "$vardir/devices",
1465
1499
  :type => :directory,
@@ -1474,7 +1508,7 @@ EOT
1474
1508
  }
1475
1509
  )
1476
1510
 
1477
- define_settings(:agent,
1511
+ settings.define_settings(:agent,
1478
1512
  :node_name_value => {
1479
1513
  :default => "$certname",
1480
1514
  :desc => "The explicit value used for the node name for all requests the agent
@@ -1827,7 +1861,7 @@ EOT
1827
1861
 
1828
1862
  # Plugin information.
1829
1863
 
1830
- define_settings(
1864
+ settings.define_settings(
1831
1865
  :main,
1832
1866
  :plugindest => {
1833
1867
  :type => :directory,
@@ -1870,7 +1904,7 @@ EOT
1870
1904
 
1871
1905
  # Central fact information.
1872
1906
 
1873
- define_settings(
1907
+ settings.define_settings(
1874
1908
  :main,
1875
1909
  :factpath => {
1876
1910
  :type => :path,
@@ -1887,7 +1921,7 @@ EOT
1887
1921
  }
1888
1922
  )
1889
1923
 
1890
- define_settings(
1924
+ settings.define_settings(
1891
1925
  :transaction,
1892
1926
  :tags => {
1893
1927
  :default => "",
@@ -1915,7 +1949,7 @@ EOT
1915
1949
  }
1916
1950
  )
1917
1951
 
1918
- define_settings(
1952
+ settings.define_settings(
1919
1953
  :main,
1920
1954
  :external_nodes => {
1921
1955
  :default => "none",
@@ -1940,7 +1974,7 @@ EOT
1940
1974
  }
1941
1975
  )
1942
1976
 
1943
- define_settings(
1977
+ settings.define_settings(
1944
1978
  :ldap,
1945
1979
  :ldapssl => {
1946
1980
  :default => false,
@@ -2009,7 +2043,7 @@ EOT
2009
2043
  }
2010
2044
  )
2011
2045
 
2012
- define_settings(:master,
2046
+ settings.define_settings(:master,
2013
2047
  :storeconfigs => {
2014
2048
  :default => false,
2015
2049
  :type => :boolean,
@@ -2027,7 +2061,7 @@ EOT
2027
2061
  require 'puppet/node/facts'
2028
2062
  if value
2029
2063
  Puppet::Resource::Catalog.indirection.set_global_setting(:cache_class, :store_configs)
2030
- Puppet.settings.override_default(:catalog_cache_terminus, :store_configs)
2064
+ settings.override_default(:catalog_cache_terminus, :store_configs)
2031
2065
  Puppet::Node::Facts.indirection.set_global_setting(:cache_class, :store_configs)
2032
2066
  Puppet::Resource.indirection.set_global_setting(:terminus_class, :store_configs)
2033
2067
  end
@@ -2042,7 +2076,7 @@ EOT
2042
2076
  }
2043
2077
  )
2044
2078
 
2045
- define_settings(:parser,
2079
+ settings.define_settings(:parser,
2046
2080
  :max_errors => {
2047
2081
  :default => 10,
2048
2082
  :desc => <<-'EOT'
@@ -2094,7 +2128,7 @@ EOT
2094
2128
  EOT
2095
2129
  }
2096
2130
  )
2097
- define_settings(:puppetdoc,
2131
+ settings.define_settings(:puppetdoc,
2098
2132
  :document_all => {
2099
2133
  :default => false,
2100
2134
  :type => :boolean,
@@ -2103,7 +2137,7 @@ EOT
2103
2137
  }
2104
2138
  )
2105
2139
 
2106
- define_settings(
2140
+ settings.define_settings(
2107
2141
  :main,
2108
2142
  :rich_data => {
2109
2143
  :default => true,
@@ -2120,5 +2154,5 @@ EOT
2120
2154
  EOT
2121
2155
  }
2122
2156
  )
2123
-
2157
+ end
2124
2158
  end