bolt 0.21.7 → 0.21.8

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

Potentially problematic release.


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

Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bolt/transport/ssh/connection.rb +4 -5
  3. data/lib/bolt/transport/ssh.rb +4 -1
  4. data/lib/bolt/transport/winrm/connection.rb +3 -4
  5. data/lib/bolt/transport/winrm.rb +4 -1
  6. data/lib/bolt/version.rb +1 -1
  7. data/libexec/apply_catalog.rb +10 -2
  8. data/vendored/puppet/lib/puppet/application/apply.rb +20 -9
  9. data/vendored/puppet/lib/puppet/application/cert.rb +3 -1
  10. data/vendored/puppet/lib/puppet/application/device.rb +22 -5
  11. data/vendored/puppet/lib/puppet/configurer/fact_handler.rb +5 -1
  12. data/vendored/puppet/lib/puppet/configurer.rb +15 -2
  13. data/vendored/puppet/lib/puppet/defaults.rb +36 -25
  14. data/vendored/puppet/lib/puppet/face/certificate.rb +2 -0
  15. data/vendored/puppet/lib/puppet/feature/base.rb +0 -3
  16. data/vendored/puppet/lib/puppet/functions/call.rb +37 -0
  17. data/vendored/puppet/lib/puppet/functions.rb +5 -0
  18. data/vendored/puppet/lib/puppet/indirector/ldap.rb +6 -0
  19. data/vendored/puppet/lib/puppet/node/environment.rb +4 -2
  20. data/vendored/puppet/lib/puppet/parser/scope.rb +2 -2
  21. data/vendored/puppet/lib/puppet/pops/adapters.rb +14 -0
  22. data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +128 -0
  23. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -1
  24. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +2 -0
  25. data/vendored/puppet/lib/puppet/pops/issues.rb +9 -1
  26. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -16
  27. data/vendored/puppet/lib/puppet/pops/loaders.rb +1 -3
  28. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +6 -6
  29. data/vendored/puppet/lib/puppet/pops/pcore.rb +11 -0
  30. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +17 -0
  31. data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +13 -5
  32. data/vendored/puppet/lib/puppet/pops.rb +1 -0
  33. data/vendored/puppet/lib/puppet/provider/service/debian.rb +1 -0
  34. data/vendored/puppet/lib/puppet/provider/service/smf.rb +2 -3
  35. data/vendored/puppet/lib/puppet/provider/service/upstart.rb +10 -2
  36. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +6 -84
  37. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +11 -3
  38. data/vendored/puppet/lib/puppet/type/file.rb +3 -0
  39. data/vendored/puppet/lib/puppet/type/user.rb +17 -3
  40. data/vendored/puppet/lib/puppet/util/autoload.rb +36 -31
  41. data/vendored/puppet/lib/puppet/util.rb +2 -0
  42. metadata +3 -43
  43. data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +0 -39
  44. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +0 -573
  45. data/vendored/puppet/lib/puppet/provider/cisco.rb +0 -9
  46. data/vendored/puppet/lib/puppet/provider/computer/computer.rb +0 -20
  47. data/vendored/puppet/lib/puppet/provider/host/parsed.rb +0 -46
  48. data/vendored/puppet/lib/puppet/provider/interface/cisco.rb +0 -27
  49. data/vendored/puppet/lib/puppet/provider/macauthorization/macauthorization.rb +0 -298
  50. data/vendored/puppet/lib/puppet/provider/mcx/mcxcontent.rb +0 -173
  51. data/vendored/puppet/lib/puppet/provider/mount/parsed.rb +0 -282
  52. data/vendored/puppet/lib/puppet/provider/mount.rb +0 -76
  53. data/vendored/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +0 -590
  54. data/vendored/puppet/lib/puppet/provider/selboolean/getsetsebool.rb +0 -47
  55. data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +0 -140
  56. data/vendored/puppet/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -105
  57. data/vendored/puppet/lib/puppet/provider/sshkey/parsed.rb +0 -50
  58. data/vendored/puppet/lib/puppet/provider/vlan/cisco.rb +0 -28
  59. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +0 -315
  60. data/vendored/puppet/lib/puppet/type/augeas.rb +0 -211
  61. data/vendored/puppet/lib/puppet/type/computer.rb +0 -66
  62. data/vendored/puppet/lib/puppet/type/host.rb +0 -95
  63. data/vendored/puppet/lib/puppet/type/interface.rb +0 -121
  64. data/vendored/puppet/lib/puppet/type/k5login.rb +0 -165
  65. data/vendored/puppet/lib/puppet/type/macauthorization.rb +0 -167
  66. data/vendored/puppet/lib/puppet/type/mcx.rb +0 -98
  67. data/vendored/puppet/lib/puppet/type/mount.rb +0 -314
  68. data/vendored/puppet/lib/puppet/type/router.rb +0 -17
  69. data/vendored/puppet/lib/puppet/type/scheduled_task.rb +0 -183
  70. data/vendored/puppet/lib/puppet/type/selboolean.rb +0 -26
  71. data/vendored/puppet/lib/puppet/type/selmodule.rb +0 -59
  72. data/vendored/puppet/lib/puppet/type/ssh_authorized_key.rb +0 -143
  73. data/vendored/puppet/lib/puppet/type/sshkey.rb +0 -83
  74. data/vendored/puppet/lib/puppet/type/vlan.rb +0 -26
  75. data/vendored/puppet/lib/puppet/type/yumrepo.rb +0 -430
  76. data/vendored/puppet/lib/puppet/util/network_device/cisco/device.rb +0 -285
  77. data/vendored/puppet/lib/puppet/util/network_device/cisco/facts.rb +0 -72
  78. data/vendored/puppet/lib/puppet/util/network_device/cisco/interface.rb +0 -94
  79. data/vendored/puppet/lib/puppet/util/network_device/cisco.rb +0 -4
  80. data/vendored/puppet/lib/puppet/util/network_device/ipcalc.rb +0 -68
  81. data/vendored/puppet/lib/puppet/util/network_device/transport/ssh.rb +0 -126
  82. data/vendored/puppet/lib/puppet/util/network_device/transport/telnet.rb +0 -47
  83. data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +0 -1267
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af8e2b6778a6eefcb1efcafe215e6d0642cc1f1d59b656d12bf94d66e6136c73
4
- data.tar.gz: 36cfe00c4670dec416489ab9212928071037fd5010e381d2aab07a5fd6914b81
3
+ metadata.gz: 22fb0de3f6560ee5c6e57d1f0344e9994d93ae5a638531afde4586b619f137de
4
+ data.tar.gz: c2e8780f18783e570e1d9cd44f52f722cce1329fcdfb3c32c3028b22d718f81e
5
5
  SHA512:
