chef 12.18.31-universal-mingw32 → 12.19.33-universal-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -4
  3. data/README.md +12 -13
  4. data/VERSION +1 -1
  5. data/acceptance/Gemfile +4 -4
  6. data/acceptance/Gemfile.lock +70 -69
  7. data/chef-universal-mingw32.gemspec +2 -3
  8. data/chef.gemspec +6 -6
  9. data/lib/chef/api_client.rb +8 -10
  10. data/lib/chef/api_client_v1.rb +9 -11
  11. data/lib/chef/application/apply.rb +8 -10
  12. data/lib/chef/application/client.rb +1 -1
  13. data/lib/chef/application/exit_code.rb +3 -5
  14. data/lib/chef/application/knife.rb +2 -2
  15. data/lib/chef/application/windows_service.rb +29 -30
  16. data/lib/chef/application/windows_service_manager.rb +1 -1
  17. data/lib/chef/audit/audit_event_proxy.rb +2 -2
  18. data/lib/chef/audit/control_group_data.rb +1 -1
  19. data/lib/chef/chef_class.rb +1 -0
  20. data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
  21. data/lib/chef/chef_fs/command_line.rb +15 -16
  22. data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
  23. data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
  24. data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
  25. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  26. data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
  27. data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
  28. data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
  29. data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
  30. data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
  31. data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
  32. data/lib/chef/chef_fs/file_pattern.rb +2 -2
  33. data/lib/chef/chef_fs/file_system.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
  35. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
  36. data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
  37. data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
  38. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
  39. data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
  40. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
  41. data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
  42. data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
  43. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
  44. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
  45. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
  46. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
  47. data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
  48. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
  49. data/lib/chef/chef_fs/parallelizer.rb +9 -11
  50. data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
  51. data/lib/chef/cookbook/metadata.rb +26 -26
  52. data/lib/chef/cookbook/syntax_check.rb +1 -1
  53. data/lib/chef/cookbook_version.rb +3 -3
  54. data/lib/chef/data_bag.rb +1 -1
  55. data/lib/chef/data_bag_item.rb +3 -3
  56. data/lib/chef/data_collector.rb +3 -4
  57. data/lib/chef/decorator.rb +1 -1
  58. data/lib/chef/deprecated.rb +30 -0
  59. data/lib/chef/dsl/audit.rb +2 -2
  60. data/lib/chef/dsl/declare_resource.rb +1 -1
  61. data/lib/chef/dsl/platform_introspection.rb +29 -31
  62. data/lib/chef/dsl/reboot_pending.rb +1 -1
  63. data/lib/chef/dsl/resources.rb +6 -8
  64. data/lib/chef/encrypted_data_bag_item.rb +2 -2
  65. data/lib/chef/environment.rb +9 -11
  66. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  67. data/lib/chef/exceptions.rb +4 -1
  68. data/lib/chef/file_access_control/unix.rb +14 -14
  69. data/lib/chef/file_access_control/windows.rb +1 -1
  70. data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
  71. data/lib/chef/formatters/error_mapper.rb +6 -6
  72. data/lib/chef/http/api_versions.rb +50 -0
  73. data/lib/chef/http/validate_content_length.rb +2 -2
  74. data/lib/chef/json_compat.rb +6 -10
  75. data/lib/chef/key.rb +5 -5
  76. data/lib/chef/knife.rb +4 -4
  77. data/lib/chef/knife/cookbook_site_install.rb +2 -2
  78. data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
  79. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  80. data/lib/chef/knife/core/status_presenter.rb +1 -1
  81. data/lib/chef/knife/core/ui.rb +19 -25
  82. data/lib/chef/knife/data_bag_secret_options.rb +1 -1
  83. data/lib/chef/knife/deps.rb +32 -34
  84. data/lib/chef/knife/help.rb +1 -1
  85. data/lib/chef/knife/list.rb +1 -1
  86. data/lib/chef/knife/search.rb +2 -2
  87. data/lib/chef/knife/ssh.rb +37 -27
  88. data/lib/chef/knife/ssl_check.rb +1 -1
  89. data/lib/chef/knife/user_delete.rb +1 -1
  90. data/lib/chef/mash.rb +1 -1
  91. data/lib/chef/mixin/command.rb +2 -2
  92. data/lib/chef/mixin/create_path.rb +3 -5
  93. data/lib/chef/mixin/from_file.rb +2 -2
  94. data/lib/chef/mixin/get_source_from_package.rb +2 -2
  95. data/lib/chef/mixin/notifying_block.rb +7 -9
  96. data/lib/chef/mixin/params_validate.rb +3 -3
  97. data/lib/chef/mixin/securable.rb +1 -1
  98. data/lib/chef/mixin/shell_out.rb +23 -3
  99. data/lib/chef/mixin/unformatter.rb +2 -2
  100. data/lib/chef/mixin/uris.rb +4 -6
  101. data/lib/chef/mixin/versioned_api.rb +69 -0
  102. data/lib/chef/mixin/which.rb +25 -8
  103. data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
  104. data/lib/chef/mixin/xml_escape.rb +3 -5
  105. data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
  106. data/lib/chef/node.rb +8 -8
  107. data/lib/chef/node/attribute.rb +4 -4
  108. data/lib/chef/node/common_api.rb +5 -7
  109. data/lib/chef/org.rb +10 -12
  110. data/lib/chef/platform/provider_mapping.rb +7 -7
  111. data/lib/chef/platform/query_helpers.rb +1 -1
  112. data/lib/chef/policy_builder/policyfile.rb +1 -0
  113. data/lib/chef/property.rb +31 -0
  114. data/lib/chef/provider/batch.rb +1 -1
  115. data/lib/chef/provider/breakpoint.rb +1 -1
  116. data/lib/chef/provider/cookbook_file.rb +3 -3
  117. data/lib/chef/provider/cron.rb +38 -38
  118. data/lib/chef/provider/deploy.rb +81 -81
  119. data/lib/chef/provider/deploy/revision.rb +3 -5
  120. data/lib/chef/provider/directory.rb +32 -32
  121. data/lib/chef/provider/dsc_resource.rb +22 -6
  122. data/lib/chef/provider/env.rb +28 -28
  123. data/lib/chef/provider/env/windows.rb +1 -1
  124. data/lib/chef/provider/erl_call.rb +13 -13
  125. data/lib/chef/provider/execute.rb +5 -2
  126. data/lib/chef/provider/file.rb +49 -51
  127. data/lib/chef/provider/git.rb +55 -55
  128. data/lib/chef/provider/http_request.rb +36 -36
  129. data/lib/chef/provider/launchd.rb +2 -2
  130. data/lib/chef/provider/link.rb +50 -50
  131. data/lib/chef/provider/log.rb +2 -2
  132. data/lib/chef/provider/mdadm.rb +25 -25
  133. data/lib/chef/provider/mount/aix.rb +2 -2
  134. data/lib/chef/provider/mount/mount.rb +2 -2
  135. data/lib/chef/provider/ohai.rb +1 -1
  136. data/lib/chef/provider/osx_profile.rb +23 -23
  137. data/lib/chef/provider/package.rb +74 -56
  138. data/lib/chef/provider/package/aix.rb +55 -52
  139. data/lib/chef/provider/package/apt.rb +15 -13
  140. data/lib/chef/provider/package/cab.rb +49 -20
  141. data/lib/chef/provider/package/chocolatey.rb +9 -10
  142. data/lib/chef/provider/package/dnf.rb +20 -18
  143. data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
  144. data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
  145. data/lib/chef/provider/package/dnf/version.rb +1 -1
  146. data/lib/chef/provider/package/dpkg.rb +8 -9
  147. data/lib/chef/provider/package/easy_install.rb +22 -22
  148. data/lib/chef/provider/package/freebsd/base.rb +10 -10
  149. data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
  150. data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
  151. data/lib/chef/provider/package/freebsd/port.rb +7 -7
  152. data/lib/chef/provider/package/homebrew.rb +11 -10
  153. data/lib/chef/provider/package/ips.rb +18 -23
  154. data/lib/chef/provider/package/macports.rb +23 -23
  155. data/lib/chef/provider/package/msu.rb +11 -11
  156. data/lib/chef/provider/package/openbsd.rb +25 -22
  157. data/lib/chef/provider/package/pacman.rb +16 -16
  158. data/lib/chef/provider/package/paludis.rb +26 -27
  159. data/lib/chef/provider/package/portage.rb +22 -22
  160. data/lib/chef/provider/package/powershell.rb +17 -17
  161. data/lib/chef/provider/package/rpm.rb +25 -25
  162. data/lib/chef/provider/package/rubygems.rb +60 -60
  163. data/lib/chef/provider/package/smartos.rb +16 -16
  164. data/lib/chef/provider/package/solaris.rb +44 -44
  165. data/lib/chef/provider/package/windows.rb +3 -3
  166. data/lib/chef/provider/package/windows/exe.rb +6 -6
  167. data/lib/chef/provider/package/windows/msi.rb +6 -6
  168. data/lib/chef/provider/package/yum.rb +318 -268
  169. data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
  170. data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
  171. data/lib/chef/provider/package/zypper.rb +11 -11
  172. data/lib/chef/provider/powershell_script.rb +15 -7
  173. data/lib/chef/provider/reboot.rb +10 -10
  174. data/lib/chef/provider/registry_key.rb +39 -39
  175. data/lib/chef/provider/remote_directory.rb +3 -3
  176. data/lib/chef/provider/remote_file.rb +3 -3
  177. data/lib/chef/provider/route.rb +1 -1
  178. data/lib/chef/provider/ruby_block.rb +3 -3
  179. data/lib/chef/provider/script.rb +42 -6
  180. data/lib/chef/provider/service.rb +49 -49
  181. data/lib/chef/provider/service/solaris.rb +1 -1
  182. data/lib/chef/provider/service/systemd.rb +1 -1
  183. data/lib/chef/provider/subversion.rb +39 -39
  184. data/lib/chef/provider/systemd_unit.rb +2 -0
  185. data/lib/chef/provider/template.rb +3 -3
  186. data/lib/chef/provider/user.rb +42 -42
  187. data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
  188. data/lib/chef/resource.rb +27 -16
  189. data/lib/chef/resource/apt_repository.rb +0 -1
  190. data/lib/chef/resource/chef_gem.rb +1 -1
  191. data/lib/chef/resource/dnf_package.rb +6 -3
  192. data/lib/chef/resource/dsc_resource.rb +9 -1
  193. data/lib/chef/resource/execute.rb +70 -6
  194. data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
  195. data/lib/chef/resource/freebsd_package.rb +1 -1
  196. data/lib/chef/resource/gem_package.rb +1 -1
  197. data/lib/chef/resource/launchd.rb +13 -1
  198. data/lib/chef/resource/package.rb +2 -2
  199. data/lib/chef/resource/registry_key.rb +1 -1
  200. data/lib/chef/resource/yum_package.rb +12 -3
  201. data/lib/chef/resource/yum_repository.rb +0 -1
  202. data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
  203. data/lib/chef/resource_collection/resource_set.rb +2 -2
  204. data/lib/chef/resource_reporter.rb +1 -1
  205. data/lib/chef/run_context.rb +3 -3
  206. data/lib/chef/run_list/run_list_item.rb +1 -1
  207. data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
  208. data/lib/chef/server_api.rb +2 -0
  209. data/lib/chef/server_api_versions.rb +40 -0
  210. data/lib/chef/shell.rb +1 -1
  211. data/lib/chef/shell/ext.rb +3 -3
  212. data/lib/chef/shell/shell_session.rb +1 -1
  213. data/lib/chef/user.rb +9 -11
  214. data/lib/chef/user_v1.rb +9 -11
  215. data/lib/chef/util/diff.rb +1 -1
  216. data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
  217. data/lib/chef/util/selinux.rb +1 -1
  218. data/lib/chef/util/windows/net_group.rb +18 -30
  219. data/lib/chef/util/windows/net_use.rb +7 -11
  220. data/lib/chef/util/windows/net_user.rb +11 -17
  221. data/lib/chef/util/windows/volume.rb +9 -15
  222. data/lib/chef/version.rb +1 -1
  223. data/lib/chef/version_class.rb +1 -1
  224. data/lib/chef/win32/api.rb +4 -6
  225. data/lib/chef/win32/api/file.rb +25 -31
  226. data/lib/chef/win32/api/installer.rb +2 -2
  227. data/lib/chef/win32/file.rb +4 -6
  228. data/lib/chef/win32/registry.rb +9 -9
  229. data/lib/chef/win32/security.rb +2 -2
  230. data/lib/chef/win32/security/acl.rb +2 -2
  231. data/lib/chef/win32/unicode.rb +2 -2
  232. data/lib/chef/win32/version.rb +1 -1
  233. data/spec/data/prefer_metadata_json/metadata.json +51 -0
  234. data/spec/data/prefer_metadata_json/metadata.rb +6 -0
  235. data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
  236. data/spec/functional/knife/ssh_spec.rb +5 -5
  237. data/spec/functional/resource/batch_spec.rb +5 -1
  238. data/spec/functional/resource/dsc_script_spec.rb +2 -4
  239. data/spec/functional/resource/execute_spec.rb +17 -0
  240. data/spec/functional/resource/user/dscl_spec.rb +2 -4
  241. data/spec/integration/client/client_spec.rb +33 -0
  242. data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
  243. data/spec/spec_helper.rb +4 -0
  244. data/spec/support/chef_helpers.rb +5 -7
  245. data/spec/support/platform_helpers.rb +6 -0
  246. data/spec/support/platforms/prof/gc.rb +4 -6
  247. data/spec/support/shared/context/client.rb +1 -1
  248. data/spec/support/shared/functional/execute_resource.rb +150 -0
  249. data/spec/support/shared/functional/windows_script.rb +74 -4
  250. data/spec/support/shared/unit/execute_resource.rb +37 -0
  251. data/spec/support/shared/unit/provider/file.rb +10 -0
  252. data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
  253. data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
  254. data/spec/unit/http/api_versions_spec.rb +69 -0
  255. data/spec/unit/knife/ssh_spec.rb +34 -36
  256. data/spec/unit/mixin/versioned_api_spec.rb +107 -0
  257. data/spec/unit/mixin/which.rb +160 -0
  258. data/spec/unit/platform_spec.rb +28 -1
  259. data/spec/unit/provider/deploy_spec.rb +1 -1
  260. data/spec/unit/provider/directory_spec.rb +10 -0
  261. data/spec/unit/provider/dsc_resource_spec.rb +175 -0
  262. data/spec/unit/provider/execute_spec.rb +0 -1
  263. data/spec/unit/provider/launchd_spec.rb +2 -2
  264. data/spec/unit/provider/package/aix_spec.rb +22 -22
  265. data/spec/unit/provider/package/apt_spec.rb +27 -27
  266. data/spec/unit/provider/package/cab_spec.rb +59 -5
  267. data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
  268. data/spec/unit/provider/package/dpkg_spec.rb +16 -16
  269. data/spec/unit/provider/package/easy_install_spec.rb +18 -18
  270. data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
  271. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
  272. data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
  273. data/spec/unit/provider/package/homebrew_spec.rb +9 -9
  274. data/spec/unit/provider/package/ips_spec.rb +37 -31
  275. data/spec/unit/provider/package/macports_spec.rb +10 -10
  276. data/spec/unit/provider/package/openbsd_spec.rb +10 -10
  277. data/spec/unit/provider/package/pacman_spec.rb +6 -6
  278. data/spec/unit/provider/package/paludis_spec.rb +7 -7
  279. data/spec/unit/provider/package/portage_spec.rb +6 -7
  280. data/spec/unit/provider/package/rpm_spec.rb +23 -23
  281. data/spec/unit/provider/package/rubygems_spec.rb +38 -38
  282. data/spec/unit/provider/package/solaris_spec.rb +15 -15
  283. data/spec/unit/provider/package/windows_spec.rb +2 -1
  284. data/spec/unit/provider/package/yum_spec.rb +51 -43
  285. data/spec/unit/provider/package/zypper_spec.rb +34 -34
  286. data/spec/unit/provider/package_spec.rb +8 -0
  287. data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
  288. data/spec/unit/provider/route_spec.rb +7 -1
  289. data/spec/unit/provider/script_spec.rb +49 -6
  290. data/spec/unit/resource/dsc_resource_spec.rb +6 -0
  291. data/spec/unit/resource/execute_spec.rb +214 -0
  292. data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
  293. data/spec/unit/resource/freebsd_package_spec.rb +2 -2
  294. data/spec/unit/resource/package_spec.rb +5 -0
  295. data/spec/unit/resource/yum_package_spec.rb +42 -1
  296. data/spec/unit/resource_reporter_spec.rb +1 -1
  297. data/spec/unit/resource_spec.rb +18 -0
  298. data/spec/unit/server_api_versions_spec.rb +44 -0
  299. data/spec/unit/util/selinux_spec.rb +3 -14
  300. data/spec/unit/win32/error_spec.rb +67 -0
  301. data/spec/unit/win32/security_spec.rb +66 -0
  302. data/tasks/changelog.rb +1 -1
  303. data/tasks/dependencies.rb +20 -4
  304. metadata +39 -18
  305. data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -49,7 +49,7 @@ The operation completed successfully
