chef 15.3.14-universal-mingw32 → 15.4.45-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/chef.gemspec +2 -2
  3. data/lib/chef/application/solo.rb +1 -1
  4. data/lib/chef/event_dispatch/dispatcher.rb +9 -2
  5. data/lib/chef/formatters/doc.rb +3 -3
  6. data/lib/chef/knife.rb +13 -3
  7. data/lib/chef/knife/bootstrap.rb +28 -4
  8. data/lib/chef/knife/bootstrap/templates/chef-full.erb +7 -8
  9. data/lib/chef/knife/data_bag_secret_options.rb +11 -4
  10. data/lib/chef/knife/download.rb +2 -2
  11. data/lib/chef/knife/exec.rb +9 -1
  12. data/lib/chef/knife/ssh.rb +1 -1
  13. data/lib/chef/knife/ssl_check.rb +1 -1
  14. data/lib/chef/knife/supermarket_list.rb +19 -7
  15. data/lib/chef/knife/supermarket_search.rb +3 -2
  16. data/lib/chef/node/attribute.rb +2 -0
  17. data/lib/chef/node/attribute_collections.rb +8 -0
  18. data/lib/chef/node/immutable_collections.rb +12 -0
  19. data/lib/chef/node/mixin/immutablize_array.rb +1 -0
  20. data/lib/chef/node/mixin/immutablize_hash.rb +1 -0
  21. data/lib/chef/provider.rb +14 -8
  22. data/lib/chef/provider/package/chocolatey.rb +11 -3
  23. data/lib/chef/provider/package/dnf/python_helper.rb +8 -3
  24. data/lib/chef/provider/package/windows/exe.rb +2 -2
  25. data/lib/chef/provider/package/windows/msi.rb +3 -3
  26. data/lib/chef/provider/package/yum/python_helper.rb +8 -3
  27. data/lib/chef/provider/service/windows.rb +1 -1
  28. data/lib/chef/resource/apt_repository.rb +19 -13
  29. data/lib/chef/resource/apt_update.rb +15 -1
  30. data/lib/chef/resource/archive_file.rb +10 -1
  31. data/lib/chef/resource/build_essential.rb +14 -1
  32. data/lib/chef/resource/chocolatey_config.rb +17 -1
  33. data/lib/chef/resource/chocolatey_feature.rb +15 -0
  34. data/lib/chef/resource/chocolatey_package.rb +31 -1
  35. data/lib/chef/resource/chocolatey_source.rb +17 -1
  36. data/lib/chef/resource/cookbook_file.rb +1 -1
  37. data/lib/chef/resource/cron_access.rb +22 -1
  38. data/lib/chef/resource/cron_d.rb +46 -1
  39. data/lib/chef/resource/dmg_package.rb +28 -0
  40. data/lib/chef/resource/kernel_module.rb +61 -0
  41. data/lib/chef/resource/sudo.rb +2 -2
  42. data/lib/chef/resource/windows_ad_join.rb +72 -3
  43. data/lib/chef/resource/windows_service.rb +1 -1
  44. data/lib/chef/resource/windows_share.rb +2 -1
  45. data/lib/chef/shell.rb +4 -4
  46. data/lib/chef/shell/ext.rb +2 -2
  47. data/lib/chef/train_transport.rb +1 -1
  48. data/lib/chef/version.rb +1 -1
  49. data/spec/functional/resource/ifconfig_spec.rb +0 -2
  50. data/spec/functional/resource/mount_spec.rb +0 -4
  51. data/spec/functional/util/powershell/cmdlet_spec.rb +2 -2
  52. data/spec/integration/knife/chef_repo_path_spec.rb +4 -2
  53. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +19 -19
  54. data/spec/spec_helper.rb +2 -0
  55. data/spec/unit/formatters/doc_spec.rb +18 -0
  56. data/spec/unit/knife/bootstrap_spec.rb +46 -10
  57. data/spec/unit/knife/supermarket_list_spec.rb +70 -0
  58. data/spec/unit/knife/supermarket_search_spec.rb +85 -0
  59. data/spec/unit/node/attribute_spec.rb +22 -0
  60. data/spec/unit/node/immutable_collections_spec.rb +72 -144
  61. data/spec/unit/provider/package/chocolatey_spec.rb +50 -35
  62. data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
  63. data/spec/unit/provider/service/windows_spec.rb +23 -3
  64. data/spec/unit/resource/chocolatey_package_spec.rb +17 -2
  65. data/spec/unit/resource/windows_ad_join_spec.rb +4 -0
  66. data/spec/unit/resource/windows_service_spec.rb +5 -0
  67. data/spec/unit/resource/windows_share_spec.rb +7 -0
  68. data/tasks/docs.rb +4 -1
  69. metadata +10 -8
