puppet 5.5.7 → 5.5.8

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/Rakefile +2 -1
  4. data/lib/puppet/defaults.rb +4 -2
  5. data/lib/puppet/face/config.rb +1 -1
  6. data/lib/puppet/file_bucket/dipper.rb +1 -1
  7. data/lib/puppet/functions.rb +0 -123
  8. data/lib/puppet/loaders.rb +0 -1
  9. data/lib/puppet/parser/functions.rb +1 -3
  10. data/lib/puppet/pops/evaluator/runtime3_converter.rb +0 -16
  11. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -3
  12. data/lib/puppet/pops/loader/loader.rb +1 -1
  13. data/lib/puppet/pops/loader/loader_paths.rb +1 -3
  14. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  15. data/lib/puppet/pops/loaders.rb +21 -5
  16. data/lib/puppet/provider/group/aix.rb +31 -1
  17. data/lib/puppet/provider/group/pw.rb +8 -4
  18. data/lib/puppet/provider/group/windows_adsi.rb +4 -3
  19. data/lib/puppet/provider/nameservice/directoryservice.rb +3 -5
  20. data/lib/puppet/provider/package/dnf.rb +1 -0
  21. data/lib/puppet/provider/user/useradd.rb +2 -10
  22. data/lib/puppet/type/group.rb +41 -57
  23. data/lib/puppet/util/filetype.rb +21 -5
  24. data/lib/puppet/util/log/destinations.rb +3 -2
  25. data/lib/puppet/util/windows/adsi.rb +0 -2
  26. data/lib/puppet/version.rb +1 -1
  27. data/locales/puppet.pot +76 -92
  28. data/man/man5/puppet.conf.5 +1 -1
  29. data/man/man8/puppet-config.8 +1 -1
  30. data/man/man8/puppet.8 +1 -1
  31. data/spec/integration/util/windows/adsi_spec.rb +1 -2
  32. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +6 -6
  33. data/spec/unit/pops/loaders/loaders_spec.rb +7 -39
  34. data/spec/unit/provider/cron/parsed_spec.rb +7 -9
  35. data/spec/unit/provider/group/aix_spec.rb +33 -0
  36. data/spec/unit/provider/group/pw_spec.rb +6 -0
  37. data/spec/unit/provider/group/windows_adsi_spec.rb +33 -23
  38. data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
  39. data/spec/unit/provider/package/dnf_spec.rb +15 -0
  40. data/spec/unit/provider/user/useradd_spec.rb +2 -2
  41. data/spec/unit/type/group_spec.rb +18 -108
  42. data/spec/unit/util/log/destinations_spec.rb +10 -0
  43. data/spec/unit/util/suidmanager_spec.rb +1 -3
  44. data/spec/unit/util/windows/adsi_spec.rb +5 -5
  45. metadata +2 -3
  46. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cceb57d43e4649d9d87857816df85b524c45d3004bb5a969d60d4de64b404e6
4
- data.tar.gz: 280065891b1ef83fab160ab18b617bf8a887ccb57071279397f64c8078b4c5f9
3
+ metadata.gz: 32bd704ec12c9b090ed9beb7ad4e5bf6892224adebee36578a43d84a6fc5a378
4
+ data.tar.gz: 300d5a99b06571c6fb8739ba1a111a868f0224bec29bbea22be8802bf202c6e2
5
5
  SHA512:
6
- metadata.gz: e25e640aad21a48ba030c166014d555394ac225131d01c49817ca28c5534153d795ae2b58f53632a2e373742eaa13ca11c88ed0614787da6343fdb73dfa4c330
7
- data.tar.gz: 4d3749159a0a3ce8db3913f269d3ad9d219f511e57d887c06a4a1dce4887697c0cb1184546958d9e1a4aed940c01cef73b193757ce3d5186d32aebc15111a7cc
6
+ metadata.gz: 02df788b21ae421cd532aa0183e54a463dbad017fc849a427d77abce6800a2aedd6d0ffa36d06d83ca1a63ff2159ac33a9dbe36601694a489780425561fe42a9
7
+ data.tar.gz: 19175679dfb8d0199b157cf3919dcba6506e0cbb9bacd6c2eb71640d34e9b9054382155859b49c140476e717ffa0fcb71d99022ac9816b178f6d7b8c581e4e9a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (5.5.6)
4
+ puppet (5.5.8)
5
5
  CFPropertyList (~> 2.2)
