puppet 6.11.1-universal-darwin → 6.12.0-universal-darwin

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 (126) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +16 -16
  5. data/README.md +1 -1
  6. data/ext/build_defaults.yaml +1 -0
  7. data/ext/windows/service/daemon.rb +22 -17
  8. data/lib/puppet/concurrent.rb +2 -0
  9. data/lib/puppet/concurrent/lock.rb +16 -0
  10. data/lib/puppet/concurrent/synchronized.rb +15 -0
  11. data/lib/puppet/concurrent/thread_local_singleton.rb +14 -0
  12. data/lib/puppet/configurer.rb +45 -31
  13. data/lib/puppet/defaults.rb +42 -3
  14. data/lib/puppet/environments.rb +3 -0
  15. data/lib/puppet/error.rb +9 -1
  16. data/lib/puppet/forge.rb +3 -3
  17. data/lib/puppet/forge/errors.rb +2 -2
  18. data/lib/puppet/forge/repository.rb +30 -86
  19. data/lib/puppet/functions/camelcase.rb +2 -2
  20. data/lib/puppet/functions/epp.rb +4 -4
  21. data/lib/puppet/functions/find_file.rb +9 -9
  22. data/lib/puppet/functions/find_template.rb +63 -0
  23. data/lib/puppet/functions/inline_epp.rb +5 -5
  24. data/lib/puppet/http.rb +2 -0
  25. data/lib/puppet/http/client.rb +89 -17
  26. data/lib/puppet/http/resolver.rb +14 -1
  27. data/lib/puppet/http/resolver/server_list.rb +38 -0
  28. data/lib/puppet/http/resolver/settings.rb +3 -2
  29. data/lib/puppet/http/resolver/srv.rb +10 -4
  30. data/lib/puppet/http/service.rb +32 -0
  31. data/lib/puppet/http/service/ca.rb +11 -10
  32. data/lib/puppet/http/service/report.rb +40 -0
  33. data/lib/puppet/http/session.rb +11 -32
  34. data/lib/puppet/network/http/base_pool.rb +13 -0
  35. data/lib/puppet/node/environment.rb +13 -7
  36. data/lib/puppet/pal/pal_impl.rb +5 -0
  37. data/lib/puppet/parser/functions/epp.rb +3 -3
  38. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  39. data/lib/puppet/pops/evaluator/runtime3_support.rb +1 -1
  40. data/lib/puppet/pops/lookup/invocation.rb +10 -3
  41. data/lib/puppet/pops/model/pn_transformer.rb +5 -9
  42. data/lib/puppet/pops/parser/evaluating_parser.rb +3 -4
  43. data/lib/puppet/pops/serialization/json_path.rb +3 -3
  44. data/lib/puppet/pops/time/timespan.rb +3 -5
  45. data/lib/puppet/pops/types/string_converter.rb +6 -9
  46. data/lib/puppet/pops/types/type_calculator.rb +6 -10
  47. data/lib/puppet/pops/types/type_formatter.rb +9 -11
  48. data/lib/puppet/pops/types/type_parser.rb +3 -3
  49. data/lib/puppet/provider/package/portage.rb +3 -3
  50. data/lib/puppet/provider/package_targetable.rb +5 -4
  51. data/lib/puppet/provider/service/systemd.rb +1 -1
  52. data/lib/puppet/provider/user/hpux.rb +1 -1
  53. data/lib/puppet/runtime.rb +1 -0
  54. data/lib/puppet/ssl/ssl_provider.rb +20 -0
  55. data/lib/puppet/transaction.rb +33 -11
  56. data/lib/puppet/type.rb +1 -1
  57. data/lib/puppet/type/file/data_sync.rb +5 -1
  58. data/lib/puppet/type/group.rb +3 -2
  59. data/lib/puppet/type/user.rb +3 -2
  60. data/lib/puppet/util.rb +34 -11
  61. data/lib/puppet/util/logging.rb +30 -18
  62. data/lib/puppet/util/windows/adsi.rb +48 -18
  63. data/lib/puppet/version.rb +1 -1
  64. data/lib/puppet/x509/cert_provider.rb +9 -5
  65. data/locales/puppet.pot +155 -141
  66. data/man/man5/puppet.conf.5 +33 -3
  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/unit/forge/bacula.json +76 -0
  93. data/spec/integration/http/client_spec.rb +144 -0
  94. data/spec/integration/module_tool/forge_spec.rb +64 -0
  95. data/spec/lib/puppet_spec/https.rb +5 -3
  96. data/spec/spec_helper.rb +6 -2
  97. data/spec/unit/concurrent/lock_spec.rb +29 -0
  98. data/spec/unit/configurer_spec.rb +394 -399
  99. data/spec/unit/defaults_spec.rb +15 -4
  100. data/spec/unit/forge/errors_spec.rb +1 -1
  101. data/spec/unit/forge/forge_spec.rb +12 -54
  102. data/spec/unit/forge/module_release_spec.rb +19 -6
  103. data/spec/unit/forge/repository_spec.rb +63 -157
  104. data/spec/unit/forge_spec.rb +46 -116
  105. data/spec/unit/functions/find_template_spec.rb +69 -0
  106. data/spec/unit/http/client_spec.rb +138 -6
  107. data/spec/unit/http/resolver_spec.rb +49 -12
  108. data/spec/unit/http/service/ca_spec.rb +56 -5
  109. data/spec/unit/http/service/report_spec.rb +100 -0
  110. data/spec/unit/http/service_spec.rb +20 -0
  111. data/spec/unit/http/session_spec.rb +53 -18
  112. data/spec/unit/network/http/connection_spec.rb +0 -1
  113. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
  114. data/spec/unit/provider/package/portage_spec.rb +4 -4
  115. data/spec/unit/provider/package_targetable_spec.rb +60 -0
  116. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  117. data/spec/unit/ssl/ssl_provider_spec.rb +71 -0
  118. data/spec/unit/transaction_spec.rb +46 -0
  119. data/spec/unit/type/file/content_spec.rb +9 -3
  120. data/spec/unit/util/log_spec.rb +0 -138
  121. data/spec/unit/util/logging_spec.rb +200 -0
  122. data/spec/unit/util/windows/adsi_spec.rb +51 -0
  123. data/spec/unit/x509/cert_provider_spec.rb +24 -4
  124. data/tasks/manpages.rake +1 -0
  125. metadata +24 -5
  126. data/spec/lib/puppet_spec/validators.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aa8d24006adf210bcb3d05e6b03926cc20fa40d9569e9e432cd359e3d6bab64
