bolt 0.21.1 → 0.21.2

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 (105) hide show
  1. checksums.yaml +5 -5
  2. data/lib/bolt/applicator.rb +56 -0
  3. data/lib/bolt/error.rb +6 -0
  4. data/lib/bolt/pal.rb +8 -1
  5. data/lib/bolt/transport/winrm.rb +4 -1
  6. data/lib/bolt/version.rb +1 -1
  7. data/libexec/apply_catalog.rb +61 -0
  8. data/{exe → libexec}/bolt_catalog +0 -0
  9. data/vendored/puppet/lib/puppet/application.rb +8 -1
  10. data/vendored/puppet/lib/puppet/application/device.rb +24 -28
  11. data/vendored/puppet/lib/puppet/application/doc.rb +4 -2
  12. data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +1 -2
  13. data/vendored/puppet/lib/puppet/datatypes.rb +1 -1
  14. data/vendored/puppet/lib/puppet/defaults.rb +2 -6
  15. data/vendored/puppet/lib/puppet/environments.rb +4 -10
  16. data/vendored/puppet/lib/puppet/error.rb +1 -1
  17. data/vendored/puppet/lib/puppet/etc.rb +4 -5
  18. data/vendored/puppet/lib/puppet/face/config.rb +1 -1
  19. data/vendored/puppet/lib/puppet/face/module/build.rb +5 -55
  20. data/vendored/puppet/lib/puppet/face/module/generate.rb +5 -247
  21. data/vendored/puppet/lib/puppet/gettext/config.rb +28 -5
  22. data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +5 -7
  23. data/vendored/puppet/lib/puppet/indirector/rest.rb +7 -56
  24. data/vendored/puppet/lib/puppet/indirector/terminus.rb +1 -1
  25. data/vendored/puppet/lib/puppet/interface.rb +1 -1
  26. data/vendored/puppet/lib/puppet/interface/face_collection.rb +3 -1
  27. data/vendored/puppet/lib/puppet/metatype/manager.rb +2 -2
  28. data/vendored/puppet/lib/puppet/module_tool/applications.rb +0 -1
  29. data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +1 -1
  30. data/vendored/puppet/lib/puppet/network/http/connection.rb +2 -23
  31. data/vendored/puppet/lib/puppet/network/http/factory.rb +2 -6
  32. data/vendored/puppet/lib/puppet/node.rb +1 -2
  33. data/vendored/puppet/lib/puppet/node/environment.rb +5 -1
  34. data/vendored/puppet/lib/puppet/parser/functions.rb +35 -3
  35. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +12 -0
  36. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -5
  37. data/vendored/puppet/lib/puppet/pops/model/ast.rb +107 -0
  38. data/vendored/puppet/lib/puppet/pops/model/factory.rb +11 -0
  39. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
  40. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +1519 -1485
  41. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
  42. data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +1 -1
  43. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +1 -1
  44. data/vendored/puppet/lib/puppet/pops/types/p_binary_type.rb +1 -2
  45. data/vendored/puppet/lib/puppet/pops/types/types.rb +1 -24
  46. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +5 -0
  47. data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +31 -4
  48. data/vendored/puppet/lib/puppet/provider.rb +12 -1
  49. data/vendored/puppet/lib/puppet/provider/package/dnf.rb +2 -1
  50. data/vendored/puppet/lib/puppet/provider/selmodule/semodule.rb +1 -1
  51. data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
  52. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +3 -1
  53. data/vendored/puppet/lib/puppet/provider/service/upstart.rb +2 -0
  54. data/vendored/puppet/lib/puppet/reference/configuration.rb +6 -0
  55. data/vendored/puppet/lib/puppet/reports.rb +2 -2
  56. data/vendored/puppet/lib/puppet/resource/status.rb +2 -0
  57. data/vendored/puppet/lib/puppet/resource/type_collection.rb +1 -1
  58. data/vendored/puppet/lib/puppet/rest/client.rb +28 -24
  59. data/vendored/puppet/lib/puppet/rest/response.rb +5 -0
  60. data/vendored/puppet/lib/puppet/rest/route.rb +13 -31
  61. data/vendored/puppet/lib/puppet/rest/routes.rb +65 -5
  62. data/vendored/puppet/lib/puppet/rest/ssl_context.rb +13 -0
  63. data/vendored/puppet/lib/puppet/settings.rb +6 -0
  64. data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -2
  65. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +5 -1
  66. data/vendored/puppet/lib/puppet/ssl/host.rb +148 -43
  67. data/vendored/puppet/lib/puppet/ssl/oids.rb +1 -1
  68. data/vendored/puppet/lib/puppet/test/test_helper.rb +3 -0
  69. data/vendored/puppet/lib/puppet/transaction/event_manager.rb +3 -1
  70. data/vendored/puppet/lib/puppet/transaction/report.rb +1 -1
  71. data/vendored/puppet/lib/puppet/type.rb +2 -2
  72. data/vendored/puppet/lib/puppet/type/file/content.rb +2 -3
  73. data/vendored/puppet/lib/puppet/type/schedule.rb +33 -84
  74. data/vendored/puppet/lib/puppet/type/user.rb +1 -1
  75. data/vendored/puppet/lib/puppet/util.rb +5 -0
  76. data/vendored/puppet/lib/puppet/util/autoload.rb +39 -31
  77. data/vendored/puppet/lib/puppet/util/character_encoding.rb +0 -22
  78. data/vendored/puppet/lib/puppet/util/command_line.rb +0 -1
  79. data/vendored/puppet/lib/puppet/util/connection.rb +74 -0
  80. data/vendored/puppet/lib/puppet/util/feature.rb +2 -2
  81. data/vendored/puppet/lib/puppet/util/instance_loader.rb +1 -19
  82. data/vendored/puppet/lib/puppet/util/json.rb +0 -8
  83. data/vendored/puppet/lib/puppet/util/log/destinations.rb +1 -1
  84. data/vendored/puppet/lib/puppet/util/network_device/base.rb +1 -1
  85. data/vendored/puppet/lib/puppet/util/platform.rb +3 -0
  86. data/vendored/puppet/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
  87. data/vendored/puppet/lib/puppet/util/reference.rb +2 -2
  88. data/vendored/puppet/lib/puppet/util/rubygems.rb +1 -13
  89. data/vendored/puppet/lib/puppet/util/ssl.rb +40 -1
  90. data/vendored/puppet/lib/puppet/util/windows.rb +1 -0
  91. data/vendored/puppet/lib/puppet/util/windows/file.rb +18 -0
  92. data/vendored/puppet/lib/puppet/util/windows/security.rb +26 -14
  93. metadata +8 -73
  94. data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +0 -152
  95. data/vendored/puppet/lib/puppet/module_tool/skeleton/templates/generator/spec/spec_helper.rb +0 -1
  96. data/vendored/puppet/lib/puppet/provider/mailalias/aliases.rb +0 -50
  97. data/vendored/puppet/lib/puppet/provider/maillist/mailman.rb +0 -108
  98. data/vendored/puppet/lib/puppet/provider/zfs/zfs.rb +0 -108
  99. data/vendored/puppet/lib/puppet/provider/zone/solaris.rb +0 -364
  100. data/vendored/puppet/lib/puppet/provider/zpool/zpool.rb +0 -125
  101. data/vendored/puppet/lib/puppet/type/mailalias.rb +0 -46
  102. data/vendored/puppet/lib/puppet/type/maillist.rb +0 -62
  103. data/vendored/puppet/lib/puppet/type/zfs.rb +0 -154
  104. data/vendored/puppet/lib/puppet/type/zone.rb +0 -382
  105. data/vendored/puppet/lib/puppet/type/zpool.rb +0 -91
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7cfabedc8ddc7e9d4f1345d676f959e08d6bf5f8
4
- data.tar.gz: d05d6c279ff68b287402b6ea1439bec634b7caed
2
+ SHA256:
3
+ metadata.gz: 19cf0dd944021e5b7255b245987961c4155b4ea9400e5d65ad384342fa094a0d
4
+ data.tar.gz: 3755fd0a3e63d7e28e82b08e255953c51b0b539ceb3e180a69930a6cdddc1eb2
5
5
  SHA512:
6
- metadata.gz: 959a5345daf5570d015c8a4d1decde76e963840104467c56d7cc86b1322d7a06b59cecb3d2b38c3dd8acaef59950bfce8be8f2b92b752f491646e4738b3d22e0
7
- data.tar.gz: 3d772b7542b144c6916d04ead84a310ff3484df651a11c9332b2548b177423b634dd371263002365a8ce6d93581b01ec7b116b72678499da1fb7989e1ed19710
6
+ metadata.gz: 84db88c85867ef1a27f4a726f2672ba1b78d453cec47f0f003326079c777b398039f5516e2c1f33697e7ac19e9d861b75d4767cb9512bf7e9bb8dbabe2ad19a1
7
+ data.tar.gz: 0b465783458691bbcb78f1f52eba1b4e7b04c2840e1c06ea24f6ddf4947d6daf5d664b21d4d77062d88eaeace4f224edb5bb1dfada97131fd0e1356d330b9846
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'open3'
5
+
6
+ module Bolt
7
+ Task = Struct.new(:name, :implementations, :input_method)
8
+
9
+ class Applicator
10
+ def initialize(inventory, executor)
11
+ @inventory = inventory
12
+ @executor = executor
13
+ end
14
+
15
+ def apply(args, apply_body, _scope)
16
+ raise(ArgumentError, 'apply requires a TargetSpec') if args.empty?
17
+ type0 = Puppet.lookup(:pal_script_compiler).type('TargetSpec')
18
+ Puppet::Pal.assert_type(type0, args[0], 'apply targets')
19
+
20
+ params = {}
21
+ if args.count > 1
22
+ type1 = Puppet.lookup(:pal_script_compiler).type('Hash[String, Data]')
23
+ Puppet::Pal.assert_type(type1, args[1], 'apply options')
24
+ params = args[1]
25
+ end
26
+
27
+ targets = @inventory.get_targets(args[0])
28
+ ast = Puppet::Pops::Serialization::ToDataConverter.convert(apply_body, rich_data: true, symbol_to_string: true)
29
+ results = targets.map do |target|
30
+ catalog_input = {
31
+ code_ast: ast,
32
+ modulepath: [],
33
+ target: {
34
+ name: target.host,
35
+ facts: @inventory.facts(target),
36
+ variables: @inventory.vars(target)
37
+ }
38
+ }
39
+
40
+ libexec = File.join(Gem::Specification.find_by_name('bolt').gem_dir, 'libexec')
41
+
42
+ bolt_catalog_exe = File.join(libexec, 'bolt_catalog')
43
+ out, err, stat = Open3.capture3(bolt_catalog_exe, 'compile', stdin_data: catalog_input.to_json)
44
+ raise ApplyError.new(target.to_s, err) unless stat.success?
45
+ catalog = JSON.parse(out)
46
+
47
+ path = File.join(libexec, 'apply_catalog.rb')
48
+ impl = { 'name' => 'apply_catalog.rb', 'path' => path, 'requirements' => [], 'supports_noop' => true }
49
+ task = Task.new('apply_catalog', [impl], 'stdin')
50
+ params['catalog'] = catalog
51
+ @executor.run_task([target], task, params, '_description' => 'apply catalog')
52
+ end
53
+ ResultSet.new results.reduce([]) { |result, result_set| result + result_set.results }
54
+ end
55
+ end
56
+ end
@@ -77,6 +77,12 @@ module Bolt
77
77
  end