6
- metadata.gz: d0f08cc1c6b9f3b407c0b292e842ae4b5e21f41857c78a768b7a965877d22cff0affe9a878ebb1c551a7fb81b05d9548d056ea172e1e8e1d6204b85a8f6ccf22
7
- data.tar.gz: c68bd35efb219e3d836e5e77e497708b1c5b8a05c1a6dcdc0025d38a754fce5fd334a3f26e989e4f0bf2131a3df82a0bbbbc5b7a74247fdf262c5bd66563f050
6
+ metadata.gz: e007695b192c794a2d391d9b2e2dbb2a732374e2aa5b7639ad31e0db7a98dfd5f64b08710dfb958ec7af0e56adb2628f7ef40380f9ad951f505231c303467441
7
+ data.tar.gz: 78a3c221d8c45bc584b477071e47c9a402d0a99867db696eae6201edc739367b2f49a9ad7c465b9292ae4dbcaa1bd692df6dab878b90183e0e2e276af9d7b739
@@ -54,13 +54,14 @@ module Bolt
54
54
  attr_reader :logger, :user, :target
55
55
  attr_writer :run_as
56
56
 
57
- def initialize(target)
57
+ def initialize(target, transport_logger)
58
58
  @target = target
59
59
 
60
60
  @user = @target.user || Net::SSH::Config.for(target.host)[:user] || Etc.getlogin
61
61
  @run_as = nil
62
62
 
63
63
  @logger = Logging.logger[@target.host]
64
+ @transport_logger = transport_logger
64
65
  end
65
66
 
66
67
  if Bolt::Util.windows?
@@ -74,10 +75,8 @@ module Bolt
74
75
  end
75
76
 
76
77
  def connect
77
- transport_logger = Logging.logger[Net::SSH]
78
- transport_logger.level = :warn
79
78
  options = {
80
- logger: transport_logger,
79
+ logger: @transport_logger,
81
80
  non_interactive: true
82
81
  }
83
82
 
@@ -94,7 +93,7 @@ module Bolt
94
93
  options[:verify_host_key] = if target.options['host-key-check']
95
94
  Net::SSH::Verifiers::Secure.new
96
95
  else