4
- data.tar.gz: 69b70c18e025253788528e6fefc7e463955670cfced1f0698d1544ff7bffd552
3
+ metadata.gz: 7ccf86f9b271446083ab3e11e7fa8ee541f40c007ef6cda5bb987eb351f8eb18
4
+ data.tar.gz: ee2e4ee38f07a94a2752e37991ed4fe4539b32a4e2795427c009ea060733aefc
5
5
  SHA512:
6
- metadata.gz: e8aaa2f5d7e3853adb54f7972f01e87a894dc47e274d4b33ec232e86f58fbebc6919305ee8e960a97217f1cfdd8a7f04605ef1c2a92da223940eb3bf96bd834d
7
- data.tar.gz: e7685d1bbe530fabb7be6a206f0019b27925b8c2a79bfb18c32cad364a9076916c4b2ce9faf29df1942e46fb0314f6c31fa4a5a75281b1415255595967004759
6
+ metadata.gz: cab1f1c88965323e2d70e6610445bcb1b0efdaa8440bf8f5867d94f7f3a235bfb89606eea07ad61b62885bb33653aae6463e487de8e61a0987d7128678d74190
7
+ data.tar.gz: aca8163a9de322046ac5e1e4c819e814f193c492dbc3572e477acd0e46936ee213997f806f2bc7520cb1763cb336fb27ec9f27206a361e704c5dc87f0313edf5
data/CODEOWNERS CHANGED
@@ -1,5 +1,5 @@
1
1
  # default to platform-core
