puppet 7.11.0 → 7.12.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/lib/puppet/configurer.rb +15 -16
  4. data/lib/puppet/file_system.rb +2 -1
  5. data/lib/puppet/pops/evaluator/closure.rb +7 -5
  6. data/lib/puppet/provider/package/pkg.rb +10 -0
  7. data/lib/puppet/provider/user/useradd.rb +20 -0
  8. data/lib/puppet/type/service.rb +8 -3
  9. data/lib/puppet/util/autoload.rb +1 -1
  10. data/lib/puppet/util/json.rb +3 -0
  11. data/lib/puppet/version.rb +1 -1
  12. data/locales/puppet.pot +183 -179
  13. data/man/man5/puppet.conf.5 +2 -2
  14. data/man/man8/puppet-agent.8 +1 -1
  15. data/man/man8/puppet-apply.8 +1 -1
  16. data/man/man8/puppet-catalog.8 +1 -1
  17. data/man/man8/puppet-config.8 +1 -1
  18. data/man/man8/puppet-describe.8 +1 -1
  19. data/man/man8/puppet-device.8 +1 -1
  20. data/man/man8/puppet-doc.8 +1 -1
  21. data/man/man8/puppet-epp.8 +1 -1
  22. data/man/man8/puppet-facts.8 +1 -1
  23. data/man/man8/puppet-filebucket.8 +1 -1
  24. data/man/man8/puppet-generate.8 +1 -1
  25. data/man/man8/puppet-help.8 +1 -1
  26. data/man/man8/puppet-lookup.8 +1 -1
  27. data/man/man8/puppet-module.8 +1 -1
  28. data/man/man8/puppet-node.8 +1 -1
  29. data/man/man8/puppet-parser.8 +1 -1
  30. data/man/man8/puppet-plugin.8 +1 -1
  31. data/man/man8/puppet-report.8 +1 -1
  32. data/man/man8/puppet-resource.8 +1 -1
  33. data/man/man8/puppet-script.8 +1 -1
  34. data/man/man8/puppet-ssl.8 +1 -1
  35. data/man/man8/puppet.8 +2 -2
  36. data/spec/unit/configurer_spec.rb +14 -0
  37. data/spec/unit/network/formats_spec.rb +6 -0
  38. data/spec/unit/provider/package/pkg_spec.rb +15 -0
  39. data/spec/unit/provider/user/useradd_spec.rb +40 -0
  40. data/spec/unit/type/service_spec.rb +27 -0
  41. data/spec/unit/util/autoload_spec.rb +25 -8
  42. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f537f678f34da6971073332b82eb39b545d5be1a86349f227ecb3f281aca064
4
- data.tar.gz: bf52e1b8ab1ed145523617db66df66770d7422e9b4f3518bac16bab9861356af
3
+ metadata.gz: feb741bb77ed2e7f043a4879e1ff6c5b6ae03a4467b497d0895ed8071ef607d7
4
+ data.tar.gz: 4359d0d4a714a2e6cec8a85b0d469462784f738167fe88209e9644fb5ecd2362
5
5
  SHA512:
6
- metadata.gz: 591cea7ddbaa9236cc0c3719e16c23693f29c7480b93207a4b2bac1be1bd86029899d34455d14603bec2e252d13ce41fa975e6041ca079667550c46797aff794
7
- data.tar.gz: 04db4ad4c55cfbc3d3521e0af62090213c656455f2121470eda5cb47c77262f292f11b65394e5b7cc7ec84b27a9f6df5ab9c94b54c37e8f722b4641204d9918b
6
+ metadata.gz: 410a0b4bf4b835b884e60235a6b7d902147655142dd4d11eaea7983b3a7bc42960e89a9132cd4db4e79ad485f61b88b5e6508db09f4ed806f78908f451f952e0
7
+ data.tar.gz: 474c5e4a49a949e28438576047cbf17fc1dc5e30e2d4c04bf96fd6faefe8acbc77aea9e243381d33cf1202b65436b7f7f288e915442c555cad43731ffd23f568
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GIT
2
2
  remote: git://github.com/puppetlabs/packaging
3
- revision: 734cbd7a585d76fb359222d4d5ee6bf239956432
3
+ revision: 03722ea5c9106c1b31a58b22cc41bacade8c8fa8
4
4
  branch: 1.0.x
5
5
  specs:
6
- packaging (0.99.80.6.g734cbd7)
6
+ packaging (0.101.0)
7
7
  artifactory (~> 2)
8
8
  csv (= 3.1.5)