6
6
  facter (>= 2.0.1, < 4)
7
7
  fast_gettext (~> 1.1.2)
@@ -52,7 +52,7 @@ GEM
52
52
  multi_json (1.13.1)
53
53
  mustache (1.1.0)
54
54
  net-ssh (4.2.0)
55
- packaging (0.99.14)
55
+ packaging (0.99.16)
56
56
  artifactory
57
57
  rake (~> 12.3)
58
58
  parallel (1.12.1)
data/Rakefile CHANGED
@@ -73,7 +73,7 @@ task(:commits) do
73
73
  %x{git log --no-merges --pretty=%s #{commit_range}}.each_line do |commit_summary|
74
74
  # This regex tests for the currently supported commit summary tokens: maint, doc, packaging, or pup-<number>.
75
75
  # The exception tries to explain it in more full.
76
- if /^\((maint|doc|docs|packaging|pup-\d+)\)|revert/i.match(commit_summary).nil?
76
+ if /^\((maint|doc|docs|packaging|l10n|pup-\d+)\)|revert/i.match(commit_summary).nil?
77
77
  raise "\n\n\n\tThis commit summary didn't match CONTRIBUTING.md guidelines:\n" \
78
78
  "\n\t\t#{commit_summary}\n" \
79
79
  "\tThe commit summary (i.e. the first line of the commit message) should start with one of:\n" \
@@ -82,6 +82,7 @@ task(:commits) do
82
82
  "\t\t(docs)(DOCUMENT-<digits>)\n" \
83
83
  "\t\t(maint)\n" \
84
84
  "\t\t(packaging)\n" \
85
+ "\t\t(L10n)\n" \
85
86
  "\n\tThis test for the commit summary is case-insensitive.\n\n\n"
86
87
  else
87
88
  puts "#{commit_summary}"
@@ -1067,7 +1067,7 @@ EOT
1067
1067
  :mode => "0640",
1068
1068
  :desc => "Where the CA stores the password for the private key. This setting is deprecated and will be removed in Puppet 6.",
1069
1069
  :hook => proc do |value|
1070
- Puppet.deprecation_warning(_("The 'caprivatedir' setting is deprecated and will be removed in Puppet 6."))
1070
+ Puppet.deprecation_warning(_("The 'capass' setting is deprecated and will be removed in Puppet 6."))
1071
1071
  end,
1072
1072
  },