97
- Net::SSH::Verifiers::Lenient.new
96
+ Net::SSH::Verifiers::Null.new
98
97
  end
99
98
  options[:timeout] = target.options['connect-timeout'] if target.options['connect-timeout']
100
99
 
@@ -58,10 +58,13 @@ module Bolt
58
58
  "Authentication method 'gssapi-with-mic' is not available"
59
59
  }
60
60
  end
61
+
62
+ @transport_logger = Logging.logger[Net::SSH]
63
+ @transport_logger.level = :warn
61
64
  end
62
65
 
63
66
  def with_connection(target)
64
- conn = Connection.new(target)
67
+ conn = Connection.new(target, @transport_logger)
65
68
  conn.connect
66
69
  yield conn
67
70
  ensure
@@ -11,7 +11,7 @@ module Bolt
11
11
 
12
12
  DEFAULT_EXTENSIONS = ['.ps1', '.rb', '.pp'].freeze
13
13
 
14
- def initialize(target)
14
+ def initialize(target, transport_logger)
15
15
  @target = target
16
16
 
17
17
  default_port = target.options['ssl'] ? HTTPS_PORT : HTTP_PORT
@@ -23,6 +23,7 @@ module Bolt
23
23
  @extensions = DEFAULT_EXTENSIONS.to_set.merge(extensions)
24
24
 
25
25
  @logger = Logging.logger[@target.host]
26
+ @transport_logger = transport_logger
26
27
  end
27
28
 
28
29
  HTTP_PORT = 5985
@@ -47,9 +48,7 @@ module Bolt
47
48
 
48
49
  Timeout.timeout(target.options['connect-timeout']) do
49
50
  @connection = ::WinRM::Connection.new(options)
50
- transport_logger = Logging.logger[::WinRM]
51
- transport_logger.level = :warn
52
- @connection.logger = transport_logger
51
+ @connection.logger = @transport_logger
53
52
 
54
53
  @session = @connection.shell(:powershell)
55
54
  @session.run('$PSVersionTable.PSVersion')
@@ -37,10 +37,13 @@ module Bolt
37
37
  super
38
38
  require 'winrm'
39
39
  require 'winrm-fs'
40
+
41
+ @transport_logger = Logging.logger[::WinRM]
42
+ @transport_logger.level = :warn
40
43
  end
41
44
 
42
45
  def with_connection(target)
43
- conn = Connection.new(target)
46
+ conn = Connection.new(target, @transport_logger)
44
47
  conn.connect
45
48
  yield conn
46
49
  ensure
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '0.21.7'
4
+ VERSION = '0.21.8'
5
5
  end
@@ -1,6 +1,7 @@
1
1
  #! /opt/puppetlabs/puppet/bin/ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'fileutils'
4
5
  require 'json'
5
6
  require 'puppet'
6
7
  require 'puppet/configurer'
@@ -13,7 +14,7 @@ Puppet.initialize_settings([])
13
14
  run_mode = Puppet::Util::RunMode[:user]
14
15
  Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(run_mode))
15
16
 
16
- Puppet::ApplicationSupport.push_application_context(run_mode, :local)
17
+ Puppet::ApplicationSupport.push_application_context(run_mode)
17
18
 
18
19
  # Avoid extraneous output
19
20
  Puppet[:summarize] = false
@@ -43,7 +44,8 @@ Puppet[:postrun_command] = nil
43
44
  Puppet[:default_file_terminus] = :file_server
44
45
 
45
46
  exit_code = 0
46
- Dir.mktmpdir do |moduledir|
47
+ moduledir = Dir.mktmpdir
48
+ begin
47
49
  Tempfile.open('plugins.tar.gz') do |plugins|
48
50
  File.binwrite(plugins, Base64.decode64(args['plugins']))
49
51
  Puppet::ModuleTool::Tar.instance.unpack(plugins, moduledir, Etc.getlogin || Etc.getpwuid.name)
@@ -75,6 +77,12 @@ Dir.mktmpdir do |moduledir|
75
77
 
76
78
  puts JSON.pretty_generate(report.to_data_hash)
77
79
  exit_code = report.exit_status != 1
80
+ ensure
81
+ begin
82
+ FileUtils.remove_dir(moduledir)
83
+ rescue Errno::ENOTEMPTY => e
84
+ STDERR.puts("Could not cleanup temporary directory: #{e}")
85
+ end
78
86
  end
79
87
 
80
88
  exit exit_code
@@ -265,20 +265,31 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
265
265
  exit(1)