9
9
  rake (>= 12.3)
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- puppet (7.11.0)
15
+ puppet (7.12.0)
16
16
  CFPropertyList (~> 2.2)
17
17
  concurrent-ruby (~> 1.0)
18
18
  deep_merge (~> 1.0)
@@ -40,7 +40,7 @@ GEM
40
40
  deep_merge (1.2.1)
41
41
  diff-lcs (1.4.4)
42
42
  docopt (0.6.1)
43
- facter (4.2.3)
43
+ facter (4.2.5)
44
44
  hocon (~> 1.3)
45
45
  thor (>= 1.0.1, < 2.0)
46
46
  fast_gettext (1.1.2)
@@ -127,7 +127,7 @@ GEM
127
127
  semantic_puppet (1.0.4)
128
128
  text (1.3.1)
129
129
  thor (1.1.0)
130
- unicode-display_width (1.7.0)
130
+ unicode-display_width (1.8.0)
131
131
  vcr (5.1.0)
132
132
  webmock (3.14.0)
133
133
  addressable (>= 2.8.0)
@@ -393,6 +393,8 @@ class Puppet::Configurer
393
393
  if last_server_specified_environment
394
394
  @environment = last_server_specified_environment
395
395
  report.environment = last_server_specified_environment
396
+
397
+ push_current_environment_and_loaders
396
398
  else
397
399
  Puppet.debug(_("Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical."))
398
400
  end
@@ -403,14 +405,7 @@ class Puppet::Configurer
403
405
  # This is to maintain compatibility with anyone using this class
404
406
  # aside from agent, apply, device.
405
407
  unless Puppet.lookup(:loaders) { nil }
406
- new_env = Puppet::Node::Environment.remote(@environment)
407
- Puppet.push_context(
408
- {
409
- current_environment: new_env,
410
- loaders: Puppet::Pops::Loaders.new(new_env, true)
411
- },
412
- "Local node environment #{@environment} for configurer transaction"
413
- )
408
+ push_current_environment_and_loaders
414
409
  end
415
410
 
416
411
  temp_value = options[:pluginsync]
@@ -446,14 +441,7 @@ class Puppet::Configurer
446
441
  @environment = catalog.environment
447
442
  report.environment = @environment
448
443
 
449
- new_env = Puppet::Node::Environment.remote(@environment)
450
- Puppet.push_context(
451
- {
452
- :current_environment => new_env,
453
- :loaders => Puppet::Pops::Loaders.new(new_env, true)
454
- },
455
- "Local node environment #{@environment} for configurer transaction"
456
- )
444
+ push_current_environment_and_loaders
457
445
 
458
446
  query_options, facts = get_facts(options)
459
447
  query_options[:configured_environment] = configured_environment
@@ -649,6 +637,17 @@ class Puppet::Configurer
649
637
  end
650
638
  end
651
639
 
640
+ def push_current_environment_and_loaders
641
+ new_env = Puppet::Node::Environment.remote(@environment)
642
+ Puppet.push_context(
643
+ {
644
+ :current_environment => new_env,
645
+ :loaders => Puppet::Pops::Loaders.new(new_env, true)
646
+ },
647
+ "Local node environment #{@environment} for configurer transaction"
648
+ )
649
+ end
650
+
652
651
  def retrieve_catalog_from_cache(query_options)
653
652
  result = nil
654
653
  @duration = thinmark do
@@ -345,7 +345,8 @@ module Puppet::FileSystem
345
345
  # value ~ will be expanded to something like /Users/Foo
346
346
  #
347
347
  # This method exists primarlily to resolve a Ruby deficiency where
348
- # File.expand_path doesn't handle ~ in each segment on a Windows path
348
+ # File.expand_path doesn't convert short paths to long paths, which is
349
+ # important when resolving the path to load.
349
350
  #
350
351
  # @param path [Object] a path handle produced by {#pathname}
351
352
  # @return [String] a string representation of the path
@@ -219,16 +219,15 @@ class Closure < CallableSignature
219
219
  def call_with_scope(scope, args)
220
220
  variable_bindings = combine_values_with_parameters(scope, args)
221
221
 
222
- tc = Types::TypeCalculator.singleton
223
- final_args = tc.infer_set(parameters.reduce([]) do |tmp_args, param|
222
+ final_args = parameters.reduce([]) do |tmp_args, param|
224
223
  if param.captures_rest
225
224
  tmp_args.concat(variable_bindings[param.name])
226
225
  else
227
226
  tmp_args << variable_bindings[param.name]
228
227
  end
229
- end)
228
+ end
230
229
 
231
- if type.callable?(final_args)
230
+ if type.callable_with?(final_args, block_type)
232
231
  result = catch(:next) do