78
78
  end
79
79
 
80
+ class ApplyError < Error
81
+ def initialize(target, err)
82
+ super("Apply failed to compile for #{target}: #{err}", 'bolt/apply-error')
83
+ end
84
+ end
85
+
80
86
  class InvalidPlanResult < Error
81
87
  def initialize(plan_name, result_str)
82
88
  super("Plan #{plan_name} returned an invalid result: #{result_str}",
@@ -4,6 +4,7 @@ require 'bolt/executor'
4
4
  require 'bolt/error'
5
5
  require 'bolt/plan_result'
6
6
  require 'bolt/util'
7
+ require 'bolt/applicator'
7
8
 
8
9
  module Bolt
9
10
  class PAL
@@ -114,7 +115,13 @@ module Bolt
114
115
  end
115
116
 
116
117
  def with_bolt_executor(executor, inventory, pdb_client = nil, &block)
117
- Puppet.override({ bolt_executor: executor, bolt_inventory: inventory, bolt_pdb_client: pdb_client }, &block)
118
+ opts = {
119
+ bolt_executor: executor,
120
+ bolt_inventory: inventory,
121
+ bolt_pdb_client: pdb_client,
122
+ apply_executor: Applicator.new(inventory, executor)
123
+ }
124
+ Puppet.override(opts, &block)
118
125
  end
119
126
 
120
127
  def in_plan_compiler(executor, inventory, pdb_client)
@@ -128,9 +128,12 @@ catch
128
128
  # fortunately, using PS with stdin input_method should never happen
129
129
  if input_method == 'powershell'
130
130
  conn.execute(<<-PS)
131
- $private:taskArgs = Get-ContentAsJson (
131
+ $private:tempArgs = Get-ContentAsJson (
132
132
  $utf8.GetString([System.Convert]::FromBase64String('#{Base64.encode64(JSON.dump(arguments))}'))
133
133
  )
134
+ $allowedArgs = (Get-Command "#{remote_path}").Parameters.Keys
135
+ $private:taskArgs = @{}
136
+ $private:tempArgs.Keys | ? { $allowedArgs -contains $_ } | % { $private:taskArgs[$_] = $private:tempArgs[$_] }
134
137
  try { & "#{remote_path}" @taskArgs } catch { Write-Error $_.Exception; exit 1 }
135
138
  PS
136
139
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '0.21.1'
4
+ VERSION = '0.21.2'
5
5
  end
@@ -0,0 +1,61 @@
1
+ #! /opt/puppetlabs/puppet/bin/ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'json'
5
+ require 'puppet'
6
+ require 'puppet/configurer'
7
+ require 'tempfile'
8
+
9
+ args = JSON.parse(STDIN.read)
10
+
11
+ Puppet.initialize_settings([])
12
+ run_mode = Puppet::Util::RunMode[:user]
13
+ Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(run_mode))
14
+
15
+ Puppet::ApplicationSupport.push_application_context(run_mode, :local)
16
+
17
+ # Avoid extraneous output
18
+ Puppet[:summarize] = false
19
+
20
+ # Don't interfere with the normal agent
21
+ Puppet[:report] = false
22
+ Puppet[:graph] = false
23
+
24
+ # Get a unique temporary path, but ensure the file doesn't exist or Puppet will report 'State got corrupted'
25
+ statefile = Tempfile.new('puppet-state')
26
+ Puppet[:statefile] = statefile.path
27
+ statefile.close!
28
+
29
+ # Make sure to apply the catalog
30
+ Puppet[:use_cached_catalog] = false
31
+ Puppet[:noop] = args['_noop'] || false
32
+ Puppet[:strict_environment_mode] = false
33
+
34
+ # The whole catalog
35
+ Puppet[:tags] = nil
36
+ Puppet[:skip_tags] = nil
37
+
38
+ # And nothing but the catalog
39
+ Puppet[:prerun_command] = nil
40
+ Puppet[:postrun_command] = nil
41
+
42
+ env = Puppet.lookup(:environments).get('production')
43
+
44
+ report = if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') > 0
45
+ Puppet::Transaction::Report.new
46
+ else
47
+ Puppet::Transaction::Report.new('apply')
48
+ end
49
+
50
+ Puppet.override(current_environment: env, loaders: Puppet::Pops::Loaders.new(env)) do
51
+ catalog = Puppet::Resource::Catalog.from_data_hash(args['catalog']).to_ral
52
+ catalog.environment = env.name.to_s
53
+ catalog.environment_instance = env
54
+
55
+ configurer = Puppet::Configurer.new
56
+ configurer.run(catalog: catalog, report: report, pluginsync: false)
57
+ end
58
+
59
+ puts JSON.pretty_generate(report.to_data_hash)
60
+
61
+ exit report.exit_status != 1
File without changes
@@ -209,7 +209,14 @@ class Application
209
209
  # @return [Array<String>] the names of available applications
210
210
  # @api public
211
211
  def available_application_names
212
- @loader.files_to_load.map do |fn|
212
+ # Use our configured environment to load the application, as it may
213
+ # be in a module we installed locally, otherwise fallback to our
214
+ # current environment (*root*). Once we load the application the
215
+ # current environment will change from *root* to the application
216
+ # specific environment.
217
+ environment = Puppet.lookup(:environments).get(Puppet[:environment]) ||
218
+ Puppet.lookup(:current_environment)
219
+ @loader.files_to_load(environment).map do |fn|
213
220
  ::File.basename(fn, '.rb')
214
221
  end.uniq
215
222
  end
@@ -208,18 +208,11 @@ Licensed under the Apache 2.0 License
208
208
 
209
209
  def main
210
210
  if options[:resource] and !options[:target]
211
- Puppet.err _("resource command requires target")
212
- exit(1)
211
+ raise _("resource command requires target")
213
212
  end
214
213
  unless options[:apply].nil?
215
- if options[:target].nil?
216
- Puppet.err _("missing argument: --target is required when using --apply")
217
- exit(1)
218
- end
219
- unless File.file?(options[:apply])
220
- Puppet.err _("%{file} does not exist, cannot apply") % { file: options[:apply] }
221
- exit(1)
222
- end
214
+ raise _("missing argument: --target is required when using --apply") if options[:target].nil?
215
+ raise _("%{file} does not exist, cannot apply") % { file: options[:apply] } unless File.file?(options[:apply])
223
216
  end
224
217
  vardir = Puppet[:vardir]
225
218
  confdir = Puppet[:confdir]
@@ -235,7 +228,7 @@ Licensed under the Apache 2.0 License
235
228
  end
236
229
  if devices.empty?
237
230
  if options[:target]
238
- Puppet.err _("Target device / certificate '%{target}' not found in %{config}") % { target: options[:target], config: Puppet[:deviceconfig] }
231
+ raise _("Target device / certificate '%{target}' not found in %{config}") % { target: options[:target], config: Puppet[:deviceconfig] }
239
232
  else
240
233
  Puppet.err _("No device found in %{config}") % { config: Puppet[:deviceconfig] }
241
234
  exit(1)
@@ -260,9 +253,7 @@ Licensed under the Apache 2.0 License
260
253
  if options[:resource]
261
254
  type, name = parse_args(command_line.args)
262
255
  Puppet.info _("retrieving resource: %{resource} 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 }
263
-
264
256
  resources = find_resources(type, name)
265
-
266
257
  if options[:to_yaml]
267
258
  text = resources.map do |resource|
268
259
  resource.prune_parameters(:parameters_to_include => @extra_params).to_hierayaml.force_encoding(Encoding.default_external)
@@ -274,6 +265,7 @@ Licensed under the Apache 2.0 License
274
265
  end.join("\n")
275
266
  end
276
267
  (puts text)
268
+ 0
277
269
  elsif options[:apply]
278
270
  # avoid reporting to server
279
271
  Puppet::Transaction::Report.indirection.terminus_class = :yaml
@@ -352,27 +344,31 @@ Licensed under the Apache 2.0 License
352
344
  end
353
345
 
354
346
  def setup
355
- setup_logs
347
+ if options[:resource]
348
+ Puppet.settings.use :main, :agent, :ssl
349
+ else
350
+ setup_logs
356
351
 
357
- args[:Server] = Puppet[:server]
358
- if options[:centrallogs]
359
- logdest = args[:Server]
352
+ args[:Server] = Puppet[:server]
353
+ if options[:centrallogs]
354
+ logdest = args[:Server]
360
355
 
361
- logdest += ":" + args[:Port] if args.include?(:Port)
362
- Puppet::Util::Log.newdestination(logdest)
363
- end
356
+ logdest += ":" + args[:Port] if args.include?(:Port)
357
+ Puppet::Util::Log.newdestination(logdest)
358
+ end
364
359
 
365
- Puppet.settings.use :main, :agent, :device, :ssl
360
+ Puppet.settings.use :main, :agent, :device, :ssl
366
361
 
367
- # We need to specify a ca location for all of the SSL-related
368
- # indirected classes to work; in fingerprint mode we just need
369
- # access to the local files and we don't need a ca.
370
- Puppet::SSL::Host.ca_location = :remote
362
+ # We need to specify a ca location for all of the SSL-related
363
+ # indirected classes to work; in fingerprint mode we just need
364
+ # access to the local files and we don't need a ca.
365
+ Puppet::SSL::Host.ca_location = :remote
371
366
 
372
- Puppet::Transaction::Report.indirection.terminus_class = :rest
367
+ Puppet::Transaction::Report.indirection.terminus_class = :rest
373
368
 
374
- if Puppet[:catalog_cache_terminus]
375
- Puppet::Resource::Catalog.indirection.cache_class = Puppet[:catalog_cache_terminus].intern
369
+ if Puppet[:catalog_cache_terminus]
370
+ Puppet::Resource::Catalog.indirection.cache_class = Puppet[:catalog_cache_terminus].intern
371
+ end
376
372
  end
377
373
  end
378
374
  end
@@ -40,7 +40,8 @@ class Puppet::Application::Doc < Puppet::Application
40
40
 
41
41
  option("--list", "-l") do |arg|
42
42
  require 'puppet/util/reference'
43
- puts Puppet::Util::Reference.references.collect { |r| Puppet::Util::Reference.reference(r).doc }.join("\n")
43
+ refs = Puppet::Util::Reference.references(Puppet.lookup(:current_environment))
44
+ puts refs.collect { |r| Puppet::Util::Reference.reference(r).doc }.join("\n")
44
45
  exit(0)
45
46
  end
46
47
 
@@ -198,7 +199,8 @@ HELP
198
199
  if options[:all]
199
200
  # Don't add dynamic references to the "all" list.
200
201
  require 'puppet/util/reference'
201
- options[:references] = Puppet::Util::Reference.references.reject do |ref|
202
+ refs = Puppet::Util::Reference.references(Puppet.lookup(:current_environment))
203
+ options[:references] = refs.reject do |ref|
202
204
  Puppet::Util::Reference.reference(ref).dynamic?
203
205
  end
204
206
  end
@@ -41,8 +41,7 @@ class Puppet::Configurer::PluginHandler
41
41
  result += locales_downloader.evaluate
42
42
  end
43
43
 
44
-
45
- Puppet::Util::Autoload.reload_changed
44
+ Puppet::Util::Autoload.reload_changed(Puppet.lookup(:current_environment))
46
45
 
47
46
  result
48
47
  end
@@ -207,7 +207,7 @@ module Puppet::DataTypes
207
207
  end
208
208
 
209
209
  def load_file(file_name)
210
- Puppet::Util::Autoload.load_file(file_name, nil)
210
+ Puppet::Util::Autoload.load_file(file_name, Puppet.lookup(:current_environment))
211
211
  end
212
212
  end
213
213
  end
@@ -272,10 +272,10 @@ module Puppet
272
272
  },
273
273
  :configprint => {
274
274
  :default => "",
275
- :desc => "Print the value of a specific configuration setting. If the name of a
275
+ :desc => "Prints the value of a specific configuration setting. If the name of a
276
276
  setting is provided for this, then the value is printed and puppet
277
277
  exits. Comma-separate multiple values. For a list of all values,
278
- specify 'all'.",
278
+ specify 'all'. This setting is deprecated, the 'puppet config' command replaces this functionality.",
279
279
  },
280
280
  :color => {
281
281
  :default => "ansi",
@@ -697,10 +697,6 @@ module Puppet
697
697
  :default => (Puppet.features.microsoft_windows? ? Dir.tmpdir() : '$vardir/puppet-module'),
698
698
  :desc => "The directory into which module tool data is stored",
699
699
  },
700
- :module_skeleton_dir => {
701
- :default => '$module_working_dir/skeleton',
702
- :desc => "The directory which the skeleton for module tool generate is stored.",
703
- },
704
700
  :forge_authorization => {
705
701
  :default => nil,
706
702
  :desc => "The authorization key to connect to the Puppet Forge. Leave blank for unauthorized or license based connections",
@@ -313,14 +313,9 @@ module Puppet::Environments
313
313
  @cache_expiration_service || DefaultCacheExpirationService.new
314
314
  end
315
315
 
316
- # Returns the end of time (the next Mesoamerican Long Count cycle-end after 2012 (5125+2012) = 7137,
317
- # or for a 32 bit machine using Ruby < 1.9.3, the year 2038.
316
+ # Returns the end of time (the next Mesoamerican Long Count cycle-end after 2012 (5125+2012) = 7137
318
317
  def self.end_of_time
319
- begin
320
- Time.gm(7137)
321
- rescue ArgumentError
322
- Time.gm(2038)
323
- end
318
+ Time.gm(7137)
324
319
  end
325
320
 
326
321
  END_OF_TIME = end_of_time
@@ -443,10 +438,9 @@ module Puppet::Environments
443
438
  # Also clears caches in Settings that may prevent the entry from being updated
444
439
  def evict_if_expired(name)
445
440
  if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name))
