puppet 8.2.0-x86-mingw32 → 8.3.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +16 -16
  4. data/ext/project_data.yaml +2 -2
  5. data/lib/puppet/application/doc.rb +1 -1
  6. data/lib/puppet/application/ssl.rb +42 -7
  7. data/lib/puppet/application.rb +5 -1
  8. data/lib/puppet/defaults.rb +5 -5
  9. data/lib/puppet/face/config.rb +1 -1
  10. data/lib/puppet/face/epp.rb +2 -2
  11. data/lib/puppet/face/module/list.rb +2 -2
  12. data/lib/puppet/face/parser.rb +1 -1
  13. data/lib/puppet/functions/split.rb +28 -1
  14. data/lib/puppet/indirector/facts/facter.rb +1 -1
  15. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  16. data/lib/puppet/indirector/indirection.rb +1 -1
  17. data/lib/puppet/info_service/task_information_service.rb +1 -1
  18. data/lib/puppet/module_tool.rb +1 -1
  19. data/lib/puppet/network/formats.rb +3 -3
  20. data/lib/puppet/network/http/memory_response.rb +1 -1
  21. data/lib/puppet/parameter/value_collection.rb +1 -1
  22. data/lib/puppet/parser/files.rb +4 -3
  23. data/lib/puppet/parser/functions.rb +1 -1
  24. data/lib/puppet/pops/loader/loader_paths.rb +4 -4
  25. data/lib/puppet/pops/lookup/explainer.rb +1 -1
  26. data/lib/puppet/pops/lookup/hiera_config.rb +1 -1
  27. data/lib/puppet/pops/model/factory.rb +1 -1
  28. data/lib/puppet/pops/model/tree_dumper.rb +1 -1
  29. data/lib/puppet/pops/parser/epp_support.rb +1 -1
  30. data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
  31. data/lib/puppet/pops/parser/pn_parser.rb +1 -1
  32. data/lib/puppet/pops/pn.rb +1 -1
  33. data/lib/puppet/pops/serialization/json_path.rb +1 -1
  34. data/lib/puppet/pops/time/timespan.rb +4 -4
  35. data/lib/puppet/pops/types/ruby_generator.rb +2 -2
  36. data/lib/puppet/pops/types/string_converter.rb +6 -6
  37. data/lib/puppet/pops/types/type_formatter.rb +2 -2
  38. data/lib/puppet/pops/types/types.rb +1 -1
  39. data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
  40. data/lib/puppet/provider/package/apt.rb +1 -1
  41. data/lib/puppet/provider/package/dnf.rb +1 -1
  42. data/lib/puppet/provider/package/yum.rb +1 -1
  43. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  44. data/lib/puppet/reference/configuration.rb +1 -1
  45. data/lib/puppet/reference/indirection.rb +1 -1
  46. data/lib/puppet/reports.rb +1 -1
  47. data/lib/puppet/transaction/report.rb +1 -1
  48. data/lib/puppet/type/filebucket.rb +1 -1
  49. data/lib/puppet/util/diff.rb +1 -1
  50. data/lib/puppet/util/execution.rb +9 -4
  51. data/lib/puppet/util/inifile.rb +2 -2
  52. data/lib/puppet/util/monkey_patches.rb +18 -0
  53. data/lib/puppet/util/package/version/rpm.rb +1 -1
  54. data/lib/puppet/util/provider_features.rb +1 -1
  55. data/lib/puppet/util/selinux.rb +1 -1
  56. data/lib/puppet/util/windows/access_control_entry.rb +1 -1
  57. data/lib/puppet/util/windows/access_control_list.rb +1 -1
  58. data/lib/puppet/util/windows/adsi.rb +9 -2
  59. data/lib/puppet/util/windows/error.rb +1 -1
  60. data/lib/puppet/util/windows/file.rb +2 -2
  61. data/lib/puppet/util/windows/process.rb +1 -1
  62. data/lib/puppet/util/windows/sid.rb +4 -2
  63. data/lib/puppet/util.rb +2 -3
  64. data/lib/puppet/version.rb +1 -1
  65. data/lib/puppet/x509/cert_provider.rb +6 -2
  66. data/locales/puppet.pot +40 -32
  67. data/man/man5/puppet.conf.5 +3 -3
  68. data/man/man8/puppet-agent.8 +1 -1
  69. data/man/man8/puppet-apply.8 +1 -1
  70. data/man/man8/puppet-catalog.8 +1 -1
  71. data/man/man8/puppet-config.8 +1 -1
  72. data/man/man8/puppet-describe.8 +1 -1
  73. data/man/man8/puppet-device.8 +1 -1
  74. data/man/man8/puppet-doc.8 +1 -1
  75. data/man/man8/puppet-epp.8 +1 -1
  76. data/man/man8/puppet-facts.8 +1 -1
  77. data/man/man8/puppet-filebucket.8 +1 -1
  78. data/man/man8/puppet-generate.8 +1 -1
  79. data/man/man8/puppet-help.8 +1 -1
  80. data/man/man8/puppet-lookup.8 +1 -1
  81. data/man/man8/puppet-module.8 +1 -1
  82. data/man/man8/puppet-node.8 +1 -1
  83. data/man/man8/puppet-parser.8 +1 -1
  84. data/man/man8/puppet-plugin.8 +1 -1
  85. data/man/man8/puppet-report.8 +1 -1
  86. data/man/man8/puppet-resource.8 +1 -1
  87. data/man/man8/puppet-script.8 +1 -1
  88. data/man/man8/puppet-ssl.8 +5 -1
  89. data/man/man8/puppet.8 +2 -2
  90. data/spec/integration/type/exec_spec.rb +13 -0
  91. data/spec/lib/puppet_spec/verbose.rb +10 -1
  92. data/spec/unit/agent_spec.rb +2 -9
  93. data/spec/unit/application/ssl_spec.rb +49 -0
  94. data/spec/unit/functions/split_spec.rb +6 -0
  95. data/spec/unit/info_service_spec.rb +1 -1
  96. data/spec/unit/ssl/certificate_signer_spec.rb +17 -0
  97. data/spec/unit/ssl/ssl_provider_spec.rb +1 -1
  98. data/spec/unit/util/execution_spec.rb +1 -0
  99. data/spec/unit/util/monkey_patches_spec.rb +42 -0
  100. data/spec/unit/util/windows/adsi_spec.rb +25 -0
  101. metadata +9 -13