266
266
  end
267
267
 
268
- # Translate it to a RAL catalog
269
- catalog = catalog.to_ral
268
+ # Loaders are required when resolving deferred values and at the end
269
+ # when apply_catalog is called - it is therefore used around all of the
270
+ # required steps as it is expensive to set up loaders twice (once for
271
+ # resolution and once for the apply).
272
+ #
273
+ exit_status = Puppet.override(:loaders => Puppet::Pops::Loaders.new(apply_environment)) do
270
274
 
271
- catalog.finalize
275
+ # Resolve all deferred values and replace them / mutate the catalog
276
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node, node.facts, catalog)
272
277
 
273
- catalog.retrieval_duration = Time.now - starttime
278
+ # Translate it to a RAL catalog
279
+ catalog = catalog.to_ral
274
280
 
275
- if options[:write_catalog_summary]
276
- catalog.write_class_file
277
- catalog.write_resource_file
278
- end
281
+ catalog.finalize
279
282
 
280
- exit_status = Puppet.override(:loaders => Puppet::Pops::Loaders.new(apply_environment)) { apply_catalog(catalog) }
283
+ catalog.retrieval_duration = Time.now - starttime
281
284
 
285
+ if options[:write_catalog_summary]
286
+ catalog.write_class_file
287
+ catalog.write_resource_file
288
+ end
289
+
290
+ #exit_status = Puppet.override(:loaders => Puppet::Pops::Loaders.new(apply_environment)) { apply_catalog(catalog) }
291
+ apply_catalog(catalog)
292
+ end
282
293
  if not exit_status
283
294
  exit(1)
284
295
  elsif options[:detailed_exitcodes] then
@@ -100,7 +100,7 @@ class Puppet::Application::Cert < Puppet::Application
100
100
  end
101
101
 
102
102
  def summary
103
- _("Manage certificates and requests")
103
+ _("Manage certificates and requests (Deprecated)")
104
104
  end
105
105
 
106
106
  def help
@@ -282,6 +282,8 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
282
282
  end
283
283
 
284
284
  def setup
285
+ deprecate
286
+
285
287
  require 'puppet/ssl/certificate_authority'
286
288
  exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
287
289
 
@@ -32,6 +32,7 @@ class Puppet::Application::Device < Puppet::Application
32
32
  :centrallogs => false,
33
33
  :setdest => false,
34
34
  :resource => false,
35
+ :facts => false,
35
36
  :target => nil,
36
37
  :to_yaml => false,
37
38
  }.each do |opt,val|
@@ -44,6 +45,7 @@ class Puppet::Application::Device < Puppet::Application
44
45
  option("--centrallogging")
45
46
  option("--debug","-d")
46
47
  option("--resource","-r")
48
+ option("--facts","-f")
47
49
  option("--to_yaml","-y")
48
50
  option("--verbose","-v")
49
51
 
@@ -93,7 +95,7 @@ USAGE
93
95
  -----
94
96
  puppet device [-d|--debug] [--detailed-exitcodes] [--deviceconfig <file>]
95
97
  [-h|--help] [-l|--logdest syslog|<file>|console]
96
- [-v|--verbose] [-w|--waitforcert <seconds>]
98
+ [-v|--verbose] [-w|--waitforcert <seconds>] [-f|--facts]
97
99
  [-a|--apply <file>] [-r|--resource <type> [name]]
98
100
  [-t|--target <device>] [--user=<user>] [-V|--version]
99
101
 
@@ -163,6 +165,9 @@ you can specify '--server <servername>' as an argument.
163
165
  * --apply:
164
166
  Apply a manifest against a remote target. Target must be specified.
165
167
 
168
+ * --facts:
169
+ Displays the facts of a remote target. Target must be specified.
170
+
166
171
  * --resource:
167
172
  Displays a resource state as Puppet code, roughly equivalent to
168
173
  `puppet resource`. Can be filterd by title. Requires --target be specified.
@@ -210,6 +215,9 @@ Licensed under the Apache 2.0 License
210
215
  if options[:resource] and !options[:target]
211
216
  raise _("resource command requires target")
212
217
  end
218
+ if options[:facts] and !options[:target]
219
+ raise _("facts command requires target")
220
+ end
213
221
  unless options[:apply].nil?
214
222
  raise _("missing argument: --target is required when using --apply") if options[:target].nil?
215
223
  raise _("%{file} does not exist, cannot apply") % { file: options[:apply] } unless File.file?(options[:apply])