1073
1073
  :serial => {
@@ -1305,8 +1305,10 @@ EOT
1305
1305
  :ca => {
1306
1306
  :default => true,
1307
1307
  :type => :boolean,
1308
- :deprecated => :completely,
1309
1308
  :desc => "Whether the master should function as a certificate authority.",
1309
+ :hook => proc do |value|
1310
+ Puppet.deprecation_warning(_("The 'ca' setting is deprecated and will be removed in Puppet 6."))
1311
+ end,
1310
1312
  },
1311
1313
  :trusted_oid_mapping_file => {
1312
1314
  :default => "$confdir/custom_trusted_oid_mapping.yaml",
@@ -210,7 +210,7 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
210
210
 
211
211
  action(:delete) do
212
212
  summary _("Delete a Puppet setting.")
213
- arguments _("(<setting>")
213
+ arguments _("<setting>")
214
214
  #TRANSLATORS 'main' is a specific section name and should not be translated
215
215
  description "Deletes a setting from the specified section. (The default is the section 'main')."
216
216
  notes <<-'EOT'
@@ -77,7 +77,7 @@ class Puppet::FileBucket::Dipper
77
77
  tmp_file.unlink
78
78
  end
79
79
  else
80
- raise Puppet::Error, _("Please provide a file or checksum do diff with")
80
+ raise Puppet::Error, _("Please provide a file or checksum to diff with")
81
81
  end
82
82
  elsif file_a
83
83
  if checksum_b
@@ -385,7 +385,6 @@ module Puppet::Functions
385
385
  end
386
386
  end
387
387
 
388
-
389
388
  # Public api methods of the DispatcherBuilder are available within dispatch()
390
389
  # blocks declared in a Puppet::Function.create_function() call.
391
390
  #
@@ -680,128 +679,6 @@ module Puppet::Functions
680
679
  end
681
680
  end
682
681
 
683
- class Function3x < InternalFunction
684
-
685
- # Table of optimized parameter names - 0 to 5 parameters
686
- PARAM_NAMES = [
687
- [],
688
- ['p0'.freeze].freeze,
689
- ['p0'.freeze, 'p1'.freeze].freeze,
690
- ['p0'.freeze, 'p1'.freeze, 'p2'.freeze].freeze,
691
- ['p0'.freeze, 'p1'.freeze, 'p2'.freeze, 'p3'.freeze].freeze,
692
- ['p0'.freeze, 'p1'.freeze, 'p2'.freeze, 'p3'.freeze, 'p4'.freeze].freeze,
693
- ]
694
-
695
- # Creates an anonymous Function3x class that wraps a 3x function
696
- #
697
- # @api private
698
- def self.create_function(func_name, func_info, loader)
699
- func_name = func_name.to_s
700
-
701
- # Creates an anonymous class to represent the function
702
- # The idea being that it is garbage collected when there are no more
703
- # references to it.
704
- #
705
- # (Do not give the class the block here, as instance variables should be set first)
706
- the_class = Class.new(Function3x)
707
-
708
- unless loader.nil?
709
- the_class.instance_variable_set(:'@loader', loader.private_loader)
710
- end
711
-
712
- the_class.instance_variable_set(:'@func_name', func_name)
713
- the_class.instance_variable_set(:'@method3x', :"function_#{func_name}")
714
-
715
- # Make the anonymous class appear to have the class-name <func_name>
716
- # Even if this class is not bound to such a symbol in a global ruby scope and
717
- # must be resolved via the loader.
718
- # This also overrides any attempt to define a name method in the given block
719
- # (Since it redefines it)
720
- #
721
- the_class.instance_eval do
722
- def name
723
- @func_name
724
- end
725
-
726
- def loader
727
- @loader
728
- end
729
-
730
- def method3x
731
- @method3x
732
- end
733
- end
734
-
735
- # Add the method that is called - it simply delegates to
736
- # the 3.x function by calling it via the calling scope using the @method3x symbol
737
- # :"function_#{name}".
738
- #
739
- # When function is not an rvalue function, make sure it produces nil
740
- #
741
- the_class.class_eval do
742
-
743
- # Bypasses making the call via the dispatcher to make sure errors
744
- # are reported exactly the same way as in 3x. The dispatcher is still needed as it is
745
- # used to support other features than calling.
746
- #
747
- def call(scope, *args, &block)
748
- begin
749
- result = catch(:return) do
750
- mapped_args = Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter.map_args(args, scope, '')
751
- # this is the scope.function_xxx(...) call
752
- return scope.send(self.class.method3x, mapped_args)
753
- end
754
- return result.value
755
- rescue Puppet::Pops::Evaluator::Next => jumper
756
- begin
757
- throw :next, jumper.value
758
- rescue Puppet::Parser::Scope::UNCAUGHT_THROW_EXCEPTION
759
- raise Puppet::ParseError.new("next() from context where this is illegal", jumper.file, jumper.line)
760
- end
761
- rescue Puppet::Pops::Evaluator::Return => jumper
762
- begin
763
- throw :return, jumper
764
- rescue Puppet::Parser::Scope::UNCAUGHT_THROW_EXCEPTION
765
- raise Puppet::ParseError.new("return() from context where this is illegal", jumper.file, jumper.line)
766
- end
767
- end
768
- end
769
- end
770
-
771
- # Create a dispatcher based on func_info
772
- type, names = Puppet::Functions.any_signature(*from_to_names(func_info))
773
- last_captures_rest = (type.size_range[1] == Float::INFINITY)
774
-
775
- # The method '3x_function' here is a dummy as the dispatcher is not used for calling, only for information.
776
- the_class.dispatcher.add(Puppet::Pops::Functions::Dispatch.new(type, '3x_function', names, last_captures_rest))
777
- # The function class is returned as the result of the create function method
778
- the_class
779
- end
780
-
781
- # Compute min and max number of arguments and a list of constructed
782
- # parameter names p0 - pn (since there are no parameter names in 3x functions).
783
- #
784
- # @api private
785
- def self.from_to_names(func_info)
786
- arity = func_info[:arity]
787
- if arity.nil?
788
- arity = -1
789
- end
790
- if arity < 0
791
- from = -arity - 1 # arity -1 is 0 min param, -2 is min 1 param
792
- to = :default # infinite range
793
- count = -arity # the number of named parameters
794
- else
795
- count = from = to = arity
796
- end
797
- # Names of parameters, up to 5 are optimized and use frozen version
798
- # Note that (0..count-1) produces expected empty array for count == 0, 0-n for count >= 1
799
- names = count <= 5 ? PARAM_NAMES[count] : (0..count-1).map {|n| "p#{n}" }
800
- [from, to, names]
801
- end
802
- end
803
-
804
-
805
682
  # Injection and Weaving of parameters
806
683
  # ---
807
684
  # It is possible to inject and weave a set of well known parameters into a call.
@@ -13,7 +13,6 @@ module Puppet
13
13
  require 'puppet/pops/loader/static_loader'
14
14
  require 'puppet/pops/loader/runtime3_type_loader'
15
15
  require 'puppet/pops/loader/ruby_function_instantiator'
16
- require 'puppet/pops/loader/ruby_legacy_function_instantiator'
17
16
  require 'puppet/pops/loader/ruby_data_type_instantiator'
18
17
  require 'puppet/pops/loader/puppet_function_instantiator'
19
18
  require 'puppet/pops/loader/type_definition_instantiator'
@@ -171,9 +171,7 @@ module Puppet::Parser::Functions
171
171
  elsif arity < 0 and args[0].size < (arity+1).abs
172
172
  raise ArgumentError, _("%{name}(): Wrong number of arguments given (%{arg_count} for minimum %{min_arg_count})") % { name: name, arg_count: args[0].size, min_arg_count: (arity+1).abs }
173
173
  end
174
- r = Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter.convert_return(self.send(real_fname, args[0]))
175
- # avoid leaking aribtrary value if not being an rvalue function
176
- options[:type] == :rvalue ? r : nil
174
+ self.send(real_fname, args[0])
177
175
  else
178
176
  raise ArgumentError, _("custom functions must be called with a single array that contains the arguments. For example, function_example([1]) instead of function_example(1)")
179
177
  end
@@ -196,22 +196,6 @@ class Runtime3FunctionArgumentConverter < Runtime3Converter
196
196
  o.to_s
197
197
  end
198
198
 
199
- # Converts result back to 4.x by replacing :undef with nil in Array and Hash objects
200
- #
201
- def self.convert_return(val3x)
202
- if val3x == :undef
203
- nil
204
- elsif val3x.is_a?(Array)
205
- val3x.map {|v| convert_return(v) }
206
- elsif val3x.is_a?(Hash)
207
- hsh = {}
208
- val3x.each_pair {|k,v| hsh[convert_return(k)] = convert_return(v)}
209
- hsh
210
- else
211
- val3x
212
- end
213
- end
214
-
215
199
  @instance = self.new
216
200
  end
217
201
 
@@ -305,14 +305,15 @@ module Runtime3Support
305
305
  return Kernel.eval('_func.call(scope, *args, &block)'.freeze, Kernel.binding, file || '', line)
306
306
  end
307
307
  end
308
- # Call via 3x API if function exists there without having been autoloaded
308
+ # Call via 3x API if function exists there
309
309
  fail(Issues::UNKNOWN_FUNCTION, o, {:name => name}) unless Puppet::Parser::Functions.function(name)
310
310
 
311
311
  # Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.
312
312
  # NOTE: Passing an empty string last converts nil/:undef to empty string
313
313
  mapped_args = Runtime3FunctionArgumentConverter.map_args(args, scope, '')
314
- # The 3x function performs return value mapping and returns nil if it is not of rvalue type
315
- Puppet::Pops::PuppetStack.stack(file, line, scope, "function_#{name}", [mapped_args], &block)
314
+ result = Puppet::Pops::PuppetStack.stack(file, line, scope, "function_#{name}", [mapped_args], &block)
315
+ # Prevent non r-value functions from leaking their result (they are not written to care about this)
316
+ Puppet::Parser::Functions.rvalue?(name) ? result : nil
316
317
  end
317
318
 
318
319
  # The o is used for source reference
@@ -29,7 +29,7 @@ class Loader
29
29
  attr_reader :loader_name
30
30
 
31
31
  # Describes the kinds of things that loaders can load
32
- LOADABLE_KINDS = [:func_4x, :func_4xpp, :func_3x, :datatype, :type_pp, :resource_type_pp, :plan, :task].freeze
32
+ LOADABLE_KINDS = [:func_4x, :func_4xpp, :datatype, :type_pp, :resource_type_pp, :plan, :task].freeze
33
33
 
34
34
  # @param [String] name the name of the loader. Must be unique among all loaders maintained by a {Loader} instance
35
35
  def initialize(loader_name)
@@ -25,9 +25,7 @@ module LoaderPaths
25
25
  if loader.loadables.include?(:func_4xpp)
26
26
  result << FunctionPathPP.new(loader)
27
27
  end
28
- if loader.loadables.include?(:func_3x)
29
- result << FunctionPath3x.new(loader)
30
- end
28
+ # When wanted also add FunctionPath3x to load 3x functions
31
29
  when :plan
32
30
  result << PlanPathPP.new(loader)
33
31
  when :task
@@ -31,7 +31,7 @@ module ModuleLoaders
31
31
  nil,
32
32
  puppet_lib, # may or may not have a 'lib' above 'puppet'
33
33
  'puppet_system',
34
- [:func_4x, :func_3x, :datatype] # only load ruby functions and types from "puppet"
34
+ [:func_4x, :datatype] # only load ruby functions and types from "puppet"
35
35
  )
36
36
  end
37
37
 
@@ -505,8 +505,8 @@ class Loaders
505
505
  nil
506
506
  else
507
507
  module_data.private_loader =
508
- if module_data.restrict_to_dependencies?
509
- create_loader_with_dependencies_first(module_data)
508
+ if module_data.restrict_to_dependencies? && !Puppet[:tasks]
509
+ create_loader_with_only_dependencies_visible(module_data)
510
510
  else
511
511
  create_loader_with_all_modules_visible(module_data)
512
512
  end
@@ -516,13 +516,29 @@ class Loaders
516
516
  private
517
517
 
518
518
  def create_loader_with_all_modules_visible(from_module_data)
519
+ Puppet.debug{"ModuleLoader: module '#{from_module_data.name}' has unknown dependencies - it will have all other modules visible"}
520
+
519
521
  @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", all_module_loaders()))
520
522
  end
521
523
 
522
- def create_loader_with_dependencies_first(from_module_data)
524
+ def create_loader_with_only_dependencies_visible(from_module_data)
525
+ if from_module_data.unmet_dependencies?
526
+ if Puppet[:strict] != :off
527
+ msg = "ModuleLoader: module '#{from_module_data.name}' has unresolved dependencies" \
528
+ " - it will only see those that are resolved." \
529
+ " Use 'puppet module list --tree' to see information about modules"
530
+ case Puppet[:strict]
531
+ when :error
532
+ raise LoaderError.new(msg)
533
+ when :warning
534
+ Puppet.warn_once(:unresolved_module_dependencies,
535
+ "unresolved_dependencies_for_module_#{from_module_data.name}",
536
+ msg)
537
+ end
538
+ end
539
+ end
523
540
  dependency_loaders = from_module_data.dependency_names.collect { |name| @index[name].public_loader }
524
- visible_loaders = dependency_loaders + (all_module_loaders() - dependency_loaders)
525
- @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", visible_loaders))
541
+ @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", dependency_loaders))
526
542
  end
527
543
  end
528
544
  end
@@ -53,10 +53,30 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
53
53
 
54
54
  group_hash
55
55
  end
56
+
57
+ # Define some Puppet Property => AIX Attribute (and vice versa)
58
+ # conversion functions here. This is so we can unit test them.
59
+
60
+ def members_to_users(provider, members)
61
+ members = members.split(',') if members.is_a?(String)
62
+ unless provider.resource[:auth_membership]
63
+ current_members = provider.members
64
+ current_members = [] if current_members == :absent
65
+ members = (members + current_members).uniq
66
+ end
67
+
68
+ members.join(',')
69
+ end
70
+
71
+ def users_to_members(users)
72
+ users.split(',')
73
+ end
56
74
  end
57
75
 
58
76
  mapping puppet_property: :members,
59
- aix_attribute: :users
77
+ aix_attribute: :users,
78
+ property_to_attribute: method(:members_to_users),
79
+ attribute_to_property: method(:users_to_members)
60
80
 
61
81
  numeric_mapping puppet_property: :gid,
62
82
  aix_attribute: :id
@@ -65,4 +85,14 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
65
85
  # the resource methods (property getters + setters for our mapped
66
86
  # properties + a getter for the attributes property).
67
87
  mk_resource_methods
88
+
89
+ # We could add this to the top-level members property since the
90
+ # implementation is not platform-specific; however, it is best
91
+ # to do it this way so that we do not accidentally break something.
92
+ # This is ok for now, since we do plan on moving this and the
93
+ # auth_membership management over to the property class in a future
94
+ # Puppet release.
95
+ def members_insync?(current, should)
96
+ current.sort == @resource.parameter(:members).actual_should(current, should)
97
+ end
68
98
  end
@@ -9,10 +9,7 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
9
9
  defaultfor :operatingsystem => [:freebsd, :dragonfly]
10
10
  confine :operatingsystem => [:freebsd, :dragonfly]
11
11
 
12
- options :members,
13
- :flag => "-M",
14
- :method => :mem,
15
- :unmunge => proc { |members| members.join(',') }
12
+ options :members, :flag => "-M", :method => :mem
16
13
 
17
14
  verify :gid, _("GID must be an integer") do |value|
18
15
  value.is_a? Integer
@@ -29,6 +26,9 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
29
26
 
30
27
  if members = @resource.should(:members)
31
28
  unless members == :absent
29
+ if members.is_a?(Array)
30
+ members = members.join(",")
31
+ end
32
32
  cmd << "-M" << members
33
33
  end
34
34
  end
@@ -39,6 +39,10 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService:
39
39
  end
40
40
 
41
41
  def modifycmd(param, value)
42
+ # members may be an array, need a comma separated list
43
+ if param == :members and value.is_a?(Array)
44
+ value = value.join(",")
45
+ end
42
46
  super(param, value)
43
47
  end
44
48
  end