@@ -545,7 +545,7 @@ module Time
545
545
  end
546
546
 
547
547
  def format(timespan)
548
- bld = String.new(timespan.negative? ? '-' : '')
548
+ bld = timespan.negative? ? '-'.dup : ''.dup
549
549
  @segments.each { |segment| segment.append_to(bld, timespan) }
550
550
  bld
551
551
  end
@@ -575,7 +575,7 @@ module Time
575
575
  end
576
576
 
577
577
  def build_regexp
578
- bld = String.new('\A-?')
578
+ bld = '\A-?'.dup
579
579
  @segments.each { |segment| segment.append_regexp(bld) }
580
580
  bld << '\z'
581
581
  Regexp.new(bld)
@@ -613,7 +613,7 @@ module Time
613
613
 
614
614
  def append_literal(bld, codepoint)
615
615
  if bld.empty? || !bld.last.is_a?(Format::LiteralSegment)
616
- bld << Format::LiteralSegment.new(String.new.concat(codepoint))
616
+ bld << Format::LiteralSegment.new(''.dup.concat(codepoint))
617
617
  else
618
618
  bld.last.concat(codepoint)
619
619
  end
@@ -634,7 +634,7 @@ module Time
634
634
  position = -1
635
635
  fstart = 0
636
636
 
637
- str.codepoints do |codepoint|
637
+ str.each_codepoint do |codepoint|
638
638
  position += 1
639
639
  if state == STATE_LITERAL
640
640
  if codepoint == 0x25 # '%'
@@ -60,7 +60,7 @@ class RubyGenerator < TypeFormatter
60
60
  if cls.nil?
61
61
  rp = key.resolved_parent
62
62
  parent_class = rp.is_a?(PObjectType) ? rp.implementation_class : Object
63
- class_def = String.new
63
+ class_def = ''.dup
64
64
  class_body(key, EMPTY_ARRAY, class_def)