@@ -266,14 +274,23 @@ Licensed under the Apache 2.0 License
266
274
  end
267
275
  (puts text)
268
276
  0
277
+ elsif options[:facts]
278
+ Puppet.info _("retrieving facts from %{target} at %{scheme}%{url_host}%{port}%{url_path}") % { resource: type, target: device.name, scheme: scheme, url_host: device_url.host, port: port, url_path: device_url.path }
279
+ remote_facts = Puppet::Node::Facts.indirection.find(name, :environment => env)
280
+ # Give a proper name to the facts
281
+ remote_facts.name = remote_facts.values['clientcert']
282
+ renderer = Puppet::Network::FormatHandler.format(:console)
283
+ puts renderer.render(remote_facts)
284
+ 0
269
285
  elsif options[:apply]
286
+ # ensure we have a cache folder structure exists for the device
287
+ FileUtils.mkdir_p(Puppet[:statedir]) unless File.directory?(Puppet[:statedir])
270
288
  # avoid reporting to server
271
289
  Puppet::Transaction::Report.indirection.terminus_class = :yaml
272
290
  Puppet::Resource::Catalog.indirection.cache_class = nil
273
291
 
274
292
  require 'puppet/application/apply'
275
293
  begin
276
-
277
294
  Puppet[:node_terminus] = :plain
278
295
  Puppet[:catalog_terminus] = :compiler
279
296
  Puppet[:catalog_cache_terminus] = nil
@@ -344,11 +361,11 @@ Licensed under the Apache 2.0 License
344
361
  end
345
362
 
346
363
  def setup
347
- if options[:resource]
364
+ setup_logs
365
+ if options[:apply] || options[:facts] || options[:resource]
366
+ Puppet::Util::Log.newdestination(:console)
348
367
  Puppet.settings.use :main, :agent, :ssl
349
368
  else
350
- setup_logs
351
-
352
369
  args[:Server] = Puppet[:server]
353
370
  if options[:centrallogs]
354
371
  logdest = args[:Server]
@@ -28,7 +28,11 @@ module Puppet::Configurer::FactHandler
28
28
  end
29
29
 
30
30
  def facts_for_uploading
31
- facts = find_facts
31
+ encode_facts(find_facts)
32
+ end
33
+
34
+ def encode_facts(facts)
35
+ #facts = find_facts
32
36
 
33
37
  # NOTE: :facts specified as parameters are URI encoded here,
34
38
  # then encoded for a second time depending on their length:
@@ -4,6 +4,8 @@ require 'timeout'
4
4
  require 'puppet/network/http_pool'
5
5
  require 'puppet/util'
6
6
  require 'securerandom'
7
+ #require 'puppet/parser/script_compiler'
8
+ require 'puppet/pops/evaluator/deferred_resolver'
7
9
 
8
10
  class Puppet::Configurer
9
11
  require 'puppet/configurer/fact_handler'
@@ -106,6 +108,11 @@ class Puppet::Configurer
106
108
  catalog = nil
107
109
 
108
110
  catalog_conversion_time = thinmark do
111
+ # Will mutate the result and replace all Deferred values with resolved values
112
+ if options[:convert_for_node] && options[:convert_with_facts]
113
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(options[:convert_for_node], options[:convert_with_facts], result)
114
+ end
115
+
109
116
  catalog = result.to_ral
110
117
  catalog.finalize
111
118
  catalog.retrieval_duration = duration
@@ -137,7 +144,9 @@ class Puppet::Configurer
137
144
  #
138
145
  # facts_for_uploading may set Puppet[:node_name_value] as a side effect
139
146
  facter_time = thinmark do
140
- facts_hash = facts_for_uploading
147
+ facts = find_facts
148
+ options[:convert_with_facts] = facts
149
+ facts_hash = encode_facts(facts) # encode for uploading # was: facts_for_uploading
141
150
  end
142
151
  options[:report].add_times(:fact_generation, facter_time) if options[:report]
143
152
  end
@@ -327,10 +336,14 @@ class Puppet::Configurer
327
336
  current_environment.manifest,
328
337
  current_environment.config_version)
329
338
  end
330
- Puppet.push_context({:current_environment => local_node_environment}, "Local node environment for configurer transaction")
339
+ Puppet.push_context({
340
+ :current_environment => local_node_environment,
341
+ :loaders => Puppet::Pops::Loaders.new(local_node_environment)
342
+ }, "Local node environment for configurer transaction")
331
343
 