@@ -30,7 +30,7 @@ class Chef
30
30
 
31
31
  resource_name :cookbook_file
32
32
 
33
- description "Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{Chef::Dist::CLIENT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{Chef::Dist::CLIENT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the Chef server. A file is not transferred when the checksums match. Only files that require an update are transferred from the Chef server to a node."
33
+ description "Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{Chef::Dist::CLIENT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{Chef::Dist::CLIENT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{Chef::Dist::SERVER_PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{Chef::Dist::SERVER_PRODUCT} to a node."
34
34
 
35
35
  property :source, [ String, Array ],
36
36
  description: "The name of the file in COOKBOOK_NAME/files/default or the path to a file located in COOKBOOK_NAME/files. The path must include the file name and its extension. This can be used to distribute specific files depending upon the platform used.",
@@ -3,7 +3,7 @@
3
3
  # Author:: Tim Smith <tsmith@chef.io>
4
4
  #
5
5
  # Copyright:: 2014-2018, Sander Botman
6
- # Copyright:: 2018, Chef Software, Inc.
6
+ # Copyright:: 2018-2019, Chef Software, Inc.
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
9
9
  # you may not use this file except in compliance with the License.
@@ -28,6 +28,27 @@ class Chef
28
28
 
29
29
  introduced "14.4"
30
30
  description "Use the cron_access resource to manage the /etc/cron.allow and /etc/cron.deny files."
31
+ examples <<~DOC
32
+ Add the mike user to cron.allow
33
+ ```ruby
34
+ cron_access 'mike'
35
+ ```
36
+
37
+ Add the mike user to cron.deny
38
+ ```ruby
39
+ cron_access 'mike' do
40
+ action :deny
41
+ end
42
+ ```
43
+
44
+ Specify the username with the user property
45
+ ```ruby
46
+ cron_access 'Deny the tomcat access to cron for security purposes' do
47
+ user 'jenkins'
48
+ action :deny
49
+ end
50
+ ```
51
+ DOC
31
52
 
32
53
  property :user, String,
33
54
  description: "An optional property to set the user name if it differs from the resource block's name.",
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: 2008-2018, Chef Software, Inc.
2
+ # Copyright:: 2008-2019, Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +26,51 @@ class Chef
26
26
 
27
27
  introduced "14.4"
28
28
  description "Use the cron_d resource to manage cron definitions in /etc/cron.d. This is similar to the 'cron' resource, but it does not use the monolithic /etc/crontab file."
29
+ examples <<~DOC
30
+ To run a program on the fifth hour of the day
31
+ ```ruby
32
+ cron_d 'noop' do
33
+ hour '5'
34
+ minute '0'
35
+ command '/bin/true'
36
+ end
37
+ ```
38
+
39
+ To run an entry if a folder exists
40
+ ```ruby
41
+ cron_d 'ganglia_tomcat_thread_max' do
42
+ command "/usr/bin/gmetric
43
+ -n 'tomcat threads max'
44
+ -t uint32
45
+ -v '/usr/local/bin/tomcat-stat
46
+ --thread-max'"
47
+ only_if { ::File.exist?('/home/jboss') }
48
+ end
49
+ ```
50
+
51
+ To run an entry every Saturday, 8:00 AM
52
+ ```ruby
53
+ cron_d 'name_of_cron_entry' do
54
+ minute '0'
55
+ hour '8'
56
+ weekday '6'
57
+ mailto 'admin@example.com'
58
+ action :create
59
+ end
60
+ ```
61
+
62
+ To run an entry at 8:00 PM, every weekday (Monday through Friday), but only in November
63
+ ```ruby
64
+ cron_d 'name_of_cron_entry' do
65
+ minute '0'
66
+ hour '20'
67
+ day '*'
68
+ month '11'
69
+ weekday '1-5'
70
+ action :create
71
+ end
72
+ ```
73
+ DOC
29
74
 