49
49
  end
50
50
 
51
51
  before do
52
- new_resource.source = "C:\\Temp\\Test6.1-KB2664825-v3-x64.cab"
52
+ new_resource.source = File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
53
53
  installed_package_list_obj = double(stdout: installed_package_list_stdout)
54
54
  allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(installed_package_list_obj)
55
55
  package_version_obj = double(stdout: package_version_stdout)
@@ -126,6 +126,63 @@ The operation completed successfully.
126
126
  end
127
127
  end
128
128
 
129
+ describe "#source_resource" do
130
+ before do
131
+ new_resource.source = "https://www.something.com/Test6.1-KB2664825-v3-x64.cab"
132
+ new_resource.cookbook_name = "cab_package"
133
+ end
134
+
135
+ it "sets the desired parameters of downloades cab file" do
136
+ allow(provider).to receive(:default_download_cache_path).and_return("C:\\chef\\cache\\package")
137
+ source_resource = provider.source_resource
138
+ expect(source_resource.path).to be == "C:\\chef\\cache\\package"
139
+ expect(source_resource.name).to be == "windows_test_pkg"
140
+ expect(source_resource.source).to be == [new_resource.source]
141
+ expect(source_resource.cookbook_name).to be == "cab_package"
142
+ end
143
+ end
144
+
145
+ describe "#default_download_cache_path" do
146
+ before do
147
+ new_resource.source = "https://www.something.com/Test6.1-KB2664825-v3-x64.cab"
148
+ end
149
+
150
+ it "returns a clean cache path where the cab file is downloaded" do
151
+ allow(Chef::FileCache).to receive(:create_cache_path).and_return(ENV["TEMP"])
152
+ path = provider.default_download_cache_path
153
+ if windows?
154
+ expect(path).to be == File.join("#{ENV['TEMP']}", "\\", "Test6.1-KB2664825-v3-x64.cab")
155
+ else
156
+ expect(path).to be == File.join("#{ENV['TEMP']}", "Test6.1-KB2664825-v3-x64.cab")
157
+ end
158
+ end
159
+ end
160
+
161
+ describe "#cab_file_source" do
162
+ context "when local file path is set" do
163
+ it "returns local cab file source path" do
164
+ new_resource.source = File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
165
+ path = provider.cab_file_source
166
+ if windows?
167
+ expect(path).to be == File.join("#{ENV['TEMP'].downcase}", "\\", "test6.1-kb2664825-v3-x64.cab")
168
+ else
169
+ expect(path).to be == File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
170
+ end
171
+ end
172
+ end
173
+ context "when url is set" do
174
+ it "calls download_source_file method" do
175
+ new_resource.source = "https://www.something.com/test6.1-kb2664825-v3-x64.cab"
176
+ if windows?
177
+ expect(provider).to receive(:download_source_file).and_return(File.join("#{ENV['TEMP'].downcase}", "\\", "test6.1-kb2664825-v3-x64.cab"))
178
+ else
179
+ expect(provider).to receive(:download_source_file).and_return(File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab"))
180
+ end
181
+ provider.cab_file_source
182
+ end
183
+ end
184
+ end
185
+
129
186
  describe "#initialize" do
130
187
  it "returns the correct class" do
131
188
  expect(provider).to be_kind_of(Chef::Provider::Package::Cab)
@@ -192,12 +249,9 @@ The operation completed successfully.
192
249
  context "Invalid package source" do
193
250
  def package_version_stdout
194
251
  package_version_stdout = <<-EOF
195
-
196
252
  Deployment Image Servicing and Management tool
197
253
  Version: 6.1.7600.16385
198
-
199
254
  Image Version: 6.1.7600.16385
200
-
201
255
  An error occurred trying to open - c:\\temp\\test6.1-KB2664825-v3-x64.cab Error: 0x80070003
202
256
  Error: 3
203
257
  The system cannot find the path specified.
@@ -206,7 +260,7 @@ The DISM log file can be found at C:\\Windows\\Logs\\DISM\\dism.log.
206
260
  end
207
261
 
208
262
  before do
209
- new_resource.source = "C:\\Temp\\Test6.1-KB2664825-v3-x64.cab"
263
+ new_resource.source = "#{ENV['TEMP']}/test6.1-kb2664825-v3-x64.cab"
210
264
  installed_package_list_obj = double(stdout: installed_package_list_stdout)
211
265
  allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(installed_package_list_obj)
212
266
  end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright:: Copyright 2017-2017, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "spec_helper"
19
+
20
+ # NOTE: most of the tests of this functionality are baked into the func tests for the dnf package provider
21
+
22
+ describe Chef::Provider::Package::Dnf::PythonHelper do
23
+ let(:helper) { Chef::Provider::Package::Dnf::PythonHelper.instance }
24
+
25
+ it "propagates stacktraces on stderr from the forked subprocess" do
26
+ allow(helper).to receive(:dnf_command).and_return("ruby -e 'raise \"your hands in the air\"'")
27
+ expect { helper.query(:whatprovides, "tcpdump") }.to raise_error(/your hands in the air/)
28
+ end
29
+ end
@@ -51,8 +51,8 @@ Conflicts: wget-ssl
51
51
  end
52
52
 
53
53
  before(:each) do
54
- allow(provider).to receive(:shell_out!).with("dpkg-deb -W #{source}", timeout: 900).and_return(dpkg_deb_status)
55
- allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0, 1]).and_return(double(stdout: "", exitstatus: 1))
54
+ allow(provider).to receive(:shell_out!).with("dpkg-deb", "-W", source, timeout: 900).and_return(dpkg_deb_status)
55
+ allow(provider).to receive(:shell_out!).with("dpkg", "-s", package, timeout: 900, returns: [0, 1]).and_return(double(stdout: "", exitstatus: 1))
56
56
  allow(::File).to receive(:exist?).with(source).and_return(true)