65
65
  cls = Class.new(parent_class)
66
66
  cls.class_eval(class_def)
@@ -109,7 +109,7 @@ class RubyGenerator < TypeFormatter
109
109
  end
110
110
 
111
111
  # Create class definition of all contained types
112
- bld = String.new
112
+ bld = ''.dup
113
113
  start_module(common_prefix, comment, bld)
114
114
  class_names = []
115
115
  names_by_prefix.each_pair do |seg_array, index_and_name_array|
@@ -701,7 +701,7 @@ class StringConverter
701
701
  # Performs post-processing of literals to apply width and precision flags
702
702
  def apply_string_flags(f, literal_str)
703
703
  if f.left || f.width || f.prec
704
- fmt = String.new('%')
704
+ fmt = '%'.dup
705
705
  fmt << '-' if f.left
706
706
  fmt << f.width.to_s if f.width
707
707
  fmt << '.' << f.prec.to_s if f.prec
@@ -853,7 +853,7 @@ class StringConverter
853
853
  end
854
854
 
855
855
  # Assume that the string can be single quoted
856
- bld = String.new('\'')
856
+ bld = "'".dup
857
857
  bld.force_encoding(str.encoding)
858
858
  escaped = false
859
859
  str.each_codepoint do |codepoint|
@@ -879,12 +879,12 @@ class StringConverter
879
879
  # If string ended with a backslash, then that backslash must be escaped
880
880
  bld << 0x5c if escaped
881
881
 
882
- bld << '\''
882
+ bld << "'"
883
883
  bld
884
884
  end
885
885
 
886
886
  def puppet_double_quote(str)
887
- bld = String.new('"')
887
+ bld = '"'.dup
888
888
  str.each_codepoint do |codepoint|
889
889
  case codepoint
890
890
  when 0x09
@@ -940,7 +940,7 @@ class StringConverter
940
940
 
941
941
  case format.format
942
942
  when :a, :s, :p
943
- buf = String.new
943
+ buf = ''.dup
944
944
  if indentation.breaks?
945
945
  buf << "\n"
946
946
  buf << indentation.padding
@@ -1055,7 +1055,7 @@ class StringConverter
1055
1055
 
1056
1056
  when :h, :s, :p
1057
1057
  indentation = indentation.indenting(format.alt? || indentation.is_indenting?)
1058
- buf = String.new
1058
+ buf = ''.dup
1059
1059
  if indentation.breaks?
1060
1060
  buf << "\n"
1061
1061
  buf << indentation.padding
@@ -50,7 +50,7 @@ class TypeFormatter
50
50
  # @api public
51
51
  #
52
52
  def string(t)
53
- @bld = String.new
53
+ @bld = ''.dup
54
54
  append_string(t)
55
55
  @bld
56
56
  end
@@ -64,7 +64,7 @@ class TypeFormatter
64
64
  #
65
65
  # @api public
66
66
  def indented_string(t, indent = 0, indent_width = 2)
67
- @bld = String.new
67
+ @bld = ''.dup
68
68
  append_indented_string(t, indent, indent_width)
69
69
  @bld
70
70
  end
@@ -1713,7 +1713,7 @@ class PRegexpType < PScalarType
1713
1713
  if options == 0
1714
1714
  rx_string
1715
1715
  else
1716
- bld = String.new('(?')
1716
+ bld = '(?'.dup
1717
1717
  bld << 'i' if (options & Regexp::IGNORECASE) != 0
1718
1718
  bld << 'm' if (options & Regexp::MULTILINE) != 0
1719
1719
  bld << 'x' if (options & Regexp::EXTENDED) != 0
@@ -218,8 +218,8 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
218
218
  password_hash_plist = users_plist['ShadowHashData'][0]
219
219
  converted_hash_plist = convert_binary_to_hash(password_hash_plist)
220
220
  else
221
- users_plist['ShadowHashData'] = String.new
222
- converted_hash_plist = {'SALTED-SHA512' => String.new}
221
+ users_plist['ShadowHashData'] = ''.dup
222
+ converted_hash_plist = {'SALTED-SHA512' => ''.dup}
223
223
  end