332
344
  query_options = get_facts(options) unless query_options
333
345
  query_options[:configured_environment] = configured_environment
346
+ options[:convert_for_node] = node
334
347
 
335
348
  unless catalog = prepare_and_retrieve_catalog(options, query_options)
336
349
  return nil
@@ -38,11 +38,23 @@ module Puppet
38
38
  installdir = Facter.value(:env_windows_installdir)
39
39
  if installdir
40
40
  path << "#{installdir}/puppet/modules"
41
- path << "#{installdir}/puppet/vendor_modules"
42
41
  end
43
42
  path.join(File::PATH_SEPARATOR)
44
43
  else
45
- '$codedir/modules:/opt/puppetlabs/puppet/modules:/opt/puppetlabs/puppet/vendor_modules'
44
+ '$codedir/modules:/opt/puppetlabs/puppet/modules'
45
+ end
46
+ end
47
+
48
+ def self.default_vendormoduledir
49
+ if Puppet::Util::Platform.windows?
50
+ installdir = Facter.value(:env_windows_installdir)
51
+ if installdir
52
+ "#{installdir}\\puppet\\vendor_modules"
53
+ else
54
+ nil
55
+ end
56
+ else
57
+ '/opt/puppetlabs/puppet/vendor_modules'
46
58
  end
47
59
  end
48
60
 
@@ -290,7 +302,7 @@ module Puppet
290
302
  :desc => "Whether to create the necessary user and group that puppet agent will run as.",
291
303
  },
292
304
  :manage_internal_file_permissions => {
293
- :default => true,
305
+ :default => ! Puppet::Util::Platform.windows?,
294
306
  :type => :boolean,
295
307
  :desc => "Whether Puppet should manage the owner, group, and mode of files it uses internally",
296
308
  },
@@ -327,13 +339,7 @@ module Puppet
327
339
  for those files that Puppet will load on demand, and is only
328
340
  guaranteed to work for those cases. In fact, the autoload
329
341
  mechanism is responsible for making sure this directory
330
- is in Ruby's search path\n",
331
- :call_hook => :on_initialize_and_write,
332
- :hook => proc do |value|
333
- $LOAD_PATH.delete(@oldlibdir) if defined?(@oldlibdir) && $LOAD_PATH.include?(@oldlibdir)
334
- @oldlibdir = value
335
- $LOAD_PATH << value
336
- end
342
+ is in Ruby's search path\n"
337
343
  },
338
344
  :environment => {
339
345
  :default => "production",
@@ -467,7 +473,7 @@ module Puppet
467
473
  :type => :terminus,
468
474
  :default => nil,
469
475
  :desc => "How to store cached nodes.
470
- Valid values are (none), 'json', 'msgpack', 'yaml' or write only yaml ('write_only_yaml').",
476
+ Valid values are (none), 'json', 'msgpack', or 'yaml'.",
471
477
  },
472
478
  :data_binding_terminus => {
473
479
  :type => :terminus,
@@ -582,9 +588,10 @@ module Puppet
582
588
  #{AS_DURATION}",
583
589
  },
584
590
  :http_read_timeout => {
591
+ :default => "10m",
585
592
  :type => :duration,
586
- :desc => "The time to wait for one block to be read from an HTTP connection. If nothing is
587
- read after the elapsed interval then the connection will be closed. The default value is unlimited.
593
+ :desc => "The time to wait for data to be read from an HTTP connection. If nothing is
594
+ read after the elapsed interval then the connection will be closed. The default value is 10 minutes.
588
595
  #{AS_DURATION}",
589
596
  },
590
597
  :http_user_agent => {
@@ -661,13 +668,6 @@ module Puppet
661
668
  essentially means that you can't have any code outside of a node,
662
669
  class, or definition other than in the site manifest.",
663
670
  },
664
- :trusted_server_facts => {
665
- :default => true,
666
- :type => :boolean,
667
- :deprecated => :completely,
668
- :desc => "The 'trusted_server_facts' setting is deprecated and has no effect as the
669
- feature this enabled is now always on. The setting will be removed in a future version of puppet.",
670
- },
671
671
  :preview_outputdir => {
672
672
  :default => '$vardir/preview',
673
673
  :type => :directory,
@@ -745,7 +745,8 @@ A comma-separated list of alternate DNS names for Puppet Server. These are extra
745
745
  hostnames (in addition to its `certname`) that the server is allowed to use when
746
746
  serving agents. Puppet checks this setting when automatically requesting a
747
747
  certificate for Puppet agent or Puppet Server, and when manually generating a
748
- certificate with `puppet cert generate`.
748
+ certificate with `puppet cert generate`. These can be either IP or DNS, and the type
749
+ should be specified and followed with a colon. Untyped inputs will default to DNS.
749
750
 
750
751
  In order to handle agent requests at a given hostname (like
751
752
  "puppet.example.com"), Puppet Server needs a certificate that proves it's
@@ -1308,6 +1309,14 @@ EOT
1308
1309
  any global directories. For more info, see
1309
1310
  <https://puppet.com/docs/puppet/latest/environments_about.html>",
1310
1311
  },