57
57
  end
58
58
 
@@ -113,7 +113,7 @@ Conflicts: wget-ssl
113
113
  describe "gets the source package version from dpkg-deb" do
114
114
  def check_version(version)
115
115
  status = double(:stdout => "wget\t#{version}", :exitstatus => 0)
116
- expect(provider).to receive(:shell_out!).with("dpkg-deb -W #{source}", timeout: 900).and_return(status)
116
+ expect(provider).to receive(:shell_out!).with("dpkg-deb", "-W", source, timeout: 900).and_return(status)
117
117
  provider.load_current_resource
118
118
  expect(provider.current_resource.package_name).to eq(["wget"])
119
119
  expect(provider.candidate_version).to eq([version])
@@ -165,7 +165,7 @@ Conflicts: wget-ssl
165
165
  end
166
166
 
167
167
  it "should return the current version installed if found by dpkg" do
168
- allow(provider).to receive(:shell_out!).with("dpkg -s #{package}", timeout: 900, returns: [0, 1]).and_return(dpkg_s_status)
168
+ allow(provider).to receive(:shell_out!).with("dpkg", "-s", package, timeout: 900, returns: [0, 1]).and_return(dpkg_s_status)
169
169
  provider.load_current_resource
170
170
  expect(provider.current_resource.version).to eq(["1.11.4-1ubuntu1"])