224
224
 
225
225
  # converted_hash_plist['SALTED-SHA512'] expects a Base64 encoded
@@ -13,7 +13,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
13
13
  These options should be specified as an array where each element is either a
14
14
  string or a hash."
15
15
 
16
- has_feature :versionable, :install_options, :virtual_packages
16
+ has_feature :versionable, :install_options, :virtual_packages, :version_ranges
17
17
 
18
18
  commands :aptget => "/usr/bin/apt-get"
19
19
  commands :aptcache => "/usr/bin/apt-cache"
@@ -10,7 +10,7 @@ Puppet::Type.type(:package).provide :dnf, :parent => :yum do
10
10
  These options should be specified as an array where each element is either
11
11
  a string or a hash."
12
12
 
13
- has_feature :install_options, :versionable, :virtual_packages, :install_only
13
+ has_feature :install_options, :versionable, :virtual_packages, :install_only, :version_ranges
14
14
 
15
15
  commands :cmd => "dnf", :rpm => "rpm"
16
16
 
@@ -16,7 +16,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
16
16
  This provider supports the `install_options` attribute, which allows command-line flags to be passed to yum.
17
17
  These options should be specified as an array where each element is either a string or a hash."
18
18
 
19
- has_feature :install_options, :versionable, :virtual_packages, :install_only
19
+ has_feature :install_options, :versionable, :virtual_packages, :install_only, :version_ranges
20
20
 
21
21
  RPM_VERSION = Puppet::Util::Package::Version::Rpm
22
22
  RPM_VERSION_RANGE = Puppet::Util::Package::Version::Range
@@ -637,7 +637,7 @@ Puppet::Type.type(:user).provide :directoryservice do
637
637
  def set_salted_sha512(users_plist, shadow_hash_data, value)
638
638
  unless shadow_hash_data
639
639
  shadow_hash_data = Hash.new
640
- shadow_hash_data['SALTED-SHA512'] = String.new
640
+ shadow_hash_data['SALTED-SHA512'] = ''.dup
641
641
  end
642
642
  shadow_hash_data['SALTED-SHA512'] = base64_decode_string(value)
643
643
  binary_plist = self.class.convert_hash_to_binary(shadow_hash_data)
@@ -5,7 +5,7 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
5
5
  docs[name] = object
6
6
  end
7
7
 
8
- str = String.new
8
+ str = ''.dup
9
9
  docs.sort { |a, b|
10
10
  a[0].to_s <=> b[0].to_s
11
11
  }.each do |name, object|
@@ -5,7 +5,7 @@ require_relative '../../puppet/file_serving/content'
5
5
  require_relative '../../puppet/file_serving/metadata'
6
6
 
7
7
  reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirection types and their terminus classes" do
8
- text = String.new
8
+ text = ''.dup
9
9
  Puppet::Indirector::Indirection.instances.sort_by(&:to_s).each do |indirection|
10
10
  ind = Puppet::Indirector::Indirection.instance(indirection)
11
11
  name = indirection.to_s.capitalize
@@ -71,7 +71,7 @@ class Puppet::Reports
71
71
  # Collects the docs for all reports.
72
72
  # @api private
73
73
  def self.reportdocs
74
- docs = String.new
74
+ docs = ''.dup
75
75
 
76
76
  # Use this method so they all get loaded
77
77
  instance_loader(:report).loadall(Puppet.lookup(:current_environment))
@@ -369,7 +369,7 @@ class Puppet::Transaction::Report
369
369
  def summary
370
370
  report = raw_summary
371
371
 
372
- ret = String.new
372
+ ret = ''.dup
373
373
  report.keys.sort_by(&:to_s).each do |key|
374
374
  ret += "#{Puppet::Util::Metric.labelize(key)}:\n"
375
375
 
@@ -4,7 +4,7 @@ module Puppet
4
4
 
5
5
  Type.newtype(:filebucket) do
6
6
  @doc = <<-EOT
7
- A repository for storing and retrieving file content by MD5 checksum. Can
7
+ A repository for storing and retrieving file content by cryptographic checksum. Can
8
8
  be local to each agent node, or centralized on a primary Puppet server. All