446
- Puppet.debug {"Evicting cache entry for environment '#{name}'"}
447
- @cache.delete(name)
441
+ Puppet.debug {"Evicting cache entry for environment '#{name}'"}
448
442
  @cache_expiration_service.evicted(name)
449
-
443
+ clear(name)
450
444
  Puppet.settings.clear_environment_settings(name)
451
445
  end
452
446
  end
@@ -3,7 +3,7 @@ module Puppet
3
3
  class Error < RuntimeError
4
4
  attr_accessor :original
5
5
  def initialize(message, original=nil)
6
- super(Puppet::Util::CharacterEncoding.scrub(message))
6
+ super(message.scrub)
7
7
  @original = original
8
8
  end
9
9
  end
@@ -143,10 +143,12 @@ module Puppet::Etc
143
143
  struct.each_pair do |member, value|
144
144
  if value.is_a?(String)
145
145
  new_struct["canonical_#{member}".to_sym] = value.dup
146
- new_struct[member] = Puppet::Util::CharacterEncoding.scrub(Puppet::Util::CharacterEncoding.override_encoding_to_utf_8(value))
146
+ new_struct[member] = Puppet::Util::CharacterEncoding.override_encoding_to_utf_8(value).scrub
147
147
  elsif value.is_a?(Array)