171
171
  end
@@ -178,7 +178,7 @@ Use dpkg --info (= dpkg-deb --info) to examine archive files,
178
178
  and dpkg --contents (= dpkg-deb --contents) to list their contents.
179
179
  EOF
180
180
  )
181
- expect(provider).to receive(:shell_out!).with("dpkg -s #{package}", returns: [0, 1], timeout: 900).and_return(dpkg_s_status)
181
+ expect(provider).to receive(:shell_out!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status)
182
182
  provider.load_current_resource
183
183
  expect(provider.current_resource.version).to eq([nil])
184
184
  end
@@ -192,7 +192,7 @@ Priority: extra
192
192
  Section: ruby
193
193
  EOF
194
194
  )
195
- expect(provider).to receive(:shell_out!).with("dpkg -s #{package}", returns: [0, 1], timeout: 900).and_return(dpkg_s_status)
195
+ expect(provider).to receive(:shell_out!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_return(dpkg_s_status)
196
196
  provider.load_current_resource
197
197
  expect(provider.current_resource.version).to eq([nil])
198
198
  end
@@ -201,13 +201,13 @@ Section: ruby
201
201
  dpkg_s_status = double(
202
202
  exitstatus: 3, stderr: "i am very, very angry with you. i'm very, very cross. go to your room.", stdout: ""
203
203
  )
204
- expect(provider).to receive(:shell_out!).with("dpkg -s #{package}", returns: [0, 1], timeout: 900).and_raise(Mixlib::ShellOut::ShellCommandFailed)
204
+ expect(provider).to receive(:shell_out!).with("dpkg", "-s", package, returns: [0, 1], timeout: 900).and_raise(Mixlib::ShellOut::ShellCommandFailed)
205
205
  expect { provider.load_current_resource }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
206
206
  end
207
207
 
208
208
  it "should raise an exception if dpkg-deb -W fails to run" do
209
209
  status = double(:stdout => "", :exitstatus => -1)
210
- expect(provider).to receive(:shell_out_with_timeout!).with("dpkg-deb -W /tmp/wget_1.11.4-1ubuntu1_amd64.deb").and_raise(Mixlib::ShellOut::ShellCommandFailed)
210
+ expect(provider).to receive(:shell_out_compact_timeout!).with("dpkg-deb", "-W", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb").and_raise(Mixlib::ShellOut::ShellCommandFailed)
211
211
  expect { provider.load_current_resource }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
212
212
  end
213
213
  end
@@ -215,7 +215,7 @@ Section: ruby
215
215
  describe Chef::Provider::Package::Dpkg, "install and upgrade" do
216
216
  it "should run dpkg -i with the package source" do
217
217
  expect(provider).to receive(:run_noninteractive).with(
218
- "dpkg -i", nil, "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
218
+ "dpkg", "-i", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
219
219
  )
220
220
  provider.load_current_resource
221
221
  provider.run_action(:install)
@@ -224,7 +224,7 @@ Section: ruby
224
224
  it "should run dpkg -i if the package is a path and the source is nil" do
225
225
  new_resource.name "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
226
226
  expect(provider).to receive(:run_noninteractive).with(
227
- "dpkg -i", nil, "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
227
+ "dpkg", "-i", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
228
228
  )
229
229
  provider.run_action(:install)
230
230
  end
@@ -232,7 +232,7 @@ Section: ruby
232
232
  it "should run dpkg -i if the package is a path and the source is nil for an upgrade" do
233
233
  new_resource.name "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
234
234
  expect(provider).to receive(:run_noninteractive).with(
235
- "dpkg -i", nil, "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
235
+ "dpkg", "-i", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
236
236
  )
237
237
  provider.run_action(:upgrade)
238
238
  end
@@ -240,7 +240,7 @@ Section: ruby
240
240
  it "should run dpkg -i with the package source and options if specified" do
241
241
  new_resource.options "--force-yes"
242
242
  expect(provider).to receive(:run_noninteractive).with(
243
- "dpkg -i", "--force-yes", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
243
+ "dpkg", "-i", "--force-yes", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb"
244
244
  )
245
245
  provider.run_action(:install)
246
246
  end
@@ -254,14 +254,14 @@ Section: ruby
254
254
  describe Chef::Provider::Package::Dpkg, "remove and purge" do
255
255
  it "should run dpkg -r to remove the package" do
256
256
  expect(provider).to receive(:run_noninteractive).with(
257
- "dpkg -r", nil, "wget"
257
+ "dpkg", "-r", "wget"
258
258
  )
259
259
  provider.remove_package(["wget"], ["1.11.4-1ubuntu1"])
260
260
  end
261
261
 
262
262
  it "should run dpkg -r to remove the package with options if specified" do
263
263
  expect(provider).to receive(:run_noninteractive).with(
264
- "dpkg -r", "--force-yes", "wget"
264
+ "dpkg", "-r", "--force-yes", "wget"
265
265
  )
266
266
  allow(new_resource).to receive(:options).and_return("--force-yes")
267
267
 
@@ -270,14 +270,14 @@ Section: ruby
270
270
 
271
271
  it "should run dpkg -P to purge the package" do
272
272
  expect(provider).to receive(:run_noninteractive).with(
273
- "dpkg -P", nil, "wget"
273
+ "dpkg", "-P", "wget"
274
274
  )
275
275
  provider.purge_package(["wget"], ["1.11.4-1ubuntu1"])
276
276
  end
277
277
 
278
278
  it "should run dpkg -P to purge the package with options if specified" do
279
279
  expect(provider).to receive(:run_noninteractive).with(
280
- "dpkg -P", "--force-yes", "wget"
280
+ "dpkg", "-P", "--force-yes", "wget"
281
281
  )
282
282
  allow(new_resource).to receive(:options).and_return("--force-yes")
283
283
 
@@ -62,51 +62,51 @@ describe Chef::Provider::Package::EasyInstall do
62
62
  describe "actions_on_package" do
63
63
  it "should run easy_install with the package name and version" do
64
64
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
65
- expect(@provider).to receive(:run_command).with({
66
- :command => "easy_install \"boto==1.8d\"",
67
- })
65
+ expect(@provider).to receive(:shell_out!).with(
66
+ "easy_install", "boto==1.8d", { timeout: 900 }
67
+ )
68
68
  @provider.install_package("boto", "1.8d")
69
69
  end
70
70
 
71
71
  it "should run easy_install with the package name and version and specified options" do
72
72
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
73
- expect(@provider).to receive(:run_command).with({
74
- :command => "easy_install --always-unzip \"boto==1.8d\"",
75
- })
73
+ expect(@provider).to receive(:shell_out!).with(
74
+ "easy_install", "--always-unzip", "boto==1.8d", { timeout: 900 }
75
+ )
76
76
  allow(@new_resource).to receive(:options).and_return("--always-unzip")
77
77
  @provider.install_package("boto", "1.8d")
78
78
  end
79
79
 
80
80
  it "should run easy_install with the package name and version" do
81
81
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
82
- expect(@provider).to receive(:run_command).with({
83
- :command => "easy_install \"boto==1.8d\"",
84
- })
82
+ expect(@provider).to receive(:shell_out!).with(
83
+ "easy_install", "boto==1.8d", { timeout: 900 }
84
+ )
85
85
  @provider.upgrade_package("boto", "1.8d")
86
86
  end
87
87
 
88
88
  it "should run easy_install -m with the package name and version" do
89
89
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
90
- expect(@provider).to receive(:run_command).with({
91
- :command => "easy_install -m boto",
92
- })
90
+ expect(@provider).to receive(:shell_out!).with(
91
+ "easy_install", "-m", "boto", { timeout: 900 }
92
+ )
93
93
  @provider.remove_package("boto", "1.8d")
94
94
  end
95
95
 
96
96
  it "should run easy_install -m with the package name and version and specified options" do
97
97
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
98
- expect(@provider).to receive(:run_command).with({
99
- :command => "easy_install -x -m boto",
100
- })
98
+ expect(@provider).to receive(:shell_out!).with(
99
+ "easy_install", "-x", "-m", "boto", { timeout: 900 }
100
+ )
101
101
  allow(@new_resource).to receive(:options).and_return("-x")
102
102
  @provider.remove_package("boto", "1.8d")
103
103
  end
104
104
 
105
105
  it "should run easy_install -m with the package name and version" do
106
106
  expect(Chef).to receive(:deprecated).with(:easy_install, /easy_install package provider is deprecated/)
107
- expect(@provider).to receive(:run_command).with({
108
- :command => "easy_install -m boto",
109
- })
107
+ expect(@provider).to receive(:shell_out!).with(
108
+ "easy_install", "-m", "boto", { timeout: 900 }
109
+ )
110
110
  @provider.purge_package("boto", "1.8d")
111
111
  end
112
112
 
@@ -31,6 +31,8 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
31
31
  @provider = Chef::Provider::Package::Freebsd::Pkg.new(@new_resource, @run_context)
32
32
  @provider.current_resource = @current_resource
33
33
  allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(false)
34
+ allow(::File).to receive(:exist?).with("/usr/ports/www/wordpress").and_return(false)
35
+ allow(::File).to receive(:exist?).with("www/wordpress").and_return(false)
34
36
  end
35
37
 
36
38
  describe "when determining the current package state" do
@@ -77,23 +79,21 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
77
79
 
78
80
  it "should return the version number when it is installed" do
79
81
  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], timeout: 900).and_return(pkg_info)
