chef 12.4.0.rc.0-universal-mingw32 → 12.4.0.rc.2-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +12 -1
  3. data/lib/chef/api_client.rb +130 -26
  4. data/lib/chef/application.rb +0 -1
  5. data/lib/chef/application/client.rb +8 -19
  6. data/lib/chef/audit/audit_reporter.rb +12 -7
  7. data/lib/chef/audit/logger.rb +36 -0
  8. data/lib/chef/audit/runner.rb +4 -2
  9. data/lib/chef/chef_class.rb +62 -11
  10. data/lib/chef/client.rb +587 -207
  11. data/lib/chef/config.rb +0 -1
  12. data/lib/chef/dsl/recipe.rb +45 -56
  13. data/lib/chef/dsl/resources.rb +3 -2
  14. data/lib/chef/event_dispatch/base.rb +7 -2
  15. data/lib/chef/exceptions.rb +4 -1
  16. data/lib/chef/file_content_management/deploy/mv_windows.rb +16 -6
  17. data/lib/chef/formatters/doc.rb +15 -7
  18. data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +10 -7
  19. data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -0
  20. data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +4 -1
  21. data/lib/chef/http/authenticator.rb +7 -2
  22. data/lib/chef/knife.rb +16 -4
  23. data/lib/chef/knife/client_create.rb +55 -31
  24. data/lib/chef/knife/core/generic_presenter.rb +1 -1
  25. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  26. data/lib/chef/knife/osc_user_create.rb +97 -0
  27. data/lib/chef/knife/osc_user_delete.rb +51 -0
  28. data/lib/chef/knife/osc_user_edit.rb +58 -0
  29. data/lib/chef/knife/osc_user_list.rb +47 -0
  30. data/lib/chef/knife/osc_user_reregister.rb +64 -0
  31. data/lib/chef/knife/osc_user_show.rb +54 -0
  32. data/lib/chef/knife/user_create.rb +95 -36
  33. data/lib/chef/knife/user_delete.rb +52 -2
  34. data/lib/chef/knife/user_edit.rb +37 -7
  35. data/lib/chef/knife/user_list.rb +3 -0
  36. data/lib/chef/knife/user_reregister.rb +39 -8
  37. data/lib/chef/knife/user_show.rb +30 -1
  38. data/lib/chef/mixin/api_version_request_handling.rb +66 -0
  39. data/lib/chef/mixin/convert_to_class_name.rb +10 -4
  40. data/lib/chef/mixin/deprecation.rb +24 -0
  41. data/lib/chef/mixin/powershell_out.rb +98 -0
  42. data/lib/chef/mixin/provides.rb +5 -18
  43. data/lib/chef/mixin/uris.rb +11 -0
  44. data/lib/chef/mixin/windows_architecture_helper.rb +5 -2
  45. data/lib/chef/mixin/windows_env_helper.rb +11 -2
  46. data/lib/chef/node_map.rb +130 -75
  47. data/lib/chef/osc_user.rb +194 -0
  48. data/lib/chef/platform/provider_mapping.rb +2 -269
  49. data/lib/chef/platform/provider_priority_map.rb +6 -69
  50. data/lib/chef/platform/query_helpers.rb +5 -0
  51. data/lib/chef/platform/resource_priority_map.rb +12 -15
  52. data/lib/chef/policy_builder/policyfile.rb +1 -0
  53. data/lib/chef/provider.rb +19 -0
  54. data/lib/chef/provider/directory.rb +3 -0
  55. data/lib/chef/provider/dsc_resource.rb +8 -1
  56. data/lib/chef/provider/file.rb +1 -0
  57. data/lib/chef/provider/group/aix.rb +1 -0
  58. data/lib/chef/provider/group/dscl.rb +1 -1
  59. data/lib/chef/provider/group/gpasswd.rb +1 -0
  60. data/lib/chef/provider/group/groupmod.rb +1 -1
  61. data/lib/chef/provider/group/pw.rb +1 -0
  62. data/lib/chef/provider/group/suse.rb +2 -0
  63. data/lib/chef/provider/group/usermod.rb +2 -1
  64. data/lib/chef/provider/group/windows.rb +1 -1
  65. data/lib/chef/provider/ifconfig.rb +2 -0
  66. data/lib/chef/provider/ifconfig/aix.rb +1 -0
  67. data/lib/chef/provider/ifconfig/debian.rb +2 -0
  68. data/lib/chef/provider/ifconfig/redhat.rb +1 -0
  69. data/lib/chef/provider/lwrp_base.rb +4 -0
  70. data/lib/chef/provider/mount.rb +0 -1
  71. data/lib/chef/provider/mount/aix.rb +1 -0
  72. data/lib/chef/provider/mount/mount.rb +2 -0
  73. data/lib/chef/provider/mount/solaris.rb +2 -0
  74. data/lib/chef/provider/package.rb +55 -0
  75. data/lib/chef/provider/package/aix.rb +7 -7
  76. data/lib/chef/provider/package/apt.rb +3 -3
  77. data/lib/chef/provider/package/dpkg.rb +4 -4
  78. data/lib/chef/provider/package/easy_install.rb +5 -5
  79. data/lib/chef/provider/package/freebsd/base.rb +2 -2
  80. data/lib/chef/provider/package/freebsd/pkg.rb +6 -6
  81. data/lib/chef/provider/package/freebsd/pkgng.rb +5 -5
  82. data/lib/chef/provider/package/freebsd/port.rb +4 -4
  83. data/lib/chef/provider/package/homebrew.rb +2 -2
  84. data/lib/chef/provider/package/ips.rb +4 -4
  85. data/lib/chef/provider/package/macports.rb +5 -6
  86. data/lib/chef/provider/package/openbsd.rb +4 -5
  87. data/lib/chef/provider/package/pacman.rb +4 -4
  88. data/lib/chef/provider/package/portage.rb +2 -0
  89. data/lib/chef/provider/package/rpm.rb +7 -8
  90. data/lib/chef/provider/package/rubygems.rb +5 -12
  91. data/lib/chef/provider/package/smartos.rb +4 -4
  92. data/lib/chef/provider/package/solaris.rb +7 -7
  93. data/lib/chef/provider/package/windows/msi.rb +1 -1
  94. data/lib/chef/provider/package/yum.rb +4 -6
  95. data/lib/chef/provider/package/zypper.rb +16 -14
  96. data/lib/chef/provider/powershell_script.rb +129 -47
  97. data/lib/chef/provider/remote_file/content.rb +4 -1
  98. data/lib/chef/provider/remote_file/local_file.rb +10 -4
  99. data/lib/chef/provider/service.rb +44 -0
  100. data/lib/chef/provider/service/freebsd.rb +1 -1
  101. data/lib/chef/provider/service/init.rb +1 -0
  102. data/lib/chef/provider/service/macosx.rb +1 -1
  103. data/lib/chef/provider/service/windows.rb +0 -1
  104. data/lib/chef/provider/user.rb +1 -1
  105. data/lib/chef/provider/user/aix.rb +3 -2
  106. data/lib/chef/provider/user/pw.rb +1 -0
  107. data/lib/chef/provider/user/solaris.rb +2 -0
  108. data/lib/chef/provider/user/useradd.rb +1 -0
  109. data/lib/chef/provider_resolver.rb +87 -134
  110. data/lib/chef/resource.rb +274 -68
  111. data/lib/chef/resource/apt_package.rb +0 -2
  112. data/lib/chef/resource/bash.rb +0 -2
  113. data/lib/chef/resource/batch.rb +1 -1
  114. data/lib/chef/resource/bff_package.rb +0 -7
  115. data/lib/chef/resource/breakpoint.rb +3 -6
  116. data/lib/chef/resource/chef_gem.rb +0 -3
  117. data/lib/chef/resource/cookbook_file.rb +1 -3
  118. data/lib/chef/resource/cron.rb +2 -4
  119. data/lib/chef/resource/csh.rb +0 -2
  120. data/lib/chef/resource/deploy.rb +9 -6
  121. data/lib/chef/resource/deploy_revision.rb +0 -14
  122. data/lib/chef/resource/directory.rb +2 -4
  123. data/lib/chef/resource/dpkg_package.rb +0 -5
  124. data/lib/chef/resource/dsc_resource.rb +2 -3
  125. data/lib/chef/resource/dsc_script.rb +2 -3
  126. data/lib/chef/resource/easy_install_package.rb +0 -7
  127. data/lib/chef/resource/env.rb +3 -3
  128. data/lib/chef/resource/erl_call.rb +2 -5
  129. data/lib/chef/resource/execute.rb +2 -4
  130. data/lib/chef/resource/file.rb +2 -4
  131. data/lib/chef/resource/freebsd_package.rb +0 -5
  132. data/lib/chef/resource/gem_package.rb +0 -3
  133. data/lib/chef/resource/git.rb +0 -3
  134. data/lib/chef/resource/group.rb +2 -4
  135. data/lib/chef/resource/homebrew_package.rb +0 -2
  136. data/lib/chef/resource/http_request.rb +3 -4
  137. data/lib/chef/resource/ifconfig.rb +3 -4
  138. data/lib/chef/resource/ips_package.rb +2 -2
  139. data/lib/chef/resource/link.rb +3 -5
  140. data/lib/chef/resource/log.rb +2 -4
  141. data/lib/chef/resource/lwrp_base.rb +10 -61
  142. data/lib/chef/resource/macosx_service.rb +1 -2
  143. data/lib/chef/resource/macports_package.rb +0 -7
  144. data/lib/chef/resource/mdadm.rb +2 -5
  145. data/lib/chef/resource/mount.rb +2 -4
  146. data/lib/chef/resource/ohai.rb +2 -4
  147. data/lib/chef/resource/openbsd_package.rb +0 -6
  148. data/lib/chef/resource/package.rb +9 -6
  149. data/lib/chef/resource/pacman_package.rb +0 -7
  150. data/lib/chef/resource/paludis_package.rb +2 -3
  151. data/lib/chef/resource/perl.rb +0 -3
  152. data/lib/chef/resource/portage_package.rb +0 -3
  153. data/lib/chef/resource/powershell_script.rb +1 -2
  154. data/lib/chef/resource/python.rb +0 -3
  155. data/lib/chef/resource/reboot.rb +1 -3
  156. data/lib/chef/resource/registry_key.rb +3 -5
  157. data/lib/chef/resource/remote_directory.rb +3 -5
  158. data/lib/chef/resource/remote_file.rb +4 -5
  159. data/lib/chef/resource/route.rb +3 -5
  160. data/lib/chef/resource/rpm_package.rb +0 -2
  161. data/lib/chef/resource/ruby.rb +0 -4
  162. data/lib/chef/resource/ruby_block.rb +2 -4
  163. data/lib/chef/resource/scm.rb +3 -5
  164. data/lib/chef/resource/script.rb +0 -3
  165. data/lib/chef/resource/service.rb +3 -5
  166. data/lib/chef/resource/smartos_package.rb +0 -9
  167. data/lib/chef/resource/solaris_package.rb +0 -10
  168. data/lib/chef/resource/subversion.rb +1 -3
  169. data/lib/chef/resource/template.rb +0 -4
  170. data/lib/chef/resource/timestamped_deploy.rb +0 -4
  171. data/lib/chef/resource/user.rb +2 -5
  172. data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -7
  173. data/lib/chef/resource/windows_package.rb +3 -3
  174. data/lib/chef/resource/windows_script.rb +2 -2
  175. data/lib/chef/resource/windows_service.rb +3 -3
  176. data/lib/chef/resource/yum_package.rb +0 -3
  177. data/lib/chef/resource/zypper_package.rb +27 -0
  178. data/lib/chef/resource_builder.rb +7 -0
  179. data/lib/chef/resource_reporter.rb +1 -1
  180. data/lib/chef/resource_resolver.rb +108 -62
  181. data/lib/chef/resources.rb +1 -0
  182. data/lib/chef/rest.rb +1 -0
  183. data/lib/chef/server_api.rb +2 -0
  184. data/lib/chef/user.rb +193 -42
  185. data/lib/chef/util/backup.rb +9 -1
  186. data/lib/chef/util/path_helper.rb +0 -1
  187. data/lib/chef/version.rb +1 -1
  188. data/spec/functional/audit/runner_spec.rb +22 -42
  189. data/spec/functional/mixin/powershell_out_spec.rb +43 -0
  190. data/spec/functional/resource/execute_spec.rb +9 -2
  191. data/spec/functional/resource/file_spec.rb +25 -0
  192. data/spec/functional/resource/group_spec.rb +5 -0
  193. data/spec/functional/resource/link_spec.rb +5 -11
  194. data/spec/functional/resource/powershell_spec.rb +40 -5
  195. data/spec/functional/resource/user/useradd_spec.rb +10 -18
  196. data/spec/integration/recipes/lwrp_spec.rb +57 -0
  197. data/spec/integration/recipes/provider_choice.rb +2 -7
  198. data/spec/integration/recipes/recipe_dsl_spec.rb +517 -19
  199. data/spec/spec_helper.rb +1 -1
  200. data/spec/support/lib/chef/provider/openldap_includer.rb +29 -0
  201. data/spec/support/lib/chef/resource/cat.rb +0 -2
  202. data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -6
  203. data/spec/support/lib/chef/resource/openldap_includer.rb +27 -0
  204. data/spec/support/lib/chef/resource/with_state.rb +0 -9
  205. data/spec/support/lib/chef/resource/zen_follower.rb +0 -6
  206. data/spec/support/lib/chef/resource/zen_master.rb +1 -6
  207. data/spec/support/shared/context/client.rb +277 -0
  208. data/spec/support/shared/examples/client.rb +53 -0
  209. data/spec/support/shared/functional/file_resource.rb +0 -4
  210. data/spec/support/shared/functional/securable_resource.rb +0 -24
  211. data/spec/support/shared/functional/securable_resource_with_reporting.rb +4 -4
  212. data/spec/support/shared/functional/windows_script.rb +1 -1
  213. data/spec/support/shared/unit/api_versioning.rb +77 -0
  214. data/spec/support/shared/unit/knife_shared.rb +40 -0
  215. data/spec/support/shared/unit/user_and_client_shared.rb +115 -0
  216. data/spec/unit/api_client_spec.rb +189 -14
  217. data/spec/unit/application/client_spec.rb +0 -5
  218. data/spec/unit/audit/audit_reporter_spec.rb +58 -14
  219. data/spec/unit/audit/logger_spec.rb +42 -0
  220. data/spec/unit/audit/runner_spec.rb +2 -2
  221. data/spec/unit/chef_fs/file_pattern_spec.rb +3 -15
  222. data/spec/unit/client_spec.rb +58 -374
  223. data/spec/unit/cookbook_spec.rb +0 -9
  224. data/spec/unit/cookbook_version_spec.rb +0 -20
  225. data/spec/unit/deprecation_spec.rb +55 -0
  226. data/spec/unit/dsl/resources_spec.rb +85 -0
  227. data/spec/unit/exceptions_spec.rb +2 -2
  228. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +60 -0
  229. data/spec/unit/formatters/doc_spec.rb +46 -0
  230. data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +12 -10
  231. data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +8 -0
  232. data/spec/unit/http/authenticator_spec.rb +11 -2
  233. data/spec/unit/knife/client_create_spec.rb +122 -51
  234. data/spec/unit/knife/core/subcommand_loader_spec.rb +19 -3
  235. data/spec/unit/knife/core/ui_spec.rb +14 -0
  236. data/spec/unit/knife/osc_user_create_spec.rb +93 -0
  237. data/spec/unit/knife/osc_user_delete_spec.rb +44 -0
  238. data/spec/unit/knife/osc_user_edit_spec.rb +52 -0
  239. data/spec/unit/knife/osc_user_list_spec.rb +37 -0
  240. data/spec/unit/knife/osc_user_reregister_spec.rb +58 -0
  241. data/spec/unit/knife/osc_user_show_spec.rb +46 -0
  242. data/spec/unit/knife/user_create_spec.rb +177 -51
  243. data/spec/unit/knife/user_delete_spec.rb +34 -8
  244. data/spec/unit/knife/user_edit_spec.rb +31 -12
  245. data/spec/unit/knife/user_list_spec.rb +7 -3
  246. data/spec/unit/knife/user_reregister_spec.rb +38 -17
  247. data/spec/unit/knife/user_show_spec.rb +35 -11
  248. data/spec/unit/knife_spec.rb +10 -4
  249. data/spec/unit/lwrp_spec.rb +228 -54
  250. data/spec/unit/mixin/api_version_request_handling_spec.rb +127 -0
  251. data/spec/unit/mixin/command_spec.rb +1 -2
  252. data/spec/unit/mixin/powershell_out_spec.rb +70 -0
  253. data/spec/unit/mixin/uris_spec.rb +23 -11
  254. data/spec/unit/node_map_spec.rb +4 -1
  255. data/spec/unit/osc_user_spec.rb +276 -0
  256. data/spec/unit/platform_spec.rb +0 -60
  257. data/spec/unit/provider/deploy_spec.rb +1 -1
  258. data/spec/unit/provider/directory_spec.rb +199 -135
  259. data/spec/unit/provider/ifconfig/debian_spec.rb +0 -10
  260. data/spec/unit/provider/package/aix_spec.rb +16 -16
  261. data/spec/unit/provider/package/dpkg_spec.rb +2 -2
  262. data/spec/unit/provider/package/freebsd/pkg_spec.rb +13 -13
  263. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
  264. data/spec/unit/provider/package/freebsd/port_spec.rb +7 -7
  265. data/spec/unit/provider/package/ips_spec.rb +22 -22
  266. data/spec/unit/provider/package/macports_spec.rb +10 -10
  267. data/spec/unit/provider/package/openbsd_spec.rb +4 -26
  268. data/spec/unit/provider/package/pacman_spec.rb +5 -5
  269. data/spec/unit/provider/package/rpm_spec.rb +14 -14
  270. data/spec/unit/provider/package/rubygems_spec.rb +10 -44
  271. data/spec/unit/provider/package/smartos_spec.rb +4 -4
  272. data/spec/unit/provider/package/solaris_spec.rb +11 -11
  273. data/spec/unit/provider/package/zypper_spec.rb +125 -90
  274. data/spec/unit/provider/package_spec.rb +34 -0
  275. data/spec/unit/provider/powershell_spec.rb +53 -11
  276. data/spec/unit/provider/remote_directory_spec.rb +2 -2
  277. data/spec/unit/provider/remote_file/local_file_spec.rb +25 -6
  278. data/spec/unit/provider/service/freebsd_service_spec.rb +0 -12
  279. data/spec/unit/provider/user_spec.rb +3 -3
  280. data/spec/unit/provider_resolver_spec.rb +463 -327
  281. data/spec/unit/recipe_spec.rb +42 -15
  282. data/spec/unit/resource/breakpoint_spec.rb +1 -1
  283. data/spec/unit/resource/erl_call_spec.rb +1 -1
  284. data/spec/unit/resource/file_spec.rb +1 -1
  285. data/spec/unit/resource/ifconfig_spec.rb +10 -6
  286. data/spec/unit/resource/remote_file_spec.rb +5 -0
  287. data/spec/unit/resource/route_spec.rb +1 -1
  288. data/spec/unit/resource/ruby_block_spec.rb +2 -2
  289. data/spec/unit/resource/template_spec.rb +1 -1
  290. data/spec/unit/resource/timestamped_deploy_spec.rb +1 -2
  291. data/spec/unit/resource/windows_service_spec.rb +1 -1
  292. data/spec/unit/resource_spec.rb +99 -13
  293. data/spec/unit/rest_spec.rb +5 -5
  294. data/spec/unit/run_context_spec.rb +41 -0
  295. data/spec/unit/runner_spec.rb +2 -2
  296. data/spec/unit/user_spec.rb +406 -93
  297. data/tasks/maintainers.rb +69 -0
  298. metadata +37 -4