2
- * @puppetlabs/platform-core
2
+ * @puppetlabs/platform-core @puppetlabs/puppetserver-maintainers
3
3
 
4
4
  # Night's Watch
5
5
  /lib/puppet/type/group @puppetlabs/night-s-watch
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ end
14
14
 
15
15
  # override .gemspec deps - may issue warning depending on Bundler version
16
16
  gem "facter", *location_for(ENV['FACTER_LOCATION']) if ENV.has_key?('FACTER_LOCATION')
17
+ gem "facter-ng", *location_for(ENV['FACTER_NG_LOCATION']) if ENV.has_key?('FACTER_NG_LOCATION')
17
18
  gem "hiera", *location_for(ENV['HIERA_LOCATION']) if ENV.has_key?('HIERA_LOCATION')
18
19
  gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"])
19
20
  gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 1.5"])
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.11.1)
4
+ puppet (6.12.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  concurrent-ruby (~> 1.0)
7
7
  deep_merge (~> 1.0)
@@ -34,9 +34,9 @@ GEM
34
34
  gettext (3.2.9)
35
35
  locale (>= 2.0.5)
36
36
  text (>= 1.3.0)
37
- gettext-setup (0.31)
37
+ gettext-setup (0.34)
38
38
  fast_gettext (~> 1.1.0)
39
- gettext (>= 3.0.2)
39
+ gettext (>= 3.0.2, < 3.3.0)
40
40
  locale
41
41
  hashdiff (1.0.0)
42
42
  hiera (3.6.0)
@@ -55,30 +55,30 @@ GEM
55
55
  minitar (0.9)
56
56
  msgpack (1.3.1)
57
57
  multi_json (1.14.1)
58
- mustache (1.1.0)
58
+ mustache (1.1.1)
59
59
  optimist (3.0.0)
60
- packaging (0.99.49)
60
+ packaging (0.99.52)
61
61
  artifactory (~> 2)
62
62
  rake (>= 12.3)
63
63
  release-metrics
64
- parallel (1.19.0)
65
- parser (2.6.5.0)
64
+ parallel (1.19.1)
65
+ parser (2.7.0.2)
66
66
  ast (~> 2.4.0)
67
67
  powerpack (0.1.2)
68
68
  pry (0.12.2)
69
69
  coderay (~> 1.1.0)
70
70
  method_source (~> 0.9.0)
71
- public_suffix (4.0.1)
71
+ public_suffix (4.0.3)
72
72
  puppet-resource_api (1.8.7)
73
73
  hocon (>= 1.0)
74
- puppetserver-ca (1.4.0)
74
+ puppetserver-ca (1.5.0)
75
75
  facter (>= 2.0.1, < 4)
76
76
  racc (1.4.9)
77
77
  rainbow (2.2.2)
78
78
  rake
79
79
  rake (12.3.3)
80
80
  rdiscount (2.2.0.1)
81
- rdoc (6.2.0)
81
+ rdoc (6.2.1)
82
82
  release-metrics (1.1.0)
83
83
  csv
84
84
  docopt
@@ -90,18 +90,18 @@ GEM
90
90
  rspec-core (~> 3.9.0)
91
91
  rspec-expectations (~> 3.9.0)
92
92
  rspec-mocks (~> 3.9.0)
93
- rspec-core (3.9.0)
94
- rspec-support (~> 3.9.0)
93
+ rspec-core (3.9.1)
94
+ rspec-support (~> 3.9.1)
95
95
  rspec-expectations (3.9.0)
96
96
  diff-lcs (>= 1.2.0, < 2.0)
97
97
  rspec-support (~> 3.9.0)
98
98
  rspec-its (1.3.0)
99
99
  rspec-core (>= 3.0.0)
100
100
  rspec-expectations (>= 3.0.0)
101
- rspec-mocks (3.9.0)
101
+ rspec-mocks (3.9.1)
102
102
  diff-lcs (>= 1.2.0, < 2.0)
103
103
  rspec-support (~> 3.9.0)
104
- rspec-support (3.9.0)
104
+ rspec-support (3.9.2)
105
105
  rubocop (0.49.1)
106
106
  parallel (~> 1.10)
107
107
  parser (>= 2.3.3.1, < 3.0)
@@ -111,7 +111,7 @@ 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.0.0)
114
+ ruby-prof (1.1.0)
115
115
  ruby-progressbar (1.10.1)