81
- #@provider.should_receive(:popen4).with('pkg_info -E "zsh*"').and_yield(@pid, @stdin, ["zsh-4.3.6_7"], @stderr).and_return(@status)
82
+ expect(@provider).to receive(:shell_out!).with("pkg_info", "-E", "zsh*", env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
82
83
  allow(@provider).to receive(:package_name).and_return("zsh")
83
84
  expect(@provider.current_installed_version).to eq("4.3.6_7")
84
85
  end
85
86
 
86
87
  it "does not set the current version number when the package is not installed" do
87
88
  pkg_info = OpenStruct.new(:stdout => "")
88
- expect(@provider).to receive(:shell_out!).with('pkg_info -E "zsh*"', env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
89
+ expect(@provider).to receive(:shell_out!).with("pkg_info", "-E", "zsh*", env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
89
90
  allow(@provider).to receive(:package_name).and_return("zsh")
90
91
  expect(@provider.current_installed_version).to be_nil
91
92
  end
92
93
 
93
94
  it "should return the port path for a valid port name" do
94
95
  whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh")
95
- expect(@provider).to receive(:shell_out!).with("whereis -s zsh", env: nil, timeout: 900).and_return(whereis)
96
- #@provider.should_receive(:popen4).with("whereis -s zsh").and_yield(@pid, @stdin, ["zsh: /usr/ports/shells/zsh"], @stderr).and_return(@status)
96
+ expect(@provider).to receive(:shell_out!).with("whereis", "-s", "zsh", env: nil, timeout: 900).and_return(whereis)
97
97
  allow(@provider).to receive(:port_name).and_return("zsh")
98
98
  expect(@provider.port_path).to eq("/usr/ports/shells/zsh")
99
99
  end
@@ -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, timeout: 900 }).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], timeout: 900 }).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, timeout: 900).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, timeout: 900).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, timeout: 900).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, timeout: 900).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, timeout: 900).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], timeout: 900).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, timeout: 900).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, timeout: 900).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
@@ -67,7 +67,7 @@ describe Chef::Provider::Package::Freebsd::Port do
67
67
  end