@@ -144,11 +144,6 @@ EOF
144
144
  expect(IO.read(tempfile.path)).to eq(expected_string)
145
145
  end
146
146
 
147
- it "should not mark the resource as updated" do
148
- provider.run_action(:add)
149
- pending "superclass ifconfig provider is not idempotent"
150
- expect(new_resource.updated_by_last_action?).to be_falsey
151
- end
152
147
  end
153
148
 
154
149
  context "when the /etc/network/interfaces file does not have the source line" do
@@ -280,11 +275,6 @@ another line
280
275
  expect(IO.read(tempfile.path)).to eq(expected_string)
281
276
  end
282
277
 
283
- it "should not mark the resource as updated" do
284
- provider.run_action(:add)
285
- pending "superclass ifconfig provider is not idempotent"
286
- expect(new_resource.updated_by_last_action?).to be_falsey
287
- end
288
278
  end
289
279
 
290
280
  context "when the /etc/network/interfaces file does not have the source line" do
@@ -41,16 +41,16 @@ describe Chef::Provider::Package::Aix do
41
41
 
42
42
  it "should create a current resource with the name of new_resource" do
43
43
  status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
44
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
45
- expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status)
44
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
45
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
46
46
  @provider.load_current_resource
47
47
  expect(@provider.current_resource.name).to eq("samba.base")