30
75
  # validate a provided value is between two other provided values
31
76
  # we also allow * as a valid input
@@ -25,6 +25,34 @@ class Chef
25
25
 
26
26
  description "Use the dmg_package resource to install a dmg 'package'. The resource will retrieve the dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory) to the specified destination (/Applications), and detach the image using hdiutil. The dmg file will be stored in the Chef::Config[:file_cache_path]."
27
27
  introduced "14.0"
28
+ examples <<~DOC
29
+ Install Google Chrome via the DMG package
30
+ ```ruby
31
+ dmg_package 'Google Chrome' do
32
+ dmg_name 'googlechrome'
33
+ source 'https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg'
34
+ checksum '7daa2dc5c46d9bfb14f1d7ff4b33884325e5e63e694810adc58f14795165c91a'
35
+ action :install
36
+ end
37
+ ```
38
+
39
+ Install Virtualbox from the .mpkg
40
+ ```ruby
41
+ dmg_package 'Virtualbox' do
42
+ source 'http://dlc.sun.com.edgesuite.net/virtualbox/4.0.8/VirtualBox-4.0.8-71778-OSX.dmg'
43
+ type 'mpkg'
44
+ end
45
+ ```
46
+
47
+ Install pgAdmin and automatically accept the EULA
48
+ ```ruby
49
+ dmg_package 'pgAdmin3' do
50
+ source 'http://wwwmaster.postgresql.org/redir/198/h/pgadmin3/release/v1.12.3/osx/pgadmin3-1.12.3.dmg'
51
+ checksum '9435f79d5b52d0febeddfad392adf82db9df159196f496c1ab139a6957242ce9'
52
+ accept_eula true
53
+ end
54
+ ```
55
+ DOC
28
56
 
29
57
  property :app, String,
30
58
  description: "The name of the application as it appears in the /Volumes directory if it differs from the resource block's name.",
@@ -15,11 +15,61 @@ class Chef
15
15
 
16
16
  description "Use the kernel_module resource to manage kernel modules on Linux systems. This resource can load, unload, blacklist, disable, install, and uninstall modules."
17
17
  introduced "14.3"
18
+ examples <<~DOC
19
+ Install and load a kernel module, and ensure it loads on reboot.
20
+ ```ruby
21
+ kernel_module 'loop'
22
+ ```
23
+ Install and load a kernel with a specific set of options, and ensure it loads on reboot. Consult kernel module
24
+ documentation for specific options that are supported.
25
+ ```ruby
26
+ kernel_module 'loop' do
27
+ options [
28
+ 'max_loop=4',
29
+ 'max_part=8'
30
+ ]
31
+ end
32
+ ```
33
+ Load a kernel module.
34
+ ```ruby
35
+ kernel_module 'loop' do
36
+ action :load
37
+ end
38
+ ```
39
+ Unload a kernel module and remove module config, so it doesn’t load on reboot.
40
+ ```ruby
41
+ kernel_module 'loop' do
42
+ action :uninstall
43
+ end
44
+ ```
45
+ Unload kernel module.
46
+ ```ruby
47
+ kernel_module 'loop' do
48
+ action :unload
49
+ end
50
+ ```
51
+ Blacklist a module from loading.
52
+ ```ruby
53
+ kernel_module 'loop' do
54
+ action :blacklist
55
+ end
56
+ ```
57
+ Disable a kernel module.
58
+ ```ruby
59
+ kernel_module 'loop' do
60
+ action :disable
61
+ end
62
+ ```
63
+ DOC
18
64
 
19
65
  property :modname, String,
20
66
  description: "An optional property to set the kernel module name if it differs from the resource block's name.",