68
68
 
69
69
  it "should query pkg database" do
70
- expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
70
+ expect(@provider).to receive(:shell_out!).with("pkg", "info", "zsh", env: nil, returns: [0, 70], timeout: 900).and_return(@pkg_info)
71
71
  expect(@provider.current_installed_version).to eq("3.1.7")
72
72
  end
73
73
  end
@@ -75,14 +75,14 @@ describe Chef::Provider::Package::Freebsd::Port do
75
75
  describe "determining candidate version" do
76
76
  it "should query repository" do
77
77
  pkg_query = OpenStruct.new(:stdout => "5.0.5\n", :exitstatus => 0)
78
- expect(@provider).to receive(:shell_out!).with("pkg rquery '%v' zsh", env: nil, timeout: 900).and_return(pkg_query)
78
+ expect(@provider).to receive(:shell_out!).with("pkg", "rquery", "%v", "zsh", env: nil, timeout: 900).and_return(pkg_query)
79
79
  expect(@provider.candidate_version).to eq("5.0.5")
80
80
  end
81
81
 
82
82
  it "should query specified repository when given option" do
83
83
  @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
84
84
  pkg_query = OpenStruct.new(:stdout => "5.0.3\n", :exitstatus => 0)
85
- expect(@provider).to receive(:shell_out!).with("pkg rquery -r LocalMirror '%v' zsh", env: nil, timeout: 900).and_return(pkg_query)
85
+ expect(@provider).to receive(:shell_out!).with("pkg", "rquery", "-r", "LocalMirror", "%v", "zsh", env: nil, timeout: 900).and_return(pkg_query)
86
86
  expect(@provider.candidate_version).to eq("5.0.3")