116
116
  safe_yaml (1.0.5)
117
117
  semantic_puppet (1.0.2)
@@ -122,7 +122,7 @@ GEM
122
122
  addressable (>= 2.3.6)
123
123
  crack (>= 0.3.2)
124
124
  hashdiff (>= 0.4.0, < 2.0.0)
125
- yard (0.9.20)
125
+ yard (0.9.24)
126
126
 
127
127
  PLATFORMS
128
128
  ruby
data/README.md CHANGED
@@ -23,7 +23,7 @@ HTTP API
23
23
  Installation
24
24
  ------------
25
25
 
26
- The best way to run Puppet is with [Puppet Enterprise (PE)](https://puppet.com/puppet/puppet-enterprise),
26
+ The best way to run Puppet is with [Puppet Enterprise (PE)](https://puppet.com/products/puppet-enterprise/),
27
27
  which also includes orchestration features, a web console, and professional support.
28
28
  The PE documentation is [available here.](https://puppet.com/docs/pe/latest)
29
29
 
@@ -16,3 +16,4 @@ apt_signing_server: 'apt.puppetlabs.com'
16
16
  apt_repo_url: 'http://apt.puppetlabs.com'
17
17
  apt_repo_path: '/opt/repository/incoming'
18
18
  tar_host: 'downloads.puppetlabs.com'
19
+ nonfinal_gem_path: '/opt/repository-nightlies/downloads/gems/puppet6-nightly'
@@ -15,6 +15,7 @@ class WindowsDaemon < Win32::Daemon
15
15
 
16
16
  @run_thread = nil
17
17
  @LOG_TO_FILE = false
18
+ @loglevel = 0
18
19
  LOG_FILE = File.expand_path(File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'puppet', 'var', 'log', 'windows.log'))
19
20
  LEVELS = [:debug, :info, :notice, :warning, :err, :alert, :emerg, :crit]
20
21
  LEVELS.each do |level|
@@ -27,9 +28,6 @@ class WindowsDaemon < Win32::Daemon
27
28
  end
28
29
 
29
30
  def service_main(*argsv)
30
- base_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
31
- load_env(base_dir)
32
-
33
31
  argsv = (argsv << ARGV).flatten.compact
34
32
  args = argsv.join(' ')
35
33
  @loglevel = LEVELS.index(argsv.index('--debug') ? :debug : :notice)
@@ -41,6 +39,9 @@ class WindowsDaemon < Win32::Daemon
41
39
  args = args.gsub("--logtofile","")
42
40
  end
43
41
 
42
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
43
+ load_env(base_dir)
44
+
44
45
  # The puppet installer registers a 'Puppet' event source. For the moment events will be logged with this key, but
45
46
  # it may be a good idea to split the Service and Puppet events later so it's easier to read in the windows Event Log.
46
47
  #
@@ -190,20 +191,24 @@ class WindowsDaemon < Win32::Daemon
190
191
  private
191
192
 
192
193
  def load_env(base_dir)
193
- # ENV that uses backward slashes
194
- ENV['FACTER_env_windows_installdir'] = base_dir.tr('/', '\\')
195
- ENV['PL_BASEDIR'] = base_dir.tr('/', '\\')
196
- ENV['PUPPET_DIR'] = File.join(base_dir, 'puppet').tr('/', '\\')
197
- ENV['OPENSSL_CONF'] = File.join(base_dir, 'puppet', 'ssl', 'openssl.cnf').tr('/', '\\')
198
- ENV['SSL_CERT_DIR'] = File.join(base_dir, 'puppet', 'ssl', 'certs').tr('/', '\\')
199
- ENV['SSL_CERT_FILE'] = File.join(base_dir, 'puppet', 'ssl', 'cert.pem').tr('/', '\\')
200
- ENV['Path'] = [
201
- File.join(base_dir, 'puppet', 'bin'),
202
- File.join(base_dir, 'bin'),
203
- ].join(';').tr('/', '\\') + ';' + ENV['Path']
204
-
205
- # ENV that uses forward slashes
206
- ENV['RUBYLIB'] = "#{File.join(base_dir, 'puppet','lib')};#{ENV['RUBYLIB']}"
194
+ begin
195
+ # ENV that uses backward slashes
196
+ ENV['FACTER_env_windows_installdir'] = base_dir.tr('/', '\\')
197
+ ENV['PL_BASEDIR'] = base_dir.tr('/', '\\')
198
+ ENV['PUPPET_DIR'] = File.join(base_dir, 'puppet').tr('/', '\\')
199
+ ENV['OPENSSL_CONF'] = File.join(base_dir, 'puppet', 'ssl', 'openssl.cnf').tr('/', '\\')
200
+ ENV['SSL_CERT_DIR'] = File.join(base_dir, 'puppet', 'ssl', 'certs').tr('/', '\\')
201
+ ENV['SSL_CERT_FILE'] = File.join(base_dir, 'puppet', 'ssl', 'cert.pem').tr('/', '\\')
202
+ ENV['Path'] = [
203
+ File.join(base_dir, 'puppet', 'bin'),
204
+ File.join(base_dir, 'bin'),
205
+ ].join(';').tr('/', '\\') + ';' + ENV['Path']
206
+
207
+ # ENV that uses forward slashes
208
+ ENV['RUBYLIB'] = "#{File.join(base_dir, 'puppet','lib')};#{ENV['RUBYLIB']}"
209
+ rescue => e
210
+ log_exception(e)
211
+ end
207
212
  end
208
213
  end
209
214
 
@@ -0,0 +1,2 @@
1
+ module Puppet::Concurrent
2
+ end
@@ -0,0 +1,16 @@
1
+ require 'puppet/concurrent/synchronized'
2
+
3
+ module Puppet
4
+ module Concurrent
5
+
6
+ # A simple lock that at the moment only does any locking on jruby
7
+ class Lock
8
+ include Puppet::Concurrent::Synchronized
9
+ def synchronize
10
+ yield
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+
@@ -0,0 +1,15 @@
1
+ module Puppet
2
+ module Concurrent
3
+
4
+ # Including Puppet::Concurrent::Synchronized into a class when running on JRuby
5
+ # causes all of its instance methods to be synchronized on the instance itself.
6
+ # When running on MRI it has no effect.
7
+ if RUBY_PLATFORM == 'java'
8
+ require 'jruby/synchronized'
9
+ Synchronized = JRuby::Synchronized
10
+ else
11
+ module Synchronized; end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module Puppet
2
+ module Concurrent
3
+ module ThreadLocalSingleton
4
+ def singleton
5
+ key = (name + ".singleton").intern
6
+ thread = Thread.current
7
+ unless thread.thread_variable?(key)
8
+ thread.thread_variable_set(key, new)
9
+ end
10
+ thread.thread_variable_get(key)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -150,9 +150,10 @@ class Puppet::Configurer
150
150
  facts_hash
151
151
  end
152
152
 
153
- def prepare_and_retrieve_catalog(options, query_options)
153
+ def prepare_and_retrieve_catalog(cached_catalog, options, query_options)
154
154
  # set report host name now that we have the fact
155
155
  options[:report].host = Puppet[:node_name_value]
156
+
156
157
  query_options[:transaction_uuid] = @transaction_uuid
157
158
  query_options[:job_id] = @job_id
158
159
  query_options[:static_catalog] = @static_catalog
@@ -162,26 +163,19 @@ class Puppet::Configurer
162
163
  query_options[:checksum_type] = @checksum_type.join('.')
163
164
 
164
165
  # apply passes in ral catalog
165
- catalog = options.delete(:catalog)
166
- return catalog if catalog
167
-
168
- # retrieve_catalog returns json catalog
169
- catalog = retrieve_catalog(query_options)
170
- return convert_catalog(catalog, @duration, options) if catalog
171
-
172
- Puppet.err _("Could not retrieve catalog; skipping run")
173
- nil
166
+ catalog = cached_catalog || options[:catalog]
167
+ unless catalog
168
+ # retrieve_catalog returns resource catalog
169
+ catalog = retrieve_catalog(query_options)
170
+ Puppet.err _("Could not retrieve catalog; skipping run") unless catalog
171
+ end
172
+ catalog
174
173
  end
175
174
 
176
175
  def prepare_and_retrieve_catalog_from_cache(options = {})
177
176
  result = retrieve_catalog_from_cache({:transaction_uuid => @transaction_uuid, :static_catalog => @static_catalog})
178
- if result
179
- Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment }
180
- # get facts now so that the convert_catalog method can resolve deferred values
181
- get_facts(options)
182
- return convert_catalog(result, @duration, options)
183
- end
184
- nil
177
+ Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment } if result
178
+ result
185
179
  end