48
48
  end
49
49
 
50
50
  it "should set the current resource bff package name to the new resource bff package name" do
51
51
  status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
52
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
53
- expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status)
52
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
53
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
54
54
  @provider.load_current_resource
55
55
  expect(@provider.current_resource.package_name).to eq("samba.base")
56
56
  end
@@ -65,8 +65,8 @@ describe Chef::Provider::Package::Aix do
65
65
 
66
66
  it "should get the source package version from lslpp if provided" do
67
67
  status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
68
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
69
- expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status)
68
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
69
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
70
70
  @provider.load_current_resource
71
71
 
72
72
  expect(@provider.current_resource.package_name).to eq("samba.base")
@@ -77,8 +77,8 @@ describe Chef::Provider::Package::Aix do
77
77
  status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
78
78
  @stdout = StringIO.new(@bffinfo)
79
79
  @stdin, @stderr = StringIO.new, StringIO.new
80
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
81
- expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(status)
80
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
81
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(status)
82
82
  @provider.load_current_resource
83
83
  expect(@provider.current_resource.version).to eq("3.3.12.0")
84
84
  end
@@ -99,8 +99,8 @@ describe Chef::Provider::Package::Aix do
99
99
 
100
100
  it "should return a current resource with a nil version if the package is not found" do