1312
+ :vendormoduledir => {
1313
+ :default => lambda { default_vendormoduledir },
1314
+ :type => :string,
1315
+ :desc => "The directory containing **vendored** modules. These modules will
1316
+ be used by _all_ environments like those in the `basemodulepath`. The only
1317
+ difference is that modules in the `basemodulepath` are pluginsynced, while
1318
+ vendored modules are not",
1319
+ },
1311
1320
  :ssl_client_header => {
1312
1321
  :default => "HTTP_X_CLIENT_DN",
1313
1322
  :desc => "The header containing an authenticated client's SSL DN.
@@ -1577,11 +1586,11 @@ EOT
1577
1586
  it with the `--no-client` option. #{AS_DURATION}",
1578
1587
  },
1579
1588
  :runtimeout => {
1580
- :default => 0,
1589
+ :default => "1h",
1581
1590
  :type => :duration,
1582
1591
  :desc => "The maximum amount of time an agent run is allowed to take.
1583
- A Puppet agent run that exceeds this timeout will be aborted.
1584
- Defaults to 0, which is unlimited. #{AS_DURATION}",
1592
+ A Puppet agent run that exceeds this timeout will be aborted. A value
1593
+ of 0 disables the timeout. Defaults to 1 hour. #{AS_DURATION}",
1585
1594
  },
1586
1595
  :ca_server => {
1587
1596
  :default => "$server",
@@ -1626,7 +1635,9 @@ EOT
1626
1635
  :type => :boolean,
1627
1636
  :desc => "Whether to only use the cached catalog rather than compiling a new catalog
1628
1637
  on every run. Puppet can be run with this enabled by default and then selectively
1629
- disabled when a recompile is desired.",
1638
+ disabled when a recompile is desired. Because a Puppet agent using cached catalogs
1639
+ does not contact the master for a new catalog, it also does not upload facts at
1640
+ the beginning of the Puppet run.",
1630
1641
  },