186
180
 
187
181
  # Apply supplied catalog and return associated application report
@@ -259,14 +253,13 @@ class Puppet::Configurer
259
253
  Puppet::GettextConfig.reset_text_domain('agent')
260
254
  Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
261
255
 
262
- catalog = prepare_and_retrieve_catalog_from_cache(options)
263
- if catalog
264
- options[:catalog] = catalog
256
+ cached_catalog = prepare_and_retrieve_catalog_from_cache(options)
257
+ if cached_catalog
265
258
  @cached_catalog_status = 'explicitly_requested'
266
259
 
267
- if @environment != catalog.environment && !Puppet[:strict_environment_mode]
268
- Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: catalog.environment }
269
- @environment = catalog.environment
260
+ if @environment != cached_catalog.environment && !Puppet[:strict_environment_mode]
261
+ Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: cached_catalog.environment }
262
+ @environment = cached_catalog.environment
270
263
  end
271
264
 
272
265
  report.environment = @environment
@@ -287,7 +280,7 @@ class Puppet::Configurer
287
280
  configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
288
281
 
289
282
  # We only need to find out the environment to run in if we don't already have a catalog
290
- unless (options[:catalog] || Puppet[:strict_environment_mode])
283
+ unless (cached_catalog || options[:catalog] || Puppet[:strict_environment_mode])
291
284
  begin