101
101
  status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
102
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
103
- expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status)
102
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
103
+ expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status)
104
104
  @provider.load_current_resource
105
105
  expect(@provider.current_resource.version).to be_nil
106
106
  end
@@ -109,7 +109,7 @@ describe Chef::Provider::Package::Aix do
109
109
  wrongbffinfo = "/usr/lib/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:
110
110
  /etc/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:"
111
111
  status = double("Status", :stdout => wrongbffinfo, :exitstatus => 0)
112
- expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status)
112
+ expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status)
113
113
  expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
114
114
  end
115
115
  end
@@ -137,7 +137,7 @@ describe Chef::Provider::Package::Aix do
137
137
 
138
138
  describe "install and upgrade" do
139
139
  it "should run installp -aYF -d with the package source to install" do
140
- expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base")
140
+ expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base", timeout: 900)
141
141
  @provider.install_package("samba.base", "3.3.12.0")
142
142
  end
143
143
 
@@ -145,26 +145,26 @@ describe Chef::Provider::Package::Aix do
145
145
  @new_resource = Chef::Resource::Package.new("/tmp/samba.base")
146
146
  @provider = Chef::Provider::Package::Aix.new(@new_resource, @run_context)
147
147
  expect(@new_resource.source).to eq("/tmp/samba.base")
