chef 14.10.9 → 14.11.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/chef-universal-mingw32.gemspec +1 -1
  3. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -1
  4. data/lib/chef/dsl/universal.rb +3 -1
  5. data/lib/chef/knife/bootstrap/templates/chef-full.erb +1 -1
  6. data/lib/chef/provider/mount/aix.rb +1 -1
  7. data/lib/chef/provider/package/chocolatey.rb +2 -0
  8. data/lib/chef/provider/windows_task.rb +2 -3
  9. data/lib/chef/resource/dmg_package.rb +2 -2
  10. data/lib/chef/resource/openssl_dhparam.rb +11 -12
  11. data/lib/chef/resource/sudo.rb +1 -1
  12. data/lib/chef/resource/swap_file.rb +1 -1
  13. data/lib/chef/resource/sysctl.rb +1 -1
  14. data/lib/chef/resource/timezone.rb +1 -1
  15. data/lib/chef/resource/windows_ad_join.rb +1 -1
  16. data/lib/chef/resource/windows_auto_run.rb +1 -1
  17. data/lib/chef/resource/windows_certificate.rb +49 -32
  18. data/lib/chef/resource/windows_env.rb +1 -1
  19. data/lib/chef/resource/windows_feature.rb +1 -1
  20. data/lib/chef/resource/windows_feature_dism.rb +1 -1
  21. data/lib/chef/resource/windows_feature_powershell.rb +1 -1
  22. data/lib/chef/resource/windows_firewall_rule.rb +1 -1
  23. data/lib/chef/resource/windows_font.rb +1 -1
  24. data/lib/chef/resource/windows_pagefile.rb +1 -1
  25. data/lib/chef/resource/windows_path.rb +1 -1
  26. data/lib/chef/resource/windows_printer.rb +1 -1
  27. data/lib/chef/resource/windows_share.rb +10 -7
  28. data/lib/chef/resource/windows_shortcut.rb +1 -1
  29. data/lib/chef/resource/windows_task.rb +1 -1
  30. data/lib/chef/resource/windows_workgroup.rb +1 -1
  31. data/lib/chef/resource/yum_repository.rb +1 -1
  32. data/lib/chef/resource/zypper_repository.rb +1 -1
  33. data/lib/chef/version.rb +1 -1
  34. data/spec/data/windows_certificates/base64_test.cer +22 -0
  35. data/spec/functional/resource/windows_certificate_spec.rb +77 -0
  36. data/spec/functional/resource/windows_task_spec.rb +108 -71
  37. data/spec/unit/knife/bootstrap_spec.rb +1 -0
  38. data/spec/unit/provider/mount/aix_spec.rb +9 -1
  39. data/spec/unit/provider/package/chocolatey_spec.rb +30 -1
  40. data/spec/unit/resource/openssl_dhparam.rb +5 -0
  41. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32c23855c40801eb5aa7d7223ce35f627a350d732937c61021566bf24996eadd
4
- data.tar.gz: fa935461c61598ca0b594ab7b28bb0fb2c9b0123fd040299dfbd06ce3c7eae0b
3
+ metadata.gz: 6f798de1b307dfa70ca1ce581c1a2d47848e045fb0b8ffd2560bee57617e5360
4
+ data.tar.gz: 0e3deab54bb4e0876692ccb8b693fa81c524c1f367d12b8687cda83527a334c0
5
5
  SHA512:
6
- metadata.gz: 7b0766ff4108d69b9e3b9c7bfe2033be26ac672c18084aed7cd7b81f384fedab22dcedb96db5a09f3fe79388b8e682f5e50b4bc7fba68a746ffd25516f829c67
7
- data.tar.gz: 53bf84e5225846e0538b7854d77a23248b1cfce72dae08122d1025e15f0e5dc105b1139340a804086fd2369c18b29a634748ecb728acbbaa3c882e2778f0698a
6
+ metadata.gz: c0ab56ed0fd49314cd2fb22bb9f3fda2765ba137e971aa865670059d5a0c674e9cdb61b8347f0776bf1115172b285c53394a898efa5840ec0728b9fb9e906fa9
7
+ data.tar.gz: ed3ac08a4ff1204800ce95f1480dd2545e0a51114d09c7c83b779392a4673dddb0799e5b16a6a269d74b85bf051b78974f0e7d6a234e7c584958407ffacd4047
@@ -16,7 +16,7 @@ gemspec.add_dependency "windows-api", "~> 0.4.4"
16
16
  gemspec.add_dependency "wmi-lite", "~> 1.0"
17
17
  gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
18
18
  gemspec.add_dependency "iso8601", "~> 0.12.1"
19
- gemspec.add_dependency "win32-certstore", ">= 0.1.8"
19
+ gemspec.add_dependency "win32-certstore", "~> 0.2.4"
20
20
  gemspec.extensions << "ext/win32-eventlog/Rakefile"
21
21
  gemspec.files += Dir.glob("{distro,ext}/**/*")
22
22
 
@@ -110,7 +110,8 @@ class Chef
110
110
  else
111
111
  child_paths[name].each do |path|
112
112
  begin
113
- Dir.mkdir(path, 0700)
113
+ ::FileUtils.mkdir_p(path)
114
+ ::FileUtils.chmod(0700, path)
114
115
  if Chef::Platform.windows?
115
116
  all_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_ALL
116
117
  administrators = Chef::ReservedNames::Win32::Security::SID.Administrators
@@ -1,7 +1,7 @@
1
1
  #--
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Christopher Walters (<cw@chef.io>)
4
- # Copyright:: Copyright 2008-2016 Chef Software, Inc.
4
+ # Copyright:: Copyright 2008-2019, Chef Software Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@ require "chef/dsl/platform_introspection"
21
21
  require "chef/mixin/powershell_exec"
22
22
  require "chef/mixin/powershell_out"
23
23
  require "chef/mixin/shell_out"
24
+ require "chef/mixin/lazy_module_include"
24
25
 
25
26
  class Chef
26
27
  module DSL
@@ -47,6 +48,7 @@ class Chef
47
48
  include Chef::Mixin::PowershellExec
48
49
  include Chef::Mixin::PowershellOut