9
9
  puppet servers provide a filebucket service that agent nodes can access
10
10
  via HTTP, but you must declare a filebucket resource before any agents
@@ -34,7 +34,7 @@ module Puppet::Util::Diff
34
34
  data_old = data_old.split(/\n/).map! { |e| e.chomp }
35
35
  data_new = data_new.split(/\n/).map! { |e| e.chomp }
36
36
 
37
- output = String.new
37
+ output = ''.dup
38
38
 
39
39
  diffs = ::Diff::LCS.diff(data_old, data_new)
40
40
  return output if diffs.empty?
@@ -162,7 +162,7 @@ module Puppet::Util::Execution
162
162
  # do this after processing 'command' array or string
163
163
  command_str = '[redacted]' if options[:sensitive]
164
164
 
165
- user_log_s = String.new
165
+ user_log_s = ''.dup
166
166
  if options[:uid]
167
167
  user_log_s << " uid=#{options[:uid]}"
168
168
  end
@@ -202,7 +202,7 @@ module Puppet::Util::Execution
202
202
  stderr = options[:combine] ? stdout : Puppet::FileSystem.open(null_file, nil, 'w')
203
203
 
204
204
  exec_args = [command, options, stdin, stdout, stderr]
205
- output = String.new
205
+ output = ''.dup
206
206
 
207
207
  # We close stdin/stdout/stderr immediately after fork/exec as they're no longer needed by
208
208
  # this process. In most cases they could be closed later, but when `stdout` is the "writer"
@@ -223,8 +223,12 @@ module Puppet::Util::Execution
223
223
  # Use non-blocking read to check for data. After each attempt,
224
224
  # check whether the child is done. This is done in case the child
225
225
  # forks and inherits stdout, as happens in `foo &`.
226
-
227
- until results = Process.waitpid2(child_pid, Process::WNOHANG) #rubocop:disable Lint/AssignmentInCondition
226
+ # If we encounter EOF, though, then switch to a blocking wait for
227
+ # the child; after EOF, IO.select will never block and the loop
228
+ # below will use maximum CPU available.
229
+
230
+ wait_flags = Process::WNOHANG
231
+ until results = Process.waitpid2(child_pid, wait_flags) #rubocop:disable Lint/AssignmentInCondition
228
232
 
229
233
  # If not done, wait for data to read with a timeout
230
234
  # This timeout is selected to keep activity low while waiting on
@@ -235,6 +239,7 @@ module Puppet::Util::Execution
235
239
  output << reader.read_nonblock(4096) if ready
236
240
  rescue Errno::EAGAIN
237
241
  rescue EOFError
242
+ wait_flags = 0
238
243
  end
239
244
  end
240
245
 
@@ -79,7 +79,7 @@ module Puppet::Util::IniConfig
79
79
  # written to file
80
80
  def format
81
81
  if @destroy
82
- text = String.new
82
+ text = ''.dup
83
83
  else
84
84
  text = "[#{name}]\n"
85
85
  @entries.each do |entry|
@@ -208,7 +208,7 @@ module Puppet::Util::IniConfig
208
208
  end
209
209
 
210
210
  def format
211
- text = String.new
211
+ text = ''.dup
212
212
 
213
213
  @contents.each do |content|
214
214
  if content.is_a? Section
@@ -30,6 +30,24 @@ class Object
30
30
  end
31
31
  end
32
32
 
33
+ unless Dir.singleton_methods.include?(:exists?)
34
+ class Dir
35
+ def self.exists?(file_name)
36
+ warn("Dir.exists?('#{file_name}') is deprecated, use Dir.exist? instead") if $VERBOSE
37
+ Dir.exist?(file_name)
38
+ end
39
+ end
40
+ end
41
+
42
+ unless File.singleton_methods.include?(:exists?)
43
+ class File
44
+ def self.exists?(file_name)
45
+ warn("File.exists?('#{file_name}') is deprecated, use File.exist? instead") if $VERBOSE
46
+ File.exist?(file_name)
47
+ end
48
+ end
49
+ end
50
+
33
51
  require_relative '../../puppet/ssl/openssl_loader'