148
- expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base")
148
+ expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base", timeout: 900)
149
149
  @provider.install_package("/tmp/samba.base", "3.3.12.0")
150
150
  end
151
151
 
152
152
  it "should run installp with -eLogfile option." do
153
153
  allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log")
154
- expect(@provider).to receive(:shell_out!).with("installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base")
154
+ expect(@provider).to receive(:shell_out!).with("installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base", timeout: 900)
155
155
  @provider.install_package("samba.base", "3.3.12.0")
156
156
  end
157
157
  end
158
158
 
159
159
  describe "remove" do
160
160
  it "should run installp -u samba.base to remove the package" do
161
- expect(@provider).to receive(:shell_out!).with("installp -u samba.base")
161
+ expect(@provider).to receive(:shell_out!).with("installp -u samba.base", timeout: 900)
162
162
  @provider.remove_package("samba.base", "3.3.12.0")
163
163
  end
164
164
 
165
165
  it "should run installp -u -e/tmp/installp.log with options -e/tmp/installp.log" do
166
166
  allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log")
167
- expect(@provider).to receive(:shell_out!).with("installp -u -e/tmp/installp.log samba.base")
167
+ expect(@provider).to receive(:shell_out!).with("installp -u -e/tmp/installp.log samba.base", timeout: 900)
168
168
  @provider.remove_package("samba.base", "3.3.12.0")
169
169
  end
170
170
 
@@ -51,7 +51,7 @@ describe Chef::Provider::Package::Dpkg do
51
51
  describe 'gets the source package version from dpkg-deb' do
52
52
  def check_version(version)
53
53
  @status = double(:stdout => "wget\t#{version}", :exitstatus => 0)
54
- allow(@provider).to receive(:shell_out).with("dpkg-deb -W #{@new_resource.source}").and_return(@status)
54
+ allow(@provider).to receive(:shell_out).with("dpkg-deb -W #{@new_resource.source}", timeout: 900).and_return(@status)
55
55
  @provider.load_current_resource
56
56
  expect(@provider.current_resource.package_name).to eq("wget")
57
57
  expect(@new_resource.version).to eq(version)
@@ -106,7 +106,7 @@ Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5)
106
106
  Conflicts: wget-ssl
107
107
  DPKG_S
108
108
  status = double(:stdout => stdout, :exitstatus => 1)
109
- allow(@provider).to receive(:shell_out).with("dpkg -s wget").and_return(status)
109
+ allow(@provider).to receive(:shell_out).with("dpkg -s wget", timeout: 900).and_return(status)
110
110
 
111
111
  @provider.load_current_resource
112
112
  expect(@provider.current_resource.version).to eq("1.11.4-1ubuntu1")
@@ -77,7 +77,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
77
77
 
78
78
  it "should return the version number when it is installed" do
79
79
  pkg_info = OpenStruct.new(:stdout => "zsh-4.3.6_7")
80
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', :env => nil, :returns => [0,1]).and_return(pkg_info)
80
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
81
81
  #@provider.should_receive(:popen4).with('pkg_info -E "zsh*"').and_yield(@pid, @stdin, ["zsh-4.3.6_7"], @stderr).and_return(@status)
82
82
  allow(@provider).to receive(:package_name).and_return("zsh")
83
83
  expect(@provider.current_installed_version).to eq("4.3.6_7")
@@ -85,14 +85,14 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
85
85
 
86
86
  it "does not set the current version number when the package is not installed" do
87
87
  pkg_info = OpenStruct.new(:stdout => "")
88
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', :env => nil, :returns => [0,1]).and_return(pkg_info)
88
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
89
89
  allow(@provider).to receive(:package_name).and_return("zsh")
90
90
  expect(@provider.current_installed_version).to be_nil
91
91
  end
92
92
 
93
93
  it "should return the port path for a valid port name" do
94
94
  whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh")
95
- expect(@provider).to receive(:shell_out!).with("whereis -s zsh", :env => nil).and_return(whereis)
95
+ expect(@provider).to receive(:shell_out!).with("whereis -s zsh", env: nil, timeout: 900).and_return(whereis)
96
96
  #@provider.should_receive(:popen4).with("whereis -s zsh").and_yield(@pid, @stdin, ["zsh: /usr/ports/shells/zsh"], @stderr).and_return(@status)
97
97
  allow(@provider).to receive(:port_name).and_return("zsh")
98
98
  expect(@provider.port_path).to eq("/usr/ports/shells/zsh")
@@ -102,7 +102,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
102
102
  it "should return the ports candidate version when given a valid port path" do
103
103
  allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
104
104
  make_v = OpenStruct.new(:stdout => "4.3.6\n", :exitstatus => 0)
105
- expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", {:cwd=>"/usr/ports/shells/zsh", :returns=>[0, 1], :env=>nil}).and_return(make_v)
105
+ expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", {cwd: "/usr/ports/shells/zsh", returns: [0, 1], env: nil, timeout: 900}).and_return(make_v)
106
106
  expect(@provider.ports_candidate_version).to eq("4.3.6")
107
107
  end
108
108
 
@@ -110,7 +110,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
110
110
  allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(true)
111
111
  allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
112
112
  make_v = OpenStruct.new(:stdout => "zsh-4.3.6_7\n", :exitstatus => 0)
113
- expect(@provider).to receive(:shell_out!).with("make -V PKGNAME", {:cwd=>"/usr/ports/shells/zsh", :env=>nil, :returns=>[0, 1]}).and_return(make_v)
113
+ expect(@provider).to receive(:shell_out!).with("make -V PKGNAME", {cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900}).and_return(make_v)
114
114
  #@provider.should_receive(:ports_makefile_variable_value).with("PKGNAME").and_return("zsh-4.3.6_7")