233
232
  @evaluator.evaluate_block_with_bindings(scope, variable_bindings, @model.body)
234
233
  end
@@ -236,7 +235,9 @@ class Closure < CallableSignature
236
235
  "value returned from #{closure_name}"
237
236
  end
238
237
  else
239
- raise ArgumentError, Types::TypeMismatchDescriber.describe_signatures(closure_name, [self], final_args)
238
+ tc = Types::TypeCalculator.singleton
239
+ args_type = tc.infer_set(final_args)
240
+ raise ArgumentError, Types::TypeMismatchDescriber.describe_signatures(closure_name, [self], args_type)
240
241
  end
241
242
  end
242
243
 
@@ -309,6 +310,7 @@ class Closure < CallableSignature
309
310
  to += param_range[1]
310
311
  end
311
312
  param_types = Types::PTupleType.new(types, Types::PIntegerType.new(from, to))
313
+ # The block_type for a Closure is always nil for now, see comment in block_name above
312
314
  Types::PCallableType.new(param_types, nil, return_type)
313
315
  end
314
316
 
@@ -237,7 +237,17 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
237
237
  end
238
238
  self.unhold if self.properties[:mark] == :hold
239
239
  begin
240
+ tries = 1
241
+ # pkg install exits with code 7 when the image is currently in use by another process and cannot be modified
240
242
  r = exec_cmd(command(:pkg), command, *args, name)
243
+ while r[:exit] == 7 do
244
+ if tries > 4
245
+ raise Puppet::Error, _("Pkg could not install %{name} after %{tries} tries. Aborting run") % { name: name, tries: tries }
246
+ end
247
+ sleep 2 ** tries
248
+ tries += 1
249
+ r = exec_cmd(command(:pkg), command, *args, name)
250
+ end
241
251
  ensure
242
252
  self.hold if @resource[:mark] == :hold
243
253
  end
@@ -72,6 +72,16 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
72
72
  get(:comment)
73
73
  end
74
74
 
75
+ def shell
76
+ return localshell if @resource.forcelocal?
77
+ get(:shell)
78
+ end
79
+
80
+ def home
81
+ return localhome if @resource.forcelocal?
82
+ get(:home)
83
+ end
84
+
75
85
  def groups
76
86
  return localgroups if @resource.forcelocal?
77
87
  super
@@ -123,6 +133,16 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
123
133
  user[:gecos]
124
134
  end
125
135
 
136
+ def localshell
137
+ user = finduser(:account, resource[:name])
138
+ user[:shell]
139
+ end
140
+
141
+ def localhome
142
+ user = finduser(:account, resource[:name])
143
+ user[:directory]
144
+ end
145
+
126
146
  def localgroups
127
147
  @groups_of ||= {}
128
148
  group_file = '/etc/group'
@@ -272,9 +272,14 @@ module Puppet
272
272
 
273
273
  newparam(:timeout, :required_features => :configurable_timeout) do
274
274
  desc "Specify an optional minimum timeout (in seconds) for puppet to wait when syncing service properties"
275
- defaultto { provider.class.respond_to?(:default_timeout) ? provider.default_timeout : 10 }
276
- validate do |value|
277
- if (not value.is_a? Integer) || value < 1
275
+ defaultto { provider.respond_to?(:default_timeout) ? provider.default_timeout : 10 }
276
+
277
+ munge do |value|
278
+ begin
279
+ value = value.to_i
280
+ raise if value < 1
281
+ value
282
+ rescue
278
283
  raise Puppet::Error.new(_("\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer") % { value: value })
279
284
  end
280
285
  end
@@ -117,7 +117,7 @@ class Puppet::Util::Autoload
117
117
 
118
118
  # @api private
119
119
  def files_in_dir(dir, path)
120
- dir = Pathname.new(File.expand_path(dir))
120
+ dir = Pathname.new(Puppet::FileSystem.expand_path(dir))
121
121
  Dir.glob(File.join(dir, path, "*.rb")).collect do |file|
122
122
  Pathname.new(file).relative_path_from(dir).to_s
123
123
  end
@@ -60,6 +60,9 @@ module Puppet::Util
60
60
  def self.dump(object, options = {})
61
61
  if defined? MultiJson
62
62
  MultiJson.dump(object, options)
63
+ elsif options.is_a?(JSON::State)
64
+ # we're being called recursively
65
+ object.to_json(options)
63
66
  else
64
67
  options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
65
68
  object.to_json(options)
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '7.11.0'
9
+ PUPPETVERSION = '7.12.0'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and