148
148
  new_struct["canonical_#{member}".to_sym] = value.inject([]) { |acc, elem| acc << elem.dup }
149
- new_struct[member] = value.inject([]) { |acc, elem| acc << Puppet::Util::CharacterEncoding.scrub(Puppet::Util::CharacterEncoding.override_encoding_to_utf_8(elem)) }
149
+ new_struct[member] = value.inject([]) do |acc, elem|
150
+ acc << Puppet::Util::CharacterEncoding.override_encoding_to_utf_8(elem).scrub
151
+ end
150
152
  else
151
153
  new_struct["canonical_#{member}".to_sym] = value
152
154
  new_struct[member] = value
@@ -156,6 +158,3 @@ module Puppet::Etc
156
158
  end
157
159
  end
158
160
  end
159
-
160
-
161
-
@@ -39,7 +39,7 @@ Puppet::Face.define(:config, '0.0.1') do
39
39
  description <<-'EOT'
40
40
  Prints the value of a single setting or a list of settings.
41
41
 
42
- This action is an alternate interface to the information available with
42
+ This action is a replacement interface to the information available with
43
43
  `puppet <subcommand> --configprint`.
44
44
  EOT
45
45
  notes <<-'EOT'
@@ -1,64 +1,14 @@
1
1
  Puppet::Face.define(:module, '1.0.0') do