115
115
  expect(@provider.package_name).to eq("zsh")
116
116
  end
@@ -127,7 +127,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
127
127
  end
128
128
 
129
129
  it "should run pkg_add -r with the package name" do
130
- expect(@provider).to receive(:shell_out!).with("pkg_add -r zsh", :env => nil).and_return(@cmd_result)
130
+ expect(@provider).to receive(:shell_out!).with("pkg_add -r zsh", env: nil, timeout: 900).and_return(@cmd_result)
131
131
  @provider.install_package("zsh", "4.3.6_7")
132
132
  end
133
133
  end
@@ -142,7 +142,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
142
142
 
143
143
  it "should figure out the port path from the package_name using whereis" do
144
144
  whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh")
145
- expect(@provider).to receive(:shell_out!).with("whereis -s zsh", :env=>nil).and_return(whereis)
145
+ expect(@provider).to receive(:shell_out!).with("whereis -s zsh", env: nil, timeout: 900).and_return(whereis)
146
146
  expect(@provider.port_path).to eq("/usr/ports/shells/zsh")
147
147
  end
148
148
 
@@ -178,7 +178,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
178
178
  end
179
179
 
180
180
  it "should run pkg_add -r with the package name" do
181
- expect(@provider).to receive(:shell_out!).with("pkg_add -r ruby18-iconv", :env => nil).and_return(@install_result)
181
+ expect(@provider).to receive(:shell_out!).with("pkg_add -r ruby18-iconv", env: nil, timeout: 900).and_return(@install_result)
182
182
  @provider.install_package("ruby-iconv", "1.0")
183
183
  end
184
184
  end
@@ -193,7 +193,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
193
193
  end
194
194
 
195
195
  it "should run pkg_delete with the package name and version" do
196
- expect(@provider).to receive(:shell_out!).with("pkg_delete zsh-4.3.6_7", :env => nil).and_return(@pkg_delete)
196
+ expect(@provider).to receive(:shell_out!).with("pkg_delete zsh-4.3.6_7", env: nil, timeout: 900).and_return(@pkg_delete)
197
197
  @provider.remove_package("zsh", "4.3.6_7")
198
198
  end
199
199
  end
@@ -213,14 +213,14 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
213
213
 
214
214
  it "should return the port path for a valid port name" do
215
215
  whereis = OpenStruct.new(:stdout => "bonnie++: /usr/ports/benchmarks/bonnie++")
216
- expect(@provider).to receive(:shell_out!).with("whereis -s bonnie++", :env => nil).and_return(whereis)
216
+ expect(@provider).to receive(:shell_out!).with("whereis -s bonnie++", env: nil, timeout: 900).and_return(whereis)
217
217
  allow(@provider).to receive(:port_name).and_return("bonnie++")
218
218
  expect(@provider.port_path).to eq("/usr/ports/benchmarks/bonnie++")
219
219
  end
220
220
 
221
221
  it "should return the version number when it is installed" do
222
222
  pkg_info = OpenStruct.new(:stdout => "bonnie++-1.96")
223
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "bonnie++*"', :env => nil, :returns => [0,1]).and_return(pkg_info)
223
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "bonnie++*"', env: nil, returns: [0,1], timeout: 900).and_return(pkg_info)
224
224
  allow(@provider).to receive(:package_name).and_return("bonnie++")
225
225
  expect(@provider.current_installed_version).to eq("1.96")
226
226
  end
@@ -253,7 +253,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
253
253
  allow(@provider).to receive(:latest_link_name).and_return("perl")
254
254
 
255
255
  cmd = OpenStruct.new(:status => true)
256
- expect(@provider).to receive(:shell_out!).with("pkg_add -r perl", :env => nil).and_return(cmd)
256
+ expect(@provider).to receive(:shell_out!).with("pkg_add -r perl", env: nil, timeout: 900).and_return(cmd)
257
257
  @provider.install_package("perl5.8", "5.8.8_1")
258
258
  end
259
259
 
@@ -267,7 +267,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
267
267
  allow(@provider).to receive(:latest_link_name).and_return("mysql50-server")
268
268
 
269
269
  cmd = OpenStruct.new(:status => true)
270
- expect(@provider).to receive(:shell_out!).with("pkg_add -r mysql50-server", :env=>nil).and_return(cmd)
270
+ expect(@provider).to receive(:shell_out!).with("pkg_add -r mysql50-server", env: nil, timeout: 900).and_return(cmd)
271
271
  @provider.install_package("mysql50-server", "5.0.45_1")
272
272
  end
273
273
  end
@@ -71,7 +71,7 @@ describe Chef::Provider::Package::Freebsd::Port do
71
71
  end
72
72
 
73
73
  it "should query pkg database" do
74
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', :env => nil, :returns => [0,70]).and_return(@pkg_info)
74
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
75
75
  expect(@provider.current_installed_version).to eq("3.1.7")
76
76
  end
77
77
  end
@@ -80,14 +80,14 @@ describe Chef::Provider::Package::Freebsd::Port do
80
80
  describe "determining candidate version" do
81
81
  it "should query repository" do
82
82
  pkg_query = OpenStruct.new(:stdout => "5.0.5\n", :exitstatus => 0)
83
- expect(@provider).to receive(:shell_out!).with("pkg rquery '%v' zsh", :env => nil).and_return(pkg_query)
83
+ expect(@provider).to receive(:shell_out!).with("pkg rquery '%v' zsh", env: nil, timeout: 900).and_return(pkg_query)
84
84
  expect(@provider.candidate_version).to eq("5.0.5")
85
85
  end
86
86
 
87
87
  it "should query specified repository when given option" do
88
88
  @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
89
89
  pkg_query = OpenStruct.new(:stdout => "5.0.3\n", :exitstatus => 0)
90
- expect(@provider).to receive(:shell_out!).with("pkg rquery -r LocalMirror '%v' zsh", :env => nil).and_return(pkg_query)
90
+ expect(@provider).to receive(:shell_out!).with("pkg rquery -r LocalMirror '%v' zsh", env: nil, timeout: 900).and_return(pkg_query)
91
91
  expect(@provider.candidate_version).to eq("5.0.3")