21
67
  name_property: true, identity: true
22
68
 
69
+ property :options, Array,
70
+ description: "An optional property to set options for the kernel module.",
71
+ introduced: "15.4"
72
+
23
73
  property :load_dir, String,
24
74
  description: "The directory to load modules from.",
25
75
  default: "/etc/modules-load.d"
@@ -31,6 +81,13 @@ class Chef
31
81
  action :install do
32
82
  description "Load kernel module, and ensure it loads on reboot."
33
83
 
84
+ # create options file before loading the module
85
+ unless new_resource.options.nil?
86
+ file "#{new_resource.unload_dir}/options_#{new_resource.modname}.conf" do
87
+ content "options #{new_resource.modname} #{new_resource.options.join(" ")}\n"
88
+ end.run_action(:create)
89
+ end
90
+
34
91
  # load the module first before installing
35
92
  new_resource.run_action(:load)
36
93
 
@@ -64,6 +121,10 @@ class Chef
64
121
  notifies :run, "execute[update initramfs]", :delayed
65
122
  end
66
123
 
124
+ file "#{new_resource.unload_dir}/options_#{new_resource.modname}.conf" do
125
+ action :delete
126
+ end
127
+
67
128
  with_run_context :root do
68
129
  find_resource(:execute, "update initramfs") do
69
130
  command initramfs_command
@@ -166,7 +166,7 @@ class Chef
166
166
  source new_resource.template
167
167
  mode "0440"
168
168
  variables new_resource.variables
169
- verify "#{new_resource.visudo_binary} -cf %{path}" if visudo_present?
169
+ verify "cat #{new_resource.config_prefix}/sudoers %{path} | #{new_resource.visudo_binary} -cf -" if visudo_present?
170
170
  action :create
171
171
  end
172
172
  else
@@ -185,7 +185,7 @@ class Chef
185
185
  setenv: new_resource.setenv,
186
186
  env_keep_add: new_resource.env_keep_add,
187
187
  env_keep_subtract: new_resource.env_keep_subtract
188
- verify "#{new_resource.visudo_binary} -cf %{path}" if visudo_present?
188
+ verify "cat #{new_resource.config_prefix}/sudoers %{path} | #{new_resource.visudo_binary} -cf -" if visudo_present?
189
189
  action :create
190
190
  end
191
191
  end
@@ -57,6 +57,10 @@ class Chef
57
57
  description: "Specifies a new hostname for the computer in the new domain.",
58
58
  introduced: "14.5"
59
59
 
60
+ property :workgroup_name, String,
61
+ description: "Specifies the name of a workgroup to which the computer is added to when it is removed from the domain. The default value is WORKGROUP. This property is only applicable to the :leave action.",
62
+ introduced: "15.0"
63
+
60
64
  # define this again so we can default it to true. Otherwise failures print the password
61
65
  property :sensitive, [TrueClass, FalseClass],
62
66
  default: true, desired_state: false
@@ -64,7 +68,7 @@ class Chef
64
68
  action :join do
65
69
  description "Join the Active Directory domain."
66
70
 
67
- unless on_domain?
71
+ unless on_desired_domain?
68
72
  cmd = "$pswd = ConvertTo-SecureString \'#{new_resource.domain_password}\' -AsPlainText -Force;"
69
73
  cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{new_resource.domain_user}@#{new_resource.domain_name}\",$pswd);"
70
74
  cmd << "Add-Computer -DomainName #{new_resource.domain_name} -Credential $credential"
@@ -92,12 +96,77 @@ class Chef
92
96
  end
93
97
  end
94
98
 