2
2
  action(:build) do
3
3
  summary _("Build a module release package.")
4
- description <<-EOT
5
- Prepares a local module for release on the Puppet Forge by building a
6
- ready-to-upload archive file.
7
- Note: Module build uses MD5 checksums, which are prohibited on FIPS enabled systems.
8
-
9
- This action uses the metadata.json file in the module directory to set metadata
10
- used by the Forge. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for more
11
- about writing metadata.json files.
12
-
13
- After being built, the release archive file can be found in the module's
14
- `pkg` directory.
15
- EOT
16
-
17
- returns _("Pathname object representing the path to the release archive.")
18
-
19
- examples <<-EOT
20
- Build a module release:
21
-
22
- $ puppet module build puppetlabs-apache
23
- notice: Building /Users/kelseyhightower/puppetlabs-apache for release
24
- Module built: /Users/kelseyhightower/puppetlabs-apache/pkg/puppetlabs-apache-0.0.1.tar.gz
25
-
26
- Build the module in the current working directory:
27
-
28
- $ cd /Users/kelseyhightower/puppetlabs-apache
29
- $ puppet module build
30
- notice: Building /Users/kelseyhightower/puppetlabs-apache for release
31
- Module built: /Users/kelseyhightower/puppetlabs-apache/pkg/puppetlabs-apache-0.0.1.tar.gz
32
- EOT
33
-
34
- arguments _("[<path>]")
4
+ #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated.
5
+ description _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.")
35
6
 
36
7
  when_invoked do |*args|
37
- options = args.pop
38
- if options.nil? or args.length > 1 then
39
- raise ArgumentError, _("puppet module build only accepts 0 or 1 arguments")
40
- end
41
-
42
- module_path = args.first
43
- if module_path.nil?
44
- pwd = Dir.pwd
45
- module_path = Puppet::ModuleTool.find_module_root(pwd)
46
- if module_path.nil?
47
- raise _("Unable to find metadata.json in module root %{pwd} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { pwd: pwd }
48
- end
49
- else
50
- unless Puppet::ModuleTool.is_module_root?(module_path)
51
- raise _("Unable to find metadata.json in module root %{module_path} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { module_path: module_path }
52
- end
53
- end
54
-
55
- Puppet::ModuleTool.set_option_defaults options
56
- Puppet::ModuleTool::Applications::Builder.run(module_path, options)
8
+ #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated.
9
+ raise _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.")
57
10
  end
58
11
 
59
- when_rendering :console do |return_value|
60
- # Get the string representation of the Pathname object.
61
- _("Module built: %{path}") % { path: return_value.expand_path.to_s }
62
- end
12
+ deprecate
63
13
  end
64
14
  end