49
50
  include Chef::Mixin::ShellOut
51
+ extend Chef::Mixin::LazyModuleInclude
50
52
  end
51
53
  end
52
54
  end
@@ -171,7 +171,7 @@ do_download() {
171
171
  <% if knife_config[:bootstrap_install_command] %>
172
172
  <%= knife_config[:bootstrap_install_command] %>
173
173
  <% else %>
174
- install_sh="<%= knife_config[:bootstrap_url] ? knife_config[:bootstrap_url] : "https://omnitruck-direct.chef.io/chef/install.sh" %>"
174
+ install_sh="<%= knife_config[:bootstrap_url] ? knife_config[:bootstrap_url] : "https://omnitruck.chef.io/chef/install.sh" %>"
175
175
  if test -f /usr/bin/chef-client; then
176
176
  echo "-----> Existing Chef installation detected"
177
177
  else
@@ -164,7 +164,7 @@ class Chef
164
164
  disable_fs
165
165
  end
166
166
  ::File.open("/etc/filesystems", "a") do |fstab|
167
- fstab.puts("#{@new_resource.mount_point}:")
167
+ fstab.puts("\n\n#{@new_resource.mount_point}:")
168
168
  if network_device?
169
169
  device_details = device_fstab.split(":")
170
170
  fstab.puts("\tdev\t\t= #{device_details[1]}")
@@ -236,6 +236,8 @@ EOS
236
236
  begin
237
237
  cmd = [ "list -r #{pkg}" ]
238
238
  cmd.push( "-source #{new_resource.source}" ) if new_resource.source
239
+ cmd.push( new_resource.options ) if new_resource.options
240
+
239
241
  raw = parse_list_output(*cmd)
240
242
  raw.keys.each_with_object({}) do |name, available|
241
243
  available[name] = desired_name_versions[name] || raw[name]
@@ -116,9 +116,8 @@ class Chef
116
116
  end
117
117
 
118
118
  def action_create
119
- if new_resource.command && new_resource.command.split.size > 1
120
- set_command_and_arguments
121
- end
119
+ set_command_and_arguments if new_resource.command
120
+
122
121
  if current_resource.exists
123
122
  logger.trace "#{new_resource} task exist."
124
123
  unless (task_needs_update?(current_resource.task)) || (new_resource.force)
@@ -27,7 +27,7 @@ class Chef
27
27
  introduced "14.0"
28
28
 
29
29
  property :app, String,
30
- description: "The name of the application as it appears in the /Volumes directory, if it differs from the resource block's name.",
30
+ description: "The name of the application as it appears in the /Volumes directory if it differs from the resource block's name.",
31
31
  name_property: true
32
32
 
33
33
  property :source, String,
@@ -47,7 +47,7 @@ class Chef
47
47
  description: "The sha256 checksum of the .dmg file to download."
48
48
 
49
49
  property :volumes_dir, String,
50
- description: "The directory under /Volumes where the dmg is mounted, if it differs from the name of the .dmg file.",
50
+ description: "The directory under /Volumes where the dmg is mounted if it differs from the name of the .dmg file.",
51
51
  default: lazy { |r| r.app }, default_description: "The value passed for the application name."
52
52
 
53
53
  property :dmg_name, String,
@@ -57,20 +57,19 @@ class Chef
57
57
 
58
58
  action :create do
59
59
  description "Create the dhparam file."
60
-
60
+ dhparam_content = nil
61
61
  unless dhparam_pem_valid?(new_resource.path)
62
- converge_by("Create a dhparam file #{new_resource.path}") do
63
- dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem
62
+ dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem
63
+ Chef::Log.debug("Valid dhparam content not found at #{new_resource.path}, creating new")
64
+ end
64
65
 
65
- file new_resource.path do
66
- action :create
67
- owner new_resource.owner unless new_resource.owner.nil?
68
- group new_resource.group unless new_resource.group.nil?
69
- mode new_resource.mode
70
- sensitive true
71
- content dhparam_content
72
- end
73
- end
66
+ file new_resource.path do
67
+ action :create
68
+ owner new_resource.owner
69
+ group new_resource.group
70
+ mode new_resource.mode
71
+ sensitive true
72
+ content dhparam_content
74
73
  end
75
74
  end
76
75
  end
@@ -37,7 +37,7 @@ class Chef
37
37
  # acording to the sudo man pages sudo will ignore files in an include dir that have a `.` or `~`
38
38
  # We convert either to `__`
39
39
  property :filename, String,
40
- description: "The name of the sudoers.d file, if it differs from the name of the resource block",
40
+ description: "The name of the sudoers.d file if it differs from the name of the resource block",
41
41
  name_property: true,
42
42
  coerce: proc { |x| x.gsub(/[\.~]/, "__") }
43
43
 
@@ -27,7 +27,7 @@ class Chef
27
27
  introduced "14.0"
28
28
 
29
29
  property :path, String,
30
- description: "The path where the swap file will be created on the system, if it differs from the resource block's name.",
30
+ description: "The path where the swap file will be created on the system if it differs from the resource block's name.",
31
31
  name_property: true
32
32
 
33
33
  property :size, Integer,
@@ -33,7 +33,7 @@ class Chef
33
33
  introduced "14.0"
34
34
 
35
35
  property :key, String,
36
- description: "The kernel parameter key in dotted format, if it differs from the resource block's name.",
36
+ description: "The kernel parameter key in dotted format if it differs from the resource block's name.",
37
37
  name_property: true
38
38
 
39
39
  property :ignore_error, [TrueClass, FalseClass],
@@ -29,7 +29,7 @@ class Chef
29
29
  introduced "14.6"
30
30
 
31
31
  property :timezone, String,
32
- description: "The timezone value to set.",
32
+ description: "An optional property to set the timezone value if it differs from the resource block's name.",
33
33
  name_property: true
34
34
 
35
35
  action :set do
@@ -30,7 +30,7 @@ class Chef
30
30
  introduced "14.0"
31
31
 
32
32
  property :domain_name, String,
33
- description: "The FQDN of the Active Directory domain to join.",
33
+ description: "The FQDN of the Active Directory domain to join if it differs from the resource block's name.",
34
34
  validation_message: "The 'domain_name' property must be a FQDN.",
35
35
  regex: /.\../, # anything.anything
36
36
  name_property: true
@@ -28,7 +28,7 @@ class Chef
28
28
  introduced "14.0"
29
29
 
30
30
  property :program_name, String,
31
- description: "The name of the program to run at login, if it differs from the resource block's name.",
31
+ description: "The name of the program to run at login if it differs from the resource block's name.",
32
32
  name_property: true
33
33
 
34
34
  property :path, String,
@@ -32,7 +32,7 @@ class Chef
32
32
  introduced "14.7"
33
33
 
34
34
  property :source, String,
35
- description: "The source file (for create and acl_add), thumbprint (for delete and acl_add) or subject (for delete).",
35
+ description: "The source file (for create and acl_add), thumbprint (for delete and acl_add) or subject (for delete) if it differs from the resource block's name.",
36
36
  name_property: true
37
37
 
38
38
  property :pfx_password, String,
@@ -53,14 +53,16 @@ class Chef
53
53
  description: ""
54
54
 
55
55
  # lazy used to set default value of sensitive to true if password is set
56
- property :sensitive, [ TrueClass, FalseClass ],
56
+ property :sensitive, [TrueClass, FalseClass],
57
57
  description: "Ensure that sensitive resource data is not logged by the chef-client.",
58
58
  default: lazy { |r| r.pfx_password ? true : false }, skip_docs: true
59
59
 
60
60
  action :create do
61
61
  description "Creates or updates a certificate."
62
62
 
63
- cert_obj = OpenSSL::X509::Certificate.new(raw_source) # A certificate object in memory
63
+ # Extension of the certificate
64
+ ext = ::File.extname(new_resource.source)
65
+ cert_obj = fetch_cert_object(ext) # Fetch OpenSSL::X509::Certificate object
64
66
  thumbprint = OpenSSL::Digest::SHA1.new(cert_obj.to_der).to_s # Fetch its thumbprint
65
67
 
66
68
  # Need to check if return value is Boolean:true
@@ -69,7 +71,11 @@ class Chef
69
71
  Chef::Log.debug("Certificate is already present")
70
72
  else
71
73
  converge_by("Adding certificate #{new_resource.source} into Store #{new_resource.store_name}") do
72
- add_cert(cert_obj)
74
+ if ext == ".pfx"
75
+ add_pfx_cert
76
+ else
77
+ add_cert(cert_obj)
78
+ end
73
79
  end
74
80
  end
75
81
  end
@@ -139,6 +145,11 @@ class Chef
139
145
  store.add(cert_obj)
140
146
  end
141
147
 
148
+ def add_pfx_cert
149
+ store = ::Win32::Certstore.open(new_resource.store_name)
150
+ store.add_pfx(new_resource.source, new_resource.pfx_password)
151
+ end
152
+
142
153
  def delete_cert
143
154
  store = ::Win32::Certstore.open(new_resource.store_name)
144
155
  store.delete(new_resource.source)
@@ -235,6 +246,7 @@ class Chef
235
246
 
236
247
  def acl_script(hash)
237
248
  return "" if new_resource.private_key_acl.nil? || new_resource.private_key_acl.empty?
249
+
238
250
  # this PS came from http://blogs.technet.com/b/operationsguy/archive/2010/11/29/provide-access-to-private-keys-commandline-vs-powershell.aspx
239
251
  # and from https://msdn.microsoft.com/en-us/library/windows/desktop/bb204778(v=vs.85).aspx
240
252
  set_acl_script = <<-EOH
@@ -260,38 +272,43 @@ class Chef
260
272
  set_acl_script
261
273
  end
262
274
 
263
- # Returns the certificate string of the given
264
- # input certificate in PEM format
265
- def raw_source
266
- ext = ::File.extname(new_resource.source)
267
- convert_pem(ext, new_resource.source)
268
- end
269
-
270
- # Uses powershell command to convert crt/der/cer/pfx & p7b certificates
271
- # In PEM format and returns its certificate content
272
- def convert_pem(ext, source)
273
- out = case ext
274
- when ".crt", ".der"
275
- powershell_out("openssl x509 -text -inform DER -in #{source} -outform PEM").stdout
276
- when ".cer"
277
- powershell_out("openssl x509 -text -inform DER -in #{source} -outform PEM").stdout
278
- when ".pfx"
279
- powershell_out("openssl pkcs12 -in #{source} -nodes -passin pass:'#{new_resource.pfx_password}'").stdout
280
- when ".p7b"
281
- powershell_out("openssl pkcs7 -print_certs -in #{source} -outform PEM").stdout
282
- end
283
- out = ::File.read(source) if out.nil? || out.empty?
284
- format_raw_out(out)
275
+ # Method returns an OpenSSL::X509::Certificate object
276
+ #
277
+ # Based on its extension, the certificate contents are used to initialize
278
+ # PKCS12 (PFX), PKCS7 (P7B) objects which contains OpenSSL::X509::Certificate.
279
+ #
280
+ # @note Other then PEM, all the certificates are usually in binary format, and hence
281
+ # their contents are loaded by using File.binread
282
+ #
283
+ # @param ext [String] Extension of the certificate
284
+ #
285
+ # @return [OpenSSL::X509::Certificate] Object containing certificate's attributes
286
+ #
287
+ # @raise [OpenSSL::PKCS12::PKCS12Error] When incorrect password is provided for PFX certificate
288
+ #
289
+ def fetch_cert_object(ext)
290
+ contents = if binary_cert?
291
+ ::File.binread(new_resource.source)
292
+ else
293
+ ::File.read(new_resource.source)
294
+ end
295
+
296
+ case ext
297
+ when ".pfx"
298
+ OpenSSL::PKCS12.new(contents, new_resource.pfx_password).certificate
299
+ when ".p7b"
300
+ OpenSSL::PKCS7.new(contents).certificates.first
301
+ else
302
+ OpenSSL::X509::Certificate.new(contents)
303
+ end
285
304
  end
286
305
 
287
- # Returns the certificate content
288
- def format_raw_out(out)
289
- begin_cert = "-----BEGIN CERTIFICATE-----"
290
- end_cert = "-----END CERTIFICATE-----"
291
- begin_cert + out[/#{begin_cert}(.*?)#{end_cert}/m, 1] + end_cert
306
+ # @return [Boolean] Whether the certificate file is binary encoded or not
307
+ #
308
+ def binary_cert?
309
+ powershell_out!("file -b --mime-encoding #{new_resource.source}").stdout.strip == "binary"
292
310
  end
293
311
  end
294
-
295
312
  end
296
313
  end
297
314
  end
@@ -32,7 +32,7 @@ class Chef
32
32
  allowed_actions :create, :delete, :modify
33
33
 
34
34
  property :key_name, String,
35
- description: "The name of the key that is to be created, deleted, or modified.",
35
+ description: "An optional property to set the name of the key that is to be created, deleted, or modified if it differs from the resource block's name.",
36
36
  identity: true, name_property: true
37
37
 
38
38
  property :value, String,
@@ -28,7 +28,7 @@ class Chef
28
28
  introduced "14.0"
29
29
 
30
30
  property :feature_name, [Array, String],
31
- description: "The name of the feature(s) or role(s) to install, if it differs from the resource block's name. The same feature may have different names depending on the underlying installation method being used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS).",
31
+ description: "The name of the feature(s) or role(s) to install if they differ from the resource block's name. The same feature may have different names depending on the underlying installation method being used (ie DHCPServer vs DHCP; DNS-Server-Full-Role vs DNS).",
32
32
  name_property: true
33
33
 
34
34
  property :source, String,
@@ -29,7 +29,7 @@ class Chef
29
29
  introduced "14.0"
30
30
 
31
31
  property :feature_name, [Array, String],
32
- description: "The name of the feature(s) or role(s) to install, if it differs from the resource name.",
32
+ description: "The name of the feature(s) or role(s) to install if they differ from the resource name.",
33
33
  coerce: proc { |x| to_formatted_array(x) },
34
34
  name_property: true
35
35
 
@@ -31,7 +31,7 @@ class Chef
31
31
  introduced "14.0"
32
32
 
33
33
  property :feature_name, [Array, String],
34
- description: "The name of the feature(s) or role(s) to install, if it differs from the resource block's name.",
34
+ description: "The name of the feature(s) or role(s) to install if they differ from the resource block's name.",
35
35
  coerce: proc { |x| to_formatted_array(x) },
36
36
  name_property: true
37
37
 
@@ -32,7 +32,7 @@ class Chef
32
32
 
33
33
  property :rule_name, String,
34
34
  name_property: true,
35
- description: "The name to assign to the firewall rule."
35
+ description: "An optional property to set the name of the firewall rule to assign if it differs from the resource block's name."
36
36
 
37
37
  property :description, String,
38
38
  default: "Firewall rule",
@@ -29,7 +29,7 @@ class Chef
29
29
  introduced "14.0"
30
30
 
31
31
  property :font_name, String,
32
- description: "The name of the font file to install, if it differs from the resource name.",
32
+ description: "An optional property to set the name of the font to install if it differs from the resource block's name.",
33
33
  name_property: true
34
34
 
35
35
  property :source, String,
@@ -28,7 +28,7 @@ class Chef
28
28
 
29
29
  property :path, String,
30
30
  coerce: proc { |x| x.tr("/", '\\') },
31
- description: "The path to the pagefile if different from the resource name.",
31
+ description: "An optional property to set the pagefile name if it differs from the resource block's name.",
32
32
  name_property: true
33
33
 
34
34
  property :system_managed, [TrueClass, FalseClass],
@@ -31,7 +31,7 @@ class Chef
31
31
  default_action :add
32
32
 
33
33
  property :path, String,
34
- description: "The name of the value to add to the system path",
34
+ description: "An optional property to set the path value if it differs from the resource block's name.",
35
35
  name_property: true
36
36
  end
37
37
  end
@@ -31,7 +31,7 @@ class Chef
31
31
  introduced "14.0"
32
32
 
33
33
  property :device_id, String,
34
- description: "Printer queue name, such as 'HP LJ 5200 in fifth floor copy room'.",
34
+ description: "An optional property to set the printer queue name if it differs from the resource block's name. Example: 'HP LJ 5200 in fifth floor copy room'.",
35
35
  name_property: true
36
36
 
37
37
  property :comment, String,
@@ -21,6 +21,7 @@
21
21
 
22
22
  require "chef/resource"
23
23
  require "chef/json_compat"
24
+ require "chef/util/path_helper"
24
25
 
25
26
  class Chef
26
27
  class Resource
@@ -33,7 +34,7 @@ class Chef
33
34
 
34
35
  # Specifies a name for the SMB share. The name may be composed of any valid file name characters, but must be less than 80 characters long. The names pipe and mailslot are reserved for use by the computer.
35
36
  property :share_name, String,
36
- description: "The name to assign to the share.",
37
+ description: "An optional property to set the share name if it differs from the resource block's name.",
37
38
  name_property: true
38
39
 
39
40
  # Specifies the path of the location of the folder to share. The path must be fully qualified. Relative paths or paths that contain wildcard characters are not permitted.
@@ -184,10 +185,12 @@ class Chef
184
185
 
185
186
  converge_if_changed do
186
187
  # you can't actually change the path so you have to delete the old share first
187
- delete_share if different_path?
188
-
189
- # powershell cmdlet for create is different than updates
190
- if current_resource.nil?
188
+ if different_path?
189
+ Chef::Log.debug("The path has changed so we will delete and recreate share")
190
+ delete_share
191
+ create_share
192
+ elsif current_resource.nil?
193
+ # powershell cmdlet for create is different than updates
191
194
  Chef::Log.debug("The current resource is nil so we will create a new share")
192
195
  create_share
193
196
  else
@@ -215,7 +218,7 @@ class Chef
215
218
  action_class do
216
219
  def different_path?
217
220
  return false if current_resource.nil? # going from nil to something isn't different for our concerns
218
- return false if current_resource.path == new_resource.path
221
+ return false if current_resource.path == Chef::Util::PathHelper.cleanpath(new_resource.path)
219
222
  true
220
223
  end
221
224
 
@@ -236,7 +239,7 @@ class Chef
236
239
  def create_share
237
240
  raise "#{new_resource.path} is missing or not a directory. Shares cannot be created if the path doesn't first exist." unless ::File.directory? new_resource.path
238
241
 
239
- share_cmd = "New-SmbShare -Name '#{new_resource.share_name}' -Path '#{new_resource.path}' -Description '#{new_resource.description}' -ConcurrentUserLimit #{new_resource.concurrent_user_limit} -CATimeout #{new_resource.ca_timeout} -EncryptData:#{bool_string(new_resource.encrypt_data)} -ContinuouslyAvailable:#{bool_string(new_resource.continuously_available)}"
242
+ share_cmd = "New-SmbShare -Name '#{new_resource.share_name}' -Path '#{Chef::Util::PathHelper.cleanpath(new_resource.path)}' -Description '#{new_resource.description}' -ConcurrentUserLimit #{new_resource.concurrent_user_limit} -CATimeout #{new_resource.ca_timeout} -EncryptData:#{bool_string(new_resource.encrypt_data)} -ContinuouslyAvailable:#{bool_string(new_resource.continuously_available)}"
240
243
  share_cmd << " -ScopeName #{new_resource.scope_name}" unless new_resource.scope_name == "*" # passing * causes the command to fail
241
244
  share_cmd << " -Temporary:#{bool_string(new_resource.temporary)}" if new_resource.temporary # only set true
242
245
 
@@ -28,7 +28,7 @@ class Chef
28
28
  introduced "14.0"
29
29
 
30
30
  property :shortcut_name, String,
31
- description: "The name for the shortcut, if it differs from the resource name.",
31
+ description: "An optional property to set the shortcut name if it differs from the resource block's name.",
32
32
  name_property: true
33
33
 
34
34
  property :target, String,
@@ -32,7 +32,7 @@ class Chef
32
32
  default_action :create
33
33
 
34
34
  property :task_name, String, regex: [/\A[^\/\:\*\?\<\>\|]+\z/],
35
- description: "The task name, such as 'Task Name' or '/Task Name'",
35
+ description: "An optional property to set the task name if it differs from the resource block's name. Example: 'Task Name' or '/Task Name'",
36
36
  name_property: true
37
37
 
38
38
  property :command, String,
@@ -30,7 +30,7 @@ class Chef
30
30
  introduced "14.5"
31
31
 
32
32
  property :workgroup_name, String,
33
- description: "The name of the workgroup for the computer.",
33
+ description: "An optional property to set the workgroup name if it differs from the resource block's name.",
34
34
  validation_message: "The 'workgroup_name' property must not contain spaces.",
35
35
  regex: /^\S*$/, # no spaces
36
36
  name_property: true
@@ -143,7 +143,7 @@ class Chef
143
143
  description: "Determines whether to report the instance ID when using Amazon Linux AMIs and repositories."
144
144
 
145
145
  property :repositoryid, String, regex: [/^[^\/]+$/],
146
- description: "Specifies a unique name for each repository, one word. Defaults to name property.",
146
+ description: "An optional property to set the repository name if it differs from the resource block's name.",
147
147
  validation_message: "repositoryid property cannot contain a forward slash '/'",
148
148
  name_property: true
149
149
 
@@ -30,7 +30,7 @@ class Chef
30
30
 
31
31
  property :repo_name, String,
32
32
  regex: [/^[^\/]+$/],
33
- description: "Specifies the repository name, if it differs from the resource name.",
33
+ description: "An optional property to set the repository name if it differs from the resource block's name.",
34
34
  validation_message: "repo_name property cannot contain a forward slash '/'",
35
35
  name_property: true
36
36
 
@@ -23,7 +23,7 @@ require "chef/version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("14.10.9")
26
+ VERSION = Chef::VersionString.new("14.11.21")
27
27
  end
28
28
 
29
29
  #
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDjjCCAnagAwIBAgIQNH6iXZnEKbFOEQ7D9f9iCTANBgkqhkiG9w0BAQsFADBK
3
+ MSMwIQYDVQQDDBpBIEJhc2U2NCBEdW1teSBDZXJ0aWZpY2F0ZTEjMCEGCSqGSIb3
4
+ DQEJARYUdGVzdGJ5cnNwZWNAY2hlZi5jb20wHhcNMTkwMjEyMDk1ODM2WhcNMjAw
5
+ MjEyMTAxODM2WjBKMSMwIQYDVQQDDBpBIEJhc2U2NCBEdW1teSBDZXJ0aWZpY2F0
6
+ ZTEjMCEGCSqGSIb3DQEJARYUdGVzdGJ5cnNwZWNAY2hlZi5jb20wggEiMA0GCSqG
7
+ SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDSy2Qlf2k1X3y/YgEjnvD0K8NeKgXKKi62
8
+ RHRMTJ2+6KSg+I1MqHZC+BVrfzehuJVby5kM7tGLF8FvM3q7X/5oSPg8pvLZzIV0
9
+ pBrpVPCTYw8fnlmFKBt/+m2XOqsWyL59yP+p66SHAKmoLYTGu8dkGvgJn3dwKNen
10
+ VFmwadteVfKs2wFW/ZwUxH4aLloCa8KSyqstIXrYQmdqqFOSuEgkynalD19dozSv
11
+ QtkQ9FZPuFGDwNpdO7OrcjE1lTUlzuth7CqV/pj4GYJhK/PPtO8Ing/BtwZm5XB8
12
+ 2yvvLVnL7Y/hikg2ENKA9fOYk52zR/kkd7d8qoJva7WlYEXTZvpdAgMBAAGjcDBu
13
+ MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEw
14
+ HgYDVR0RBBcwFYITd3d3LnRlc3RieXJzcGVjLmNvbTAdBgNVHQ4EFgQUuL1l247K
15
+ h+cVH9LehmQgXuV8F6MwDQYJKoZIhvcNAQELBQADggEBAMTJW5tSZ/g2AP45EUwj
16
+ PLDnDLY4YnsJDQ7Jo58EAY6givUc+ZnKRWxYAYNBOKcqDM5E4pXi3Fa1lKYR1vMu
17
+ 5AThPaDXhv18ljGAs21MYt9hl7PqdzbfX4ejF+jCD4UrE8bGtxuDc1WQ2HbeJtdj
18
+ 0j7BPPNXfcvPAIyX3BEOQFUPgvVAqzWMQLpdUKg+sNUJZijqKQv11xVALGHtxqGB
19
+ 1MFrdl6D/idODfhcdo2n1tBMyOGhHwEOBLqB1PTH72g5J4BVx4iwH/gh8PRmMy0P
20
+ eJkNspgOBGPOhNpe7bhmK45MBuJpmjyl/CYCqtQvaEdpbuRQIgc2e+YRMfR71qYp
21
+ Em8=
22
+ -----END CERTIFICATE-----
@@ -60,7 +60,9 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do
60
60
  let(:store) { "Chef-Functional-Test" }
61
61
  let(:certificate_path) { File.expand_path(File.join(CHEF_SPEC_DATA, "windows_certificates")) }
62
62
  let(:cer_path) { File.join(certificate_path, "test.cer") }
63
+ let(:base64_path) { File.join(certificate_path, "base64_test.cer") }
63
64
  let(:pem_path) { File.join(certificate_path, "test.pem") }
65
+ let(:pfx_path) { File.join(certificate_path, "test.pfx") }
64
66
  let(:out_path) { File.join(certificate_path, "testout.pem") }
65
67
  let(:tests_thumbprint) { "3180B3E3217862600BD7B2D28067B03D41576A4F" }
66
68
  let(:other_cer_path) { File.join(certificate_path, "othertest.cer") }
@@ -157,6 +159,81 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do
157
159
  end
158
160
  end
159
161
 
162
+ describe "Works for various formats" do
163
+ context "Adds CER" do
164
+ before do
165
+ win_certificate.source = cer_path
166
+ win_certificate.run_action(:create)
167
+ end
168
+ it "Imports certificate into store" do
169
+ expect(no_of_certificates).to eq(1)
170
+ end
171
+ it "Idempotent: Does not converge while adding again" do
172
+ win_certificate.run_action(:create)
173
+ expect(no_of_certificates).to eq(1)
174
+ expect(win_certificate).not_to be_updated_by_last_action
175
+ end
176
+ end
177
+
178
+ context "Adds Base64 Encoded CER" do
179
+ before do
180
+ win_certificate.source = base64_path
181
+ win_certificate.run_action(:create)
182
+ end
183
+ it "Imports certificate into store" do
184
+ expect(no_of_certificates).to eq(1)
185
+ end
186
+ it "Idempotent: Does not converge while adding again" do
187
+ win_certificate.run_action(:create)
188
+ expect(no_of_certificates).to eq(1)
189
+ expect(win_certificate).not_to be_updated_by_last_action
190
+ end
191
+ end
192
+
193
+ context "Adds PEM" do
194
+ before do
195
+ win_certificate.source = pem_path
196
+ win_certificate.run_action(:create)
197
+ end
198
+ it "Imports certificate into store" do
199
+ expect(no_of_certificates).to eq(1)
200
+ end
201
+ it "Idempotent: Does not converge while adding again" do
202
+ win_certificate.run_action(:create)
203
+ expect(no_of_certificates).to eq(1)
204
+ expect(win_certificate).not_to be_updated_by_last_action
205
+ end
206
+ end
207
+
208
+ context "Adds PFX" do
209
+ context "With valid password" do
210
+ before do
211
+ win_certificate.source = pfx_path
212
+ win_certificate.pfx_password = password
213
+ win_certificate.run_action(:create)
214
+ end
215
+ it "Imports certificate into store" do
216
+ expect(no_of_certificates).to eq(1)
217
+ end
218
+ it "Idempotent: Does not converge while adding again" do
219
+ win_certificate.run_action(:create)
220
+ expect(no_of_certificates).to eq(1)
221
+ expect(win_certificate).not_to be_updated_by_last_action
222
+ end
223
+ end
224
+
225
+ context "With Invalid password" do
226
+ before do
227
+ win_certificate.source = pfx_path
228
+ win_certificate.pfx_password = "Invalid password"
229
+ end
230
+ it "Raises an error" do
231
+ expect { win_certificate.run_action(:create) }.to raise_error(OpenSSL::PKCS12::PKCS12Error)
232
+ end
233
+ end
234
+ end
235
+ end
236
+
160
237
  describe "action: verify" do
161
238
  context "When a certificate is not present" do
162
239
  before do
@@ -43,92 +43,129 @@ describe Chef::Resource::WindowsTask, :windows_only do
43
43
  new_resource
44
44
  end
45
45
 
46
- it "creates scheduled task and sets command arguments" do
47
- subject.command "chef-client -W"
48
- call_for_create_action
49
- # loading current resource again to check new task is creted and it matches task parameters
50
- current_resource = call_for_load_current_resource
51
- expect(current_resource.exists).to eq(true)
52
- expect(current_resource.task.application_name).to eq("chef-client")
53
- expect(current_resource.task.parameters).to eq("-W")
54
- end
46
+ context "With Arguments" do
47
+ it "creates scheduled task and sets command arguments" do
48
+ subject.command "chef-client -W"
49
+ call_for_create_action
50
+ # loading current resource again to check new task is creted and it matches task parameters
51
+ current_resource = call_for_load_current_resource
52
+ expect(current_resource.exists).to eq(true)
53
+ expect(current_resource.task.application_name).to eq("chef-client")
54
+ expect(current_resource.task.parameters).to eq("-W")
55
+ end
55
56
 
56
- it "does not converge the resource if it is already converged" do
57
- subject.command "chef-client -W"
58
- subject.run_action(:create)
59
- subject.command "chef-client -W"
60
- subject.run_action(:create)
61
- expect(subject).not_to be_updated_by_last_action
62
- end
57
+ it "does not converge the resource if it is already converged" do
58
+ subject.command "chef-client -W"
59
+ subject.run_action(:create)
60
+ subject.command "chef-client -W"
61
+ subject.run_action(:create)
62
+ expect(subject).not_to be_updated_by_last_action
63
+ end
63
64
 
64
- it "creates scheduled task and sets command arguments when arguments inclusive single quotes" do
65
- subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
66
- call_for_create_action
67
- # loading current resource again to check new task is creted and it matches task parameters
68
- current_resource = call_for_load_current_resource
69
- expect(current_resource.exists).to eq(true)
70
- expect(current_resource.task.application_name).to eq("chef-client")
71
- expect(current_resource.task.parameters).to eq("-W -L 'C:\\chef\\chef-ad-join.log'")
72
- end
65
+ it "creates scheduled task and sets command arguments when arguments inclusive single quotes" do
66
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
67
+ call_for_create_action
68
+ # loading current resource again to check new task is creted and it matches task parameters
69
+ current_resource = call_for_load_current_resource
70
+ expect(current_resource.exists).to eq(true)
71
+ expect(current_resource.task.application_name).to eq("chef-client")
72
+ expect(current_resource.task.parameters).to eq("-W -L 'C:\\chef\\chef-ad-join.log'")
73
+ end
73
74
 
74
- it "does not converge the resource if it is already converged" do
75
- subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
76
- subject.run_action(:create)
77
- subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
78
- subject.run_action(:create)
79
- expect(subject).not_to be_updated_by_last_action
80
- end
75
+ it "does not converge the resource if it is already converged" do
76
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
77
+ subject.run_action(:create)
78
+ subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'"
79
+ subject.run_action(:create)
80
+ expect(subject).not_to be_updated_by_last_action
81
+ end
81
82
 
82
- it "creates scheduled task and sets command arguments with spaces in command" do
83
- subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
84
- call_for_create_action
85
- current_resource = call_for_load_current_resource
86
- expect(current_resource.exists).to eq(true)
87
- expect(current_resource.task.application_name).to eq('"C:\\Program Files\\example\\program.exe"')
88
- expect(current_resource.task.parameters).to eq("-arg1 --arg2")
83
+ it "creates scheduled task and sets command arguments with spaces in command" do
84
+ subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
85
+ call_for_create_action
86
+ current_resource = call_for_load_current_resource
87
+ expect(current_resource.exists).to eq(true)
88
+ expect(current_resource.task.application_name).to eq('"C:\\Program Files\\example\\program.exe"')
89
+ expect(current_resource.task.parameters).to eq("-arg1 --arg2")
90
+ end
91
+
92
+ it "does not converge the resource if it is already converged" do
93
+ subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
94
+ subject.run_action(:create)
95
+ subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
96
+ subject.run_action(:create)
97
+ expect(subject).not_to be_updated_by_last_action
98
+ end
99
+
100
+ it "creates scheduled task and sets command arguments with spaces in arguments" do
101
+ subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
102
+ call_for_create_action
103
+ current_resource = call_for_load_current_resource
104
+ expect(current_resource.exists).to eq(true)
105
+ expect(current_resource.task.application_name).to eq("powershell.exe")
106
+ expect(current_resource.task.parameters).to eq('-file "C:\\Program Files\\app\\script.ps1"')
107
+ end
108
+
109
+ it "does not converge the resource if it is already converged" do
110
+ subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
111
+ subject.run_action(:create)
112
+ subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
113
+ subject.run_action(:create)
114
+ expect(subject).not_to be_updated_by_last_action
115
+ end
116
+
117
+ it "creates scheduled task and sets command arguments" do
118
+ subject.command "ping http://www.google.com"
119
+ call_for_create_action
120
+ # loading current resource again to check new task is creted and it matches task parameters
121
+ current_resource = call_for_load_current_resource
122
+ expect(current_resource.exists).to eq(true)
123
+ expect(current_resource.task.application_name).to eq("ping")
124
+ expect(current_resource.task.parameters).to eq("http://www.google.com")
125
+ end
126
+
127
+ it "does not converge the resource if it is already converged" do
128
+ subject.command "ping http://www.google.com"
129
+ subject.run_action(:create)
130
+ subject.command "ping http://www.google.com"
131
+ subject.run_action(:create)
132
+ expect(subject).not_to be_updated_by_last_action
133
+ end
89
134
  end
90
135
 
91
- it "does not converge the resource if it is already converged" do
92
- subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
93
- subject.run_action(:create)
94
- subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2'
95
- subject.run_action(:create)
96
- expect(subject).not_to be_updated_by_last_action
136
+ context "Without Arguments" do
137
+ it "creates scheduled task and sets command arguments" do
138
+ subject.command "chef-client"
139
+ call_for_create_action
140
+ # loading current resource again to check new task is creted and it matches task parameters
141
+ current_resource = call_for_load_current_resource
142
+ expect(current_resource.exists).to eq(true)
143
+ expect(current_resource.task.application_name).to eq("chef-client")
144
+ expect(current_resource.task.parameters).to be_empty
145
+ end
146
+
147
+ it "does not converge the resource if it is already converged" do
148
+ subject.command "chef-client"
149
+ subject.run_action(:create)
150
+ subject.command "chef-client"
151
+ subject.run_action(:create)
152
+ expect(subject).not_to be_updated_by_last_action
153
+ end
97
154
  end
98
155
 
99
- it "creates scheduled task and sets command arguments with spaces in arguments" do
156
+ it "creates scheduled task and Re-sets command arguments" do
100
157
  subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
101
- call_for_create_action
158
+ subject.run_action(:create)
102
159
  current_resource = call_for_load_current_resource
103
- expect(current_resource.exists).to eq(true)
104
160
  expect(current_resource.task.application_name).to eq("powershell.exe")
105
161
  expect(current_resource.task.parameters).to eq('-file "C:\\Program Files\\app\\script.ps1"')
106
- end
107
162
 
108
- it "does not converge the resource if it is already converged" do
109
- subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
110
- subject.run_action(:create)
111
- subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"'
163
+ subject.command "powershell.exe"
112
164
  subject.run_action(:create)
113
- expect(subject).not_to be_updated_by_last_action
114
- end
115
-
116
- it "creates scheduled task and sets command arguments" do
117
- subject.command "ping http://www.google.com"
118
- call_for_create_action
119
- # loading current resource again to check new task is creted and it matches task parameters
120
165
  current_resource = call_for_load_current_resource
121
- expect(current_resource.exists).to eq(true)
122
- expect(current_resource.task.application_name).to eq("ping")
123
- expect(current_resource.task.parameters).to eq("http://www.google.com")
124
- end
125
-
126
- it "does not converge the resource if it is already converged" do
127
- subject.command "ping http://www.google.com"
128
- subject.run_action(:create)
129
- subject.command "ping http://www.google.com"
130
- subject.run_action(:create)
131
- expect(subject).not_to be_updated_by_last_action
166
+ expect(current_resource.task.application_name).to eq("powershell.exe")
167
+ expect(current_resource.task.parameters).to be_empty
168
+ expect(subject).to be_updated_by_last_action
132
169
  end
133
170
  end
134
171
 
@@ -442,6 +442,7 @@ describe Chef::Knife::Bootstrap do
442
442
  end
443
443
 
444
444
  it "doesn't create /etc/chef/trusted_certs if :trusted_certs_dir is empty" do
445
+ allow(Dir).to receive(:glob).and_call_original
445
446
  expect(Dir).to receive(:glob).with(File.join(trusted_certs_dir, "*.{crt,pem}")).and_return([])
446
447
  expect(rendered_template).not_to match(%r{mkdir -p /etc/chef/trusted_certs})
447
448
  end
@@ -202,12 +202,20 @@ WRONG
202
202
  it "should enable mount if it is mounted and not enabled" do
203
203
  @new_resource.options("nodev,rw")
204
204
  stub_mounted_enabled(@provider, @mounted_output, "")
205
+ # Add existing mount to test enable action appends additional mount with seperating blank line
205
206
  filesystems = StringIO.new
207
+ filesystems.puts <<~ETCFILESYSTEMS
208
+ /tmp/abc:
209
+ dev = /dev/sdz2
210
+ vfs = jfs2
211
+ mount = true
212
+ options = rw
213
+ ETCFILESYSTEMS
206
214
  allow(::File).to receive(:open).with("/etc/filesystems", "a").and_yield(filesystems)
207
215
 
208
216
  @provider.run_action(:enable)
209
217
 
210
- expect(filesystems.string).to match(%r{^/tmp/foo:\n\tdev\t\t= /dev/sdz1\n\tvfs\t\t= jfs2\n\tmount\t\t= false\n\toptions\t\t= nodev,rw\n$})
218
+ expect(filesystems.string).to match(%r{^\n\n/tmp/foo:\n\tdev\t\t= /dev/sdz1\n\tvfs\t\t= jfs2\n\tmount\t\t= false\n\toptions\t\t= nodev,rw\n$})
211
219
  end
212
220
 
213
221
  it "should not enable mount if it is mounted and already enabled and mount options are unchanged" do
@@ -282,7 +282,7 @@ describe Chef::Provider::Package::Chocolatey do
282
282
  end
283
283
 
284
284
  it "should pass options into the install command" do
285
- allow_remote_list(["git"])
285
+ allow_remote_list(["git"], " -force")
286
286
  new_resource.options("-force")
287
287
  provider.load_current_resource
288
288
  expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -force git", { returns: [0], timeout: timeout }).and_return(double)
@@ -313,6 +313,35 @@ describe Chef::Provider::Package::Chocolatey do
313
313
  expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
314
314
  end
315
315
  end
316
+
317
+ context "private source" do
318
+ it "installing a package without auth options throws an error" do
319
+ allow_remote_list(["package-without-auth"], " -source auth_source")
320
+ new_resource.package_name("package-without-auth")
321
+ new_resource.source("auth_source")
322
+ provider.load_current_resource
323
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
324
+ end
325
+
326
+ it "installing a package with invalid credentials throws an error" do
327
+ allow_remote_list(["package-invalid-auth"], " -source auth_source -u user -p password")
328
+ new_resource.package_name("package-invalid-auth")
329
+ new_resource.source("auth_source")
330
+ new_resource.options("-u user -p password")
331
+ provider.load_current_resource
332
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
333
+ end
334
+
335
+ it "installing a package with valid credentials" do
336
+ allow_remote_list(["git"], " -source auth_source -u user -p password")
337
+ new_resource.source("auth_source")
338
+ new_resource.options("-u user -p password")
339
+ provider.load_current_resource
340
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -u user -p password -source auth_source git", { returns: [0], timeout: timeout }).and_return(double)
341
+ provider.run_action(:install)
342
+ expect(new_resource).to be_updated_by_last_action
343
+ end
344
+ end
316
345
  end
317
346
 
318
347
  describe "#action_upgrade" do
@@ -53,4 +53,9 @@ describe Chef::Resource::OpensslDhparam do
53
53
  expect { resource.key_length 1234 }.to raise_error(ArgumentError)
54
54
  end
55
55
 
56
+ it "sets the mode which user provides for existing file" do
57
+ resource.mode "0600"
58
+ expect(resource.mode).to eql("0600")
59
+ end
60
+
56
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.10.9
4
+ version: 14.11.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-29 00:00:00.000000000 Z
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 14.10.9
19
+ version: 14.11.21
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 14.10.9
26
+ version: 14.11.21
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -1696,6 +1696,7 @@ files:
1696
1696
  - spec/data/trusted_certs/intermediate.pem
1697
1697
  - spec/data/trusted_certs/opscode.pem
1698
1698
  - spec/data/trusted_certs/root.pem
1699
+ - spec/data/windows_certificates/base64_test.cer
1699
1700
  - spec/data/windows_certificates/othertest.cer
1700
1701
  - spec/data/windows_certificates/test.cer
1701
1702
  - spec/data/windows_certificates/test.pem
@@ -2556,7 +2557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2556
2557
  version: '0'
2557
2558
  requirements: []
2558
2559
  rubyforge_project:
2559
- rubygems_version: 2.7.6
2560
+ rubygems_version: 2.7.9
2560
2561
  signing_key:
2561
2562
  specification_version: 4
2562
2563
  summary: A systems integration framework, built to bring the benefits of configuration