92
92
  end
93
93
 
@@ -106,7 +106,7 @@ describe Chef::Provider::Package::Freebsd::Port do
106
106
  it "should handle package source from file" do
107
107
  @provider.new_resource.source("/nas/pkg/repo/zsh-5.0.1.txz")
108
108
  expect(@provider).to receive(:shell_out!).
109
- with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", :env => { 'LC_ALL' => nil }).
109
+ with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900).
110
110
  and_return(@install_result)
111
111
  @provider.install_package("zsh", "5.0.1")
112
112
  end
@@ -114,21 +114,21 @@ describe Chef::Provider::Package::Freebsd::Port do
114
114
  it "should handle package source over ftp or http" do
115
115
  @provider.new_resource.source("http://repo.example.com/zsh-5.0.1.txz")
116
116
  expect(@provider).to receive(:shell_out!).
117
- with("pkg add http://repo.example.com/zsh-5.0.1.txz", :env => { 'LC_ALL' => nil }).
117
+ with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900).
118
118
  and_return(@install_result)
119
119
  @provider.install_package("zsh", "5.0.1")
120
120
  end
121
121
 
122
122
  it "should handle a package name" do
123
123
  expect(@provider).to receive(:shell_out!).
124
- with("pkg install -y zsh", :env => { 'LC_ALL' => nil }).and_return(@install_result)
124
+ with("pkg install -y zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result)
125
125
  @provider.install_package("zsh", "5.0.1")
126
126
  end
127
127
 
128
128
  it "should handle a package name with a specified repo" do
129
129
  @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
130
130
  expect(@provider).to receive(:shell_out!).
131
- with("pkg install -y -r LocalMirror zsh", :env => { 'LC_ALL' => nil }).and_return(@install_result)
131
+ with("pkg install -y -r LocalMirror zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result)
132
132
  @provider.install_package("zsh", "5.0.1")
133
133
  end
134
134
  end
@@ -141,14 +141,14 @@ describe Chef::Provider::Package::Freebsd::Port do
141
141
 
142
142
  it "should call pkg delete" do
143
143
  expect(@provider).to receive(:shell_out!).
144
- with("pkg delete -y zsh-5.0.1", :env => nil).and_return(@install_result)
144
+ with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result)
145
145
  @provider.remove_package("zsh", "5.0.1")
146
146
  end
147
147
 
148
148
  it "should not include repo option in pkg delete" do
149
149
  @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
150
150
  expect(@provider).to receive(:shell_out!).
151
- with("pkg delete -y zsh-5.0.1", :env => nil).and_return(@install_result)
151
+ with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result)
152
152
  @provider.remove_package("zsh", "5.0.1")
153
153
  end
154
154
  end
@@ -72,7 +72,7 @@ describe Chef::Provider::Package::Freebsd::Port do
72
72
  it "should check 'pkg_info' if system uses pkg_* tools" do
73
73
  allow(@new_resource).to receive(:supports_pkgng?)
74
74
  expect(@new_resource).to receive(:supports_pkgng?).and_return(false)
75
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', :env => nil, :returns => [0,1]).and_return(@pkg_info)
75
+ expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0,1], timeout: 900).and_return(@pkg_info)
76
76
  expect(@provider.current_installed_version).to eq("3.1.7")
77
77
  end
78
78
 
@@ -80,8 +80,8 @@ describe Chef::Provider::Package::Freebsd::Port do
80
80
  pkg_enabled = OpenStruct.new(:stdout => "yes\n")
81
81
  [1000016, 1000000, 901503, 902506, 802511].each do |__freebsd_version|
82
82
  @node.automatic_attrs[:os_version] = __freebsd_version
83
- expect(@new_resource).to receive(:shell_out!).with('make -V WITH_PKGNG', :env => nil).and_return(pkg_enabled)
84
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', :env => nil, :returns => [0,70]).and_return(@pkg_info)
83
+ expect(@new_resource).to receive(:shell_out!).with('make -V WITH_PKGNG', env: nil).and_return(pkg_enabled)
84
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
85
85
  expect(@provider.current_installed_version).to eq("3.1.7")
86
86
  end
87
87
  end
@@ -89,7 +89,7 @@ describe Chef::Provider::Package::Freebsd::Port do
89
89
  it "should check 'pkg info' if the freebsd version is greater than or equal to 1000017" do
90
90
  __freebsd_version = 1000017
91
91
  @node.automatic_attrs[:os_version] = __freebsd_version
92
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', :env => nil, :returns => [0,70]).and_return(@pkg_info)
92
+ expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
93
93
  expect(@provider.current_installed_version).to eq("3.1.7")
94
94
  end
95
95
  end
@@ -102,7 +102,7 @@ describe Chef::Provider::Package::Freebsd::Port do
102
102
  it "should return candidate version if port exists" do
103
103
  allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(true)
104
104
  allow(@provider).to receive(:port_dir).and_return('/usr/ports/shells/zsh')
105
- expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", :cwd => "/usr/ports/shells/zsh", :env => nil, :returns => [0,1]).
105
+ expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", cwd: "/usr/ports/shells/zsh", env: nil, returns: [0,1], timeout: 900).
106
106
  and_return(@port_version)
107
107
  expect(@provider.candidate_version).to eq("5.0.5")
108
108
  end
@@ -127,13 +127,13 @@ describe Chef::Provider::Package::Freebsd::Port do
127
127
 
128
128
  it "should query system for path given just a name" do
129
129
  whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh\n")
130
- expect(@provider).to receive(:shell_out!).with("whereis -s zsh", :env => nil).and_return(whereis)
130
+ expect(@provider).to receive(:shell_out!).with("whereis -s zsh", env: nil, timeout: 900).and_return(whereis)
131
131
  expect(@provider.port_dir).to eq("/usr/ports/shells/zsh")
132
132
  end