87
87
  end
88
88
 
@@ -100,7 +100,7 @@ describe Chef::Provider::Package::Freebsd::Port do
100
100
  it "should handle package source from file" do
101
101
  @provider.new_resource.source("/nas/pkg/repo/zsh-5.0.1.txz")
102
102
  expect(@provider).to receive(:shell_out!).
103
- with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
103
+ with("pkg", "add", "/nas/pkg/repo/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
104
104
  and_return(@install_result)
105
105
  @provider.install_package("zsh", "5.0.1")
106
106
  end
@@ -108,21 +108,21 @@ describe Chef::Provider::Package::Freebsd::Port do
108
108
  it "should handle package source over ftp or http" do
109
109
  @provider.new_resource.source("http://repo.example.com/zsh-5.0.1.txz")
110
110
  expect(@provider).to receive(:shell_out!).
111
- with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
111
+ with("pkg", "add", "http://repo.example.com/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
112
112
  and_return(@install_result)
113
113
  @provider.install_package("zsh", "5.0.1")
114
114
  end
115
115
 
116
116
  it "should handle a package name" do
117
117
  expect(@provider).to receive(:shell_out!).
118
- with("pkg install -y zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result)
118
+ with("pkg", "install", "-y", "zsh", env: { "LC_ALL" => nil }, timeout: 900).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 with a specified repo" do
123
123
  @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
124
124
  expect(@provider).to receive(:shell_out!).
125
- with("pkg install -y -r LocalMirror zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result)
125
+ with("pkg", "install", "-y", "-r", "LocalMirror", "zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result)
126
126
  @provider.install_package("zsh", "5.0.1")
127
127
  end
128
128
  end
@@ -134,14 +134,14 @@ describe Chef::Provider::Package::Freebsd::Port do
134
134
 
135
135
  it "should call pkg delete" do
136
136
  expect(@provider).to receive(:shell_out!).
137
- with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result)
137
+ with("pkg", "delete", "-y", "zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result)
138
138
  @provider.remove_package("zsh", "5.0.1")
139
139
  end
140
140
 
141
141
  it "should not include repo option in pkg delete" do
142
142
  @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
143
143
  expect(@provider).to receive(:shell_out!).
144
- with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).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
  end