292
285
  node = nil
293
286
  node_retr_time = thinmark do
@@ -342,7 +335,7 @@ class Puppet::Configurer
342
335
  query_options[:configured_environment] = configured_environment
343
336
  options[:convert_for_node] = node
344
337
 
345
- catalog = prepare_and_retrieve_catalog(options, query_options)
338
+ catalog = prepare_and_retrieve_catalog(cached_catalog, options, query_options)
346
339
  unless catalog
347
340
  return nil
348
341
  end
@@ -368,17 +361,38 @@ class Puppet::Configurer
368
361
  query_options = get_facts(options)
369
362
  query_options[:configured_environment] = configured_environment
370
363
 
371
- catalog = prepare_and_retrieve_catalog(options, query_options)
364
+ # if we get here, ignore the cached catalog
365
+ catalog = prepare_and_retrieve_catalog(nil, options, query_options)
372
366
  return nil unless catalog
373
367
  tries += 1
374
368
  end
375
369
 
370
+ # now that environment has converged, convert resource catalog into ral catalog
371
+ # unless we were given a RAL catalog
372
+ if !cached_catalog && options[:catalog]
373
+ ral_catalog = options[:catalog]
374
+ else
375
+ # REMIND @duration is the time spent loading the last catalog, and doesn't
376
+ # account for things like we failed to download and fell back to the cache
377
+ ral_catalog = convert_catalog(catalog, @duration, options)
378
+
379
+ # If not noop, commit the cached resource catalog (not ral catalog). Ideally
380
+ # we'd just copy the downloaded response body, instead of serializing the
381
+ # in-memory catalog, but that's hard due to the indirector.
382
+ indirection = Puppet::Resource::Catalog.indirection
383
+ if !Puppet[:noop] && indirection.cache?
384
+ request = indirection.request(:save, nil, catalog, environment: Puppet::Node::Environment.remote(catalog.environment))
385
+ Puppet.info("Caching catalog for #{request.key}")
386
+ indirection.cache.save(request)
387
+ end
388
+ end
389
+
376
390
  execute_prerun_command or return nil