133
133
 
134
134
  it "should raise exception if not found" do
135
135
  whereis = OpenStruct.new(:stdout => "zsh:\n")
136
- expect(@provider).to receive(:shell_out!).with("whereis -s zsh", :env => nil).and_return(whereis)
136
+ expect(@provider).to receive(:shell_out!).with("whereis -s zsh", env: nil, timeout: 900).and_return(whereis)
137
137
  expect { @provider.port_dir }.to raise_error(Chef::Exceptions::Package, "Could not find port with the name zsh")
138
138
  end
139
139
  end
@@ -65,28 +65,28 @@ PKG_STATUS
65
65
 
66
66
  context "when loading current resource" do
67
67
  it "should create a current resource with the name of the new_resource" do
68
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
69
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
68
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
69
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
70
70
  expect(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
71
71
  @provider.load_current_resource
72
72
  end
73
73
 
74
74
  it "should set the current resources package name to the new resources package name" do
75
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
76
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
75
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
76
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
77
77
  @provider.load_current_resource
78
78
  expect(@current_resource.package_name).to eq(@new_resource.package_name)
79
79
  end
80
80
 
81
81
  it "should run pkg info with the package name" do
82
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
83
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
82
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
83
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
84
84
  @provider.load_current_resource
85
85
  end
86
86
 
87
87
  it "should set the installed version to nil on the current resource if package state is not installed" do
88
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
89
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
88
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
89
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
90
90
  @provider.load_current_resource
91
91
  expect(@current_resource.version).to be_nil
92
92
  end
@@ -108,27 +108,27 @@ Packaging Date: October 19, 2011 09:14:50 AM
108
108
  Size: 8.07 MB
109
109
  FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z
110
110
  INSTALLED
111
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local)
112
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
111
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local)
112
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
113
113
  @provider.load_current_resource
114
114
  expect(@current_resource.version).to eq("2.0.17")
115
115
  end
116
116
 
117
117
  it "should return the current resource" do
118
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
119
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote_output)
118
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
119
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote_output)
120
120
  expect(@provider.load_current_resource).to eql(@current_resource)
121
121
  end
122
122
  end
123
123
 
124
124
  context "when installing a package" do
125
125
  it "should run pkg install with the package name and version" do
126
- expect(@provider).to receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17")
126
+ expect(@provider).to receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17", timeout: 900)
127
127
  @provider.install_package("crypto/gnupg", "2.0.17")
128
128
  end
129
129
 
130
130
  it "should run pkg install with the package name and version and options if specified" do
131
- expect(@provider).to receive(:shell_out).with("pkg --no-refresh install -q crypto/gnupg@2.0.17")
131
+ expect(@provider).to receive(:shell_out).with("pkg --no-refresh install -q crypto/gnupg@2.0.17", timeout: 900)
132
132
  allow(@new_resource).to receive(:options).and_return("--no-refresh")
133
133
  @provider.install_package("crypto/gnupg", "2.0.17")
134
134
  end
@@ -147,8 +147,8 @@ Packaging Date: April 1, 2012 05:55:52 PM
147
147
  Size: 2.57 MB
148
148
  FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
149
149
  PKG_STATUS
150
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local_output)
151
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote)
150
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local_output)
151
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote)
152
152
  @provider.load_current_resource
153
153
  expect(@current_resource.version).to be_nil
154
154
  expect(@provider.candidate_version).to eql("1.8.4.1")
@@ -188,8 +188,8 @@ Packaging Date: October 19, 2011 09:14:50 AM
188
188
  FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z
189
189
  REMOTE
190
190
 
191
- expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}").and_return(local)
192
- expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}").and_return(remote)
191
+ expect(@provider).to receive(:shell_out).with("pkg info #{@new_resource.package_name}", timeout: 900).and_return(local)
192
+ expect(@provider).to receive(:shell_out!).with("pkg info -r #{@new_resource.package_name}", timeout: 900).and_return(remote)
193
193
  expect(@provider).to receive(:install_package).exactly(0).times
194
194
  @provider.run_action(:install)
195
195
  end
@@ -200,7 +200,7 @@ REMOTE
200
200
  end
201
201
 
202
202
  it "should run pkg install with the --accept flag" do
203
- expect(@provider).to receive(:shell_out).with("pkg install -q --accept crypto/gnupg@2.0.17")
203
+ expect(@provider).to receive(:shell_out).with("pkg install -q --accept crypto/gnupg@2.0.17", timeout: 900)
204
204
  @provider.install_package("crypto/gnupg", "2.0.17")
205
205
  end
206
206
  end
@@ -208,19 +208,19 @@ REMOTE
208
208
 
209
209
  context "when upgrading a package" do
210
210
  it "should run pkg install with the package name and version" do
211
- expect(@provider).to receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17")
211
+ expect(@provider).to receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17", timeout: 900)
212
212
  @provider.upgrade_package("crypto/gnupg", "2.0.17")
213
213
  end
214
214
  end
215
215
 
216
216
  context "when uninstalling a package" do
217
217
  it "should run pkg uninstall with the package name and version" do
218
- expect(@provider).to receive(:shell_out!).with("pkg uninstall -q crypto/gnupg@2.0.17")
218
+ expect(@provider).to receive(:shell_out!).with("pkg uninstall -q crypto/gnupg@2.0.17", timeout: 900)
219
219
  @provider.remove_package("crypto/gnupg", "2.0.17")
220
220
  end
221
221
 
222
222
  it "should run pkg uninstall with the package name and version and options if specified" do
223
- expect(@provider).to receive(:shell_out!).with("pkg --no-refresh uninstall -q crypto/gnupg@2.0.17")
223
+ expect(@provider).to receive(:shell_out!).with("pkg --no-refresh uninstall -q crypto/gnupg@2.0.17", timeout: 900)
224
224
  allow(@new_resource).to receive(:options).and_return("--no-refresh")
225
225
  @provider.remove_package("crypto/gnupg", "2.0.17")
226
226
  end