99
+ action :leave do
100
+ description "Leave the Active Directory domain."
101
+
102
+ if joined_to_domain?
103
+ cmd = ""
104
+ cmd << "$pswd = ConvertTo-SecureString \'#{new_resource.domain_password}\' -AsPlainText -Force;"
105
+ cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{new_resource.domain_user}@#{new_resource.domain_name}\",$pswd);"
106
+ cmd << "Remove-Computer"
107
+ cmd << " -UnjoinDomainCredential $credential"
108
+ cmd << " -NewName \"#{new_resource.new_hostname}\"" if new_resource.new_hostname
109
+ cmd << " -WorkgroupName \"#{new_resource.workgroup_name}\"" if new_resource.workgroup_name
110
+ cmd << " -Force"
111
+
112
+ converge_by("leave Active Directory domain #{node_domain}") do
113
+ ps_run = powershell_out(cmd)
114
+ if ps_run.error?
115
+ if sensitive?
116
+ raise "Failed to leave the domain #{node_domain}: *suppressed sensitive resource output*"
117
+ else
118
+ raise "Failed to leave the domain #{node_domain}: #{ps_run.stderr}"
119
+ end
120
+ end
121
+
122
+ unless new_resource.reboot == :never
123
+ reboot "Reboot to leave domain #{new_resource.domain_name}" do
124
+ action clarify_reboot(new_resource.reboot)
125
+ reason "Reboot to leave domain #{new_resource.domain_name}"
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+
95
132
  action_class do
96
- def on_domain?
133
+ #
134
+ # @return [String] The domain name the node is joined to. When the node
135
+ # is not joined to a domain this will return the name of the
136
+ # workgroup the node is a member of.
137
+ #
138
+ def node_domain
97
139
  node_domain = powershell_out!("(Get-WmiObject Win32_ComputerSystem).Domain")
98
140
  raise "Failed to check if the system is joined to the domain #{new_resource.domain_name}: #{node_domain.stderr}}" if node_domain.error?
99
141
 
100
- node_domain.stdout.downcase.strip == new_resource.domain_name.downcase
142
+ node_domain.stdout.downcase.strip
143
+ end
144
+
145
+ #
146
+ # @return [String] The workgroup the node is a member of. This will
147
+ # return an empty string if the system is not a member of a
148
+ # workgroup.
149
+ #
150
+ def node_workgroup
151
+ node_workgroup = powershell_out!("(Get-WmiObject Win32_ComputerSystem).Workgroup")
152
+ raise "Failed to check if the system is currently a member of a workgroup" if node_workgroup.error?
153
+
154
+ node_workgroup.stdout.downcase.strip
155
+ end
156
+
157
+ #
158
+ # @return [true, false] Whether or not the node is joined to ANY domain
159
+ #
160
+ def joined_to_domain?
161
+ node_workgroup.empty? && !node_domain.empty?
162
+ end
163
+
164
+ #
165
+ # @return [true, false] Whether or not the node is joined to the domain
166
+ # defined by the resource :domain_name property.
167
+ #
168
+ def on_desired_domain?
169
+ node_domain == new_resource.domain_name.downcase
101
170
  end
102
171
 
103
172
  # This resource historically took `:immediate` and `:delayed` as arguments to the reboot property but then
@@ -108,7 +108,7 @@ class Chef
108
108
  description: "Description of the service.",
109
109
  introduced: "14.0"
110
110
 
111
- property :run_as_user, String, default: "LocalSystem"
111
+ property :run_as_user, String, default: "localsystem", coerce: proc { |x| x.downcase }
112
112
  property :run_as_password, String, default: ""
113
113
  end
114
114
  end
@@ -38,7 +38,8 @@ class Chef
38
38
 
39
39
  # 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.
40
40
  property :path, String,
41
- description: "The path of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created."
41
+ description: "The path of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created.",
42
+ coerce: proc { |p| p.gsub!(%r{/}, "\\") || p }
42
43
 
43
44
  # Specifies an optional description of the SMB share. A description of the share is displayed by running the Get-SmbShare cmdlet. The description may not contain more than 256 characters.
44
45
  property :description, String,
data/lib/chef/shell.rb CHANGED
@@ -121,11 +121,11 @@ module Shell
121
121
  irb_conf[:IRB_RC] = lambda do |conf|
122
122
  m = conf.main
123
123
 
124
- conf.prompt_c = "chef#{leader(m)} > "
124
+ conf.prompt_c = "#{Chef::Dist::EXEC}#{leader(m)} > "
125
125
  conf.return_format = " => %s \n"