377
391
 
378
- options[:report].code_id = catalog.code_id
379
- options[:report].catalog_uuid = catalog.catalog_uuid
392
+ options[:report].code_id = ral_catalog.code_id
393
+ options[:report].catalog_uuid = ral_catalog.catalog_uuid
380
394
  options[:report].cached_catalog_status = @cached_catalog_status
381
- apply_catalog(catalog, options)
395
+ apply_catalog(ral_catalog, options)
382
396
  true
383
397
  rescue => detail
384
398
  Puppet.log_exception(detail, _("Failed to apply catalog: %{detail}") % { detail: detail })
@@ -514,8 +528,8 @@ class Puppet::Configurer
514
528
  Puppet[:node_name_value],
515
529
  query_options.merge(
516
530
  :ignore_cache => true,
517
- # We never want to update the cached Catalog if we're running in noop mode.
518
- :ignore_cache_save => Puppet[:noop],
531
+ # don't update cache until after environment converges
532
+ :ignore_cache_save => true,
519
533
  :environment => Puppet::Node::Environment.remote(@environment),
520
534
  :fail_on_404 => true
521
535
  )
@@ -35,7 +35,7 @@ module Puppet
35
35
  def self.default_basemodulepath
36
36
  if Puppet::Util::Platform.windows?
37
37
  path = ['$codedir/modules']
38
- installdir = Facter.value(:env_windows_installdir)
38
+ installdir = ENV["FACTER_env_windows_installdir"]
39
39
  if installdir
40
40
  path << "#{installdir}/puppet/modules"
41
41
  end
@@ -47,7 +47,7 @@ module Puppet
47
47
 
48
48
  def self.default_vendormoduledir
49
49
  if Puppet::Util::Platform.windows?
50
- installdir = Facter.value(:env_windows_installdir)
50
+ installdir = ENV["FACTER_env_windows_installdir"]
51
51
  if installdir
52
52
  "#{installdir}\\puppet\\vendor_modules"
53
53
  else
@@ -65,6 +65,25 @@ 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 => {
70
+ :default => false,
71
+ :type => :boolean,
72
+ :desc => 'Whether to enable a pre-Facter 4.0 release of Facter (distributed as
73
+ 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',
75
+ :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
+
68
87
  define_settings(:main,
69
88
  :confdir => {
70
89
  :default => nil,
@@ -154,6 +173,19 @@ module Puppet
154
173
  end
155
174
  end
156
175
  },
176
+ :merge_dependency_warnings => {
177
+ :default => false,
178
+ :type => :boolean,
179
+ :desc => "Whether to merge class-level dependency failure warnings.
180
+
181
+ When a class has a failed dependency, every resource in the class
182
+ generates a notice level message about the dependency failure,
183
+ and a warning level message about skipping the resource.
184
+
185
+ If true, all messages caused by a class dependency failure are merged
186
+ into one message associated with the class.
187
+ ",
188
+ },
157
189
  :strict => {
158
190
  :default => :warning,
159
191
  :type => :symbolic_enum,
@@ -206,12 +238,19 @@ module Puppet
206
238
  :trace => {
207
239
  :default => false,
208
240
  :type => :boolean,
209
- :desc => "Whether to print stack traces on some errors",
241
+ :desc => "Whether to print stack traces on some errors. Will print
242
+ internal Ruby stack trace interleaved with Puppet function frames.",
210
243
  :hook => proc do |value|
211
244
  # Enable or disable Facter's trace option too
212
245
  Facter.trace(value) if Facter.respond_to? :trace
213
246
  end
214
247
  },
248
+ :puppet_trace => {
249
+ :default => false,
250
+ :type => :boolean,
251
+ :desc => "Whether to print the Puppet stack trace on some errors.
252
+ This is a noop if `trace` is also set.",
253
+ },
215
254
  :profile => {
216
255
  :default => false,
217
256
  :type => :boolean,