34
52
  unless Puppet::Util::Platform.jruby_fips?
35
53
  class OpenSSL::SSL::SSLContext
@@ -19,7 +19,7 @@ module Puppet::Util::Package::Version
19
19
  end
20
20
 
21
21
  def to_s
22
- version_found = String.new
22
+ version_found = ''.dup
23
23
  version_found += "#{@epoch}:" if @epoch
24
24
  version_found += @version
25
25
  version_found += "-#{@release}" if @release
@@ -76,7 +76,7 @@ module Puppet::Util::ProviderFeatures
76
76
 
77
77
  # @return [String] Returns a string with documentation covering all features.
78
78
  def featuredocs
79
- str = String.new
79
+ str = ''.dup
80
80
  @features ||= {}
81
81
  return nil if @features.empty?
82
82
  names = @features.keys.sort_by(&:to_s)
@@ -227,7 +227,7 @@ module Puppet::Util::SELinux
227
227
 
228
228
  # Internal helper function to read and parse /proc/mounts
229
229
  def read_mounts
230
- mounts = String.new
230
+ mounts = ''.dup
231
231
  begin
232
232
  if File.method_defined? "read_nonblock"
233
233
  # If possible we use read_nonblock in a loop rather than read to work-
@@ -61,7 +61,7 @@ class Puppet::Util::Windows::AccessControlEntry
61
61
  end
62
62
 
63
63
  def inspect
64
- inheritance = String.new
64
+ inheritance = ''.dup
65
65
  inheritance << '(I)' if inherited?
66
66
  inheritance << '(OI)' if object_inherit?
67
67
  inheritance << '(CI)' if container_inherit?
@@ -98,7 +98,7 @@ class Puppet::Util::Windows::AccessControlList
98
98
  end
99
99
 
100
100
  def inspect
101
- str = String.new
101
+ str = ''.dup
102
102
  @aces.each do |ace|
103
103
  str << " #{ace.inspect}\n"
104
104
  end
@@ -176,6 +176,13 @@ module Puppet::Util::Windows::ADSI
176
176
  sids = []
177
177
  adsi_child_collection.each do |m|
178
178
  sids << Puppet::Util::Windows::SID.ads_to_principal(m)
179
+ rescue Puppet::Util::Windows::Error => e
180
+ case e.code
181
+ when Puppet::Util::Windows::SID::ERROR_TRUSTED_RELATIONSHIP_FAILURE, Puppet::Util::Windows::SID::ERROR_TRUSTED_DOMAIN_FAILURE
182
+ sids << Puppet::Util::Windows::SID.unresolved_principal(m.name, m.sid)
183
+ else
184
+ raise e
185
+ end
179
186
  end
180
187
 
181
188
  sids
@@ -488,7 +495,7 @@ module Puppet::Util::Windows::ADSI
488
495
  # UNLEN from lmcons.h - https://stackoverflow.com/a/2155176
489
496
  MAX_USERNAME_LENGTH = 256
490
497
  def self.current_user_name
491
- user_name = String.new
498
+ user_name = ''.dup
492
499
  max_length = MAX_USERNAME_LENGTH + 1 # NULL terminated
493
500
  FFI::MemoryPointer.new(max_length * 2) do |buffer| # wide string
494
501
  FFI::MemoryPointer.new(:dword, 1) do |buffer_size|
@@ -520,7 +527,7 @@ module Puppet::Util::Windows::ADSI
520
527
  NameSurname = 14
521
528
 
522
529
  def self.current_user_name_with_format(format)
523
- user_name = String.new
530
+ user_name = ''.dup
524
531
  max_length = 1024
525
532
 
526
533
  FFI::MemoryPointer.new(:lpwstr, max_length * 2 + 1) do |buffer|
@@ -32,7 +32,7 @@ class Puppet::Util::Windows::Error < Puppet::Error
32
32
  FORMAT_MESSAGE_ARGUMENT_ARRAY |
33
33
  FORMAT_MESSAGE_IGNORE_INSERTS |
34
34
  FORMAT_MESSAGE_MAX_WIDTH_MASK
35
- error_string = String.new
35
+ error_string = ''.dup
36
36
 