1631
1642
  :ignoremissingtypes => {
1632
1643
  :default => false,
@@ -162,4 +162,6 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
162
162
 
163
163
  deactivate_action(:search)
164
164
  deactivate_action(:save)
165
+
166
+ deprecate
165
167
  end
@@ -54,9 +54,6 @@ Puppet.features.add(:root) { require 'puppet/util/suidmanager'; Puppet::Util::SU
54
54
  # We have lcs diff
55
55
  Puppet.features.add :diff, :libs => %w{diff/lcs diff/lcs/hunk}
56
56
 
57
- # We have augeas
58
- Puppet.features.add(:augeas, :libs => ["augeas"])
59
-
60
57
  # We have OpenSSL
61
58
  Puppet.features.add(:openssl, :libs => ["openssl"])
62
59
 
@@ -6,6 +6,10 @@
6
6
  # 2. Any number of arguments to be passed to the called function.
7
7
  # 3. An optional lambda, if the function being called supports it.
8
8
  #
9
+ # This function can also be used to resolve a `Deferred` given as
10
+ # the only argument to the function (does not accept arguments nor
11
+ # a block).
12
+ #
9
13
  # @example Using the `call` function
10
14
  #
11
15
  # ```puppet
@@ -26,6 +30,29 @@
26
30
  # The `call` function can be used to call either Ruby functions or Puppet language
27
31
  # functions.
28
32
  #
33
+ # When used with `Deferred` values, the deferred value can either describe
34
+ # a function call, or a dig into a variable.
35
+ #
36
+ # @example Resolving a deferred function call
37
+ #
38
+ # ```puppet
39
+ # $d = Deferred('join', [[1,2,3], ':']) # A future call to join that joins the arguments 1,2,3 with ':'
40
+ # notice($d.call())
41
+ # ```
42
+ #
43
+ # Would notice the string "1:2:3".
44
+ #
45
+ # @example Resolving a deferred variable value with optional dig into its structure
46
+ #
47
+ # ```puppet
48
+ # $d = Deferred('$facts', ['processors', 'count'])
49
+ # notice($d.call())
50
+ # ```
51
+ #
52
+ # Would notice the value of `$facts['processors']['count']` at the time when the `call` is made.
53
+ #
54
+ # * Deferred values supported since Puppet 5.6.0
55
+ #
29
56
  # @since 5.0.0
30
57
  #
31
58
  Puppet::Functions.create_function(:call, Puppet::Functions::InternalFunction) do
@@ -36,7 +63,17 @@ Puppet::Functions.create_function(:call, Puppet::Functions::InternalFunction) do
36
63
  optional_block_param
37
64
  end
38
65
 
66
+ dispatch :call_deferred do
67
+ scope_param
68
+ param 'Deferred', :deferred
69
+ end
70
+
39
71
  def call_impl_block(scope, function_name, *args, &block)
40
72
  call_function_with_scope(scope, function_name, *args, &block)
41
73
  end
74
+
75
+ def call_deferred(scope, deferred)
76
+ Puppet::Pops::Evaluator::DeferredResolver.resolve(deferred, scope.compiler)
77
+ end
78
+
42
79
  end
@@ -714,6 +714,11 @@ module Puppet::Functions
714
714
  inject(:pal_script_compiler)
715
715
  end
716
716
 
717
+ # Inject a parameter getting a cached hash for this function
718
+ def cache_param
719
+ inject(:cache)
720
+ end
721
+
717
722
  private
718
723
 
719
724
  def inject(injection_name)
@@ -2,6 +2,12 @@ require 'puppet/indirector/terminus'
2
2
  require 'puppet/util/ldap/connection'
3
3
 
4
4
  class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
5
+ def initialize
6
+ #TRANSLATORS 'Puppet::Indirector::Ldap' is a class and should not be translated
7
+ Puppet.deprecation_warning(_("Puppet::Indirector::Ldap is deprecated and will be removed in a future release of Puppet."));
8
+ super
9
+ end
10
+
5
11
  # Perform our ldap search and process the result.
6
12
  def find(request)
7
13
  ldapsearch(search_filter(request.key)) { |entry| return process(entry) } || nil
@@ -417,9 +417,10 @@ class Puppet::Node::Environment
417
417
  end
418
418
 
419
419
  # Loads module translations for the current environment once for
420
- # the lifetime of the environment.
420
+ # the lifetime of the environment. Execute a block in the context
421
+ # of that translation domain.
421
422
  def with_text_domain
422
- return if Puppet[:disable_i18n]
423
+ return yield if Puppet[:disable_i18n]
423
424
 
424
425
  if @text_domain.nil?
425
426
  @text_domain = @name
@@ -431,6 +432,7 @@ class Puppet::Node::Environment
431
432
 
432
433
  yield
433
434
  ensure
435
+ # Is a noop if disable_i18n is true
434
436
  Puppet::GettextConfig.clear_text_domain
435
437
  end
436
438
 
@@ -769,8 +769,8 @@ class Puppet::Parser::Scope
769
769
  raise Puppet::ParseError, _("Attempt to assign to a reserved variable name: '%{name}'") % { name: name }
770
770
  end
771
771
 
772
- # Check for server_facts reserved variable name if the trusted_sever_facts setting is true
773
- if name == VARNAME_SERVER_FACTS && !options[:privileged] && Puppet[:trusted_server_facts]
772
+ # Check for server_facts reserved variable name
773
+ if name == VARNAME_SERVER_FACTS && !options[:privileged]
774
774
  raise Puppet::ParseError, _("Attempt to assign to a reserved variable name: '%{name}'") % { name: name }
775
775
  end
776
776
 
@@ -2,6 +2,20 @@
2
2
  #
3
3
  module Puppet::Pops
4
4
  module Adapters
5
+
6
+ class ObjectIdCacheAdapter < Puppet::Pops::Adaptable::Adapter
7
+ attr_accessor :cache
8
+
9
+ def initialize
10
+ @cache = {}
11
+ end
12
+
13
+ # Retrieves a mutable hash with all stored values
14
+ def retrieve(o)
15
+ @cache[o.__id__] ||= {}
16
+ end
17
+ end
18
+
5
19
  # A documentation adapter adapts an object with a documentation string.
6
20
  # (The intended use is for a source text parser to extract documentation and store this
7
21
  # in DocumentationAdapter instances).