126
- conf.prompt_i = "chef#{leader(m)} (#{Chef::VERSION})> "
127
- conf.prompt_n = "chef#{leader(m)} ?> "
128
- conf.prompt_s = "chef#{leader(m)}%l> "
126
+ conf.prompt_i = "#{Chef::Dist::EXEC}#{leader(m)} (#{Chef::VERSION})> "
127
+ conf.prompt_n = "#{Chef::Dist::EXEC}#{leader(m)} ?> "
128
+ conf.prompt_s = "#{Chef::Dist::EXEC}#{leader(m)}%l> "
129
129
  conf.use_tracer = false
130
130
  end
131
131
  end
@@ -211,8 +211,8 @@ module Shell
211
211
  desc "prints information about chef"
212
212
  def version
213
213
  puts "This is the #{Chef::Dist::SHELL}.\n" +
214
- " Chef Version: #{::Chef::VERSION}\n" +
215
- " https://www.chef.io/\n" +
214
+ " #{Chef::Dist::PRODUCT} Version: #{::Chef::VERSION}\n" +
215
+ " #{Chef::Dist::WEBSITE}\n" +
216
216
  " https://docs.chef.io/"
217
217
  :ucanhaz_automation
218
218
  end
@@ -100,7 +100,7 @@ class Chef
100
100
  tm_config = Chef::Config.target_mode
101
101
  protocol = tm_config.protocol
102
102
  train_config = tm_config.to_hash.select { |k| Train.options(protocol).key?(k) }
103
- Chef::Log.trace("Using target mode options from Chef config file: #{train_config.keys.join(", ")}") if train_config
103
+ Chef::Log.trace("Using target mode options from #{Chef::Dist::PRODUCT} config file: #{train_config.keys.join(", ")}") if train_config
104
104
 
105
105
  # Load the credentials file, and place any valid settings into the train configuration
106
106
  credentials = load_credentials(tm_config.host)
data/lib/chef/version.rb CHANGED
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("15.3.14")
26
+ VERSION = Chef::VersionString.new("15.4.45")
27
27
  end
28
28
 
29
29
  #
@@ -24,8 +24,6 @@ require "chef/mixin/shell_out"
24
24
  include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai[:platform_family] == "rhel" && ohai[:platform_version].to_i < 7))
25
25
 
26
26
  describe Chef::Resource::Ifconfig, :requires_root, external: include_flag do
27
- # This test does not work in travis because there is no eth0
28
-
29
27
  include Chef::Mixin::ShellOut
30
28
 
31
29
  let(:new_resource) do
@@ -25,13 +25,9 @@ require "tmpdir"
25
25
  include_flag = !(%w{debian rhel amazon aix solaris2}.include?(ohai[:platform_family]))
26
26
 
27
27
  describe Chef::Resource::Mount, :requires_root, external: include_flag do
28
- # Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
29
- # exist even after loading the kernel module
30
-
31
28
  include Chef::Mixin::ShellOut
32
29
 
33
30
  # Platform specific setup, cleanup and validation helpers.
34
-
35
31
  def setup_device_for_mount
36
32
  # use ramdisk for creating a test device for mount.
37
33
  # This can cleaner if we have chef resource/provider for ramdisk.
@@ -88,7 +88,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
88
88
  it "returns json format data" do
89
89
  result = cmdlet_alias_requires_switch_or_argument.run({}, {}, "ls")
90
90
  expect(result.succeeded?).to eq(true)
91
- expect(lambda { Chef::JSONCompat.parse(result.return_value) }).not_to raise_error
91
+ expect { Chef::JSONCompat.parse(result.return_value) }.not_to raise_error
92
92
  end
93
93
  end
94
94
 
@@ -105,7 +105,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
105
105
  context "when constructor is given invalid arguments" do
106
106
  let(:cmd_output_format) { :invalid }
107
107
  it "throws an exception if an invalid format is passed to the constructor" do
108
- expect(lambda { simple_cmdlet }).to raise_error(ArgumentError)
108
+ expect { simple_cmdlet }.to raise_error(ArgumentError)
109
109
  end
110
110
  end
111
111
  end