37
37
  # this pointer actually points to a :lpwstr (pointer) since we're letting Windows allocate for us
38
38
  FFI::MemoryPointer.new(:pointer, 1) do |buffer_ptr|
@@ -245,7 +245,7 @@ module Puppet::Util::Windows::File
245
245
  module_function :readlink
246
246
 
247
247
  def get_long_pathname(path)
248
- converted = String.new
248
+ converted = ''.dup
249
249
  FFI::Pointer.from_string_to_wide_string(path) do |path_ptr|
250
250
  # includes terminating NULL
251
251
  buffer_size = GetLongPathNameW(path_ptr, FFI::Pointer::NULL, 0)
@@ -263,7 +263,7 @@ module Puppet::Util::Windows::File
263
263
  module_function :get_long_pathname
264
264
 
265
265
  def get_short_pathname(path)
266
- converted = String.new
266
+ converted = ''.dup
267
267
  FFI::Pointer.from_string_to_wide_string(path) do |path_ptr|
268
268
  # includes terminating NULL
269
269
  buffer_size = GetShortPathNameW(path_ptr, FFI::Pointer::NULL, 0)
@@ -121,7 +121,7 @@ module Puppet::Util::Windows::Process
121
121
  module_function :with_process_token
122
122
 
123
123
  def get_process_image_name_by_pid(pid)
124
- image_name = String.new
124
+ image_name = ''.dup
125
125
 
126
126
  Puppet::Util::Windows::Security.with_privilege(Puppet::Util::Windows::Security::SE_DEBUG_NAME) do
127
127
  open_process(PROCESS_QUERY_INFORMATION, false, pid) do |phandle|
@@ -7,8 +7,10 @@ module Puppet::Util::Windows
7
7
  extend FFI::Library
8
8
 
9
9
  # missing from Windows::Error
10
- ERROR_NONE_MAPPED = 1332
11
- ERROR_INVALID_SID_STRUCTURE = 1337
10
+ ERROR_NONE_MAPPED = 1332
11
+ ERROR_INVALID_SID_STRUCTURE = 1337
12
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788
13
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789
12
14
 
13
15
  # Well Known SIDs
14
16
  Null = 'S-1-0'
data/lib/puppet/util.rb CHANGED
@@ -409,8 +409,7 @@ module Util
409
409
  def uri_encode(path, opts = { :allow_fragment => false })
410
410
  raise ArgumentError.new(_('path may not be nil')) if path.nil?
411
411
 
412
- # ensure string starts as UTF-8 for the sake of Ruby 1.9.3
413
- encoded = String.new.encode!(Encoding::UTF_8)
412
+ encoded = ''.dup
414
413
 
415
414
  # parse uri into named matches, then reassemble properly encoded
416
415
  parts = path.match(RFC_3986_URI_REGEX)
@@ -454,7 +453,7 @@ module Util
454
453
 
455
454
  def rfc2396_escape(str)
456
455
  str.gsub(UNSAFE) do |match|
457
- tmp = String.new
456
+ tmp = ''.dup
458
457
  match.each_byte do |uc|
459
458
  tmp << sprintf('%%%02X', uc)
460
459
  end
@@ -7,7 +7,7 @@
7
7
  # Raketasks and such to set the version based on the output of `git describe`
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '8.2.0'
10
+ PUPPETVERSION = '8.3.0'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -376,13 +376,17 @@ class Puppet::X509::CertProvider
376
376
  OpenSSL::X509::Request.new(pem)
377
377
  end
378
378
 
379
- private
380
-
379
+ # Return the path to the cert related object (key, CSR, cert, etc).
380
+ #
381
+ # @param base [String] base directory
382
+ # @param name [String] the name associated with the cert related object
381
383
  def to_path(base, name)
382
384
  raise _("Certname %{name} must not contain unprintable or non-ASCII characters") % { name: name.inspect } unless name =~ VALID_CERTNAME
383
385
  File.join(base, "#{name.downcase}.pem")
384
386
  end
385
387
 
388
+ private
389
+
386
390
  def permissions_for_setting(name)
387
391
  setting = Puppet.settings.setting(name)
388
392
  perm = { mode: setting.mode.to_i(8) }