chef 16.10.17-universal-mingw32 → 17.1.35-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (694) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -21
  3. data/README.md +1 -1
  4. data/Rakefile +13 -2
  5. data/chef-universal-mingw32.gemspec +1 -1
  6. data/chef.gemspec +11 -24
  7. data/distro/ruby_bin_folder/AMD64/Chef.PowerShell.Wrapper.dll +0 -0
  8. data/distro/ruby_bin_folder/AMD64/Chef.PowerShell.dll +0 -0
  9. data/distro/ruby_bin_folder/AMD64/Newtonsoft.Json.dll +0 -0
  10. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
  11. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
  12. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
  13. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.NETCore.App.deps.json +153 -149
  14. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Diagnostics.dll +0 -0
  15. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Management.dll +0 -0
  16. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Utility.dll +0 -0
  17. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.ConsoleHost.dll +0 -0
  18. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.CoreCLR.Eventing.dll +0 -0
  19. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.MarkdownRender.dll +0 -0
  20. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Security.dll +0 -0
  21. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Management.dll +0 -0
  22. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Runtime.dll +0 -0
  23. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Newtonsoft.Json.dll +0 -0
  24. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll +0 -0
  25. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll +0 -0
  26. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.Common.dll +0 -0
  27. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Management.Automation.dll +0 -0
  28. data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Pkcs.dll +0 -0
  29. data/distro/ruby_bin_folder/x86/Chef.PowerShell.dll +0 -0
  30. data/distro/ruby_bin_folder/x86/Chef.Powershell.Wrapper.dll +0 -0
  31. data/distro/ruby_bin_folder/x86/Newtonsoft.Json.dll +0 -0
  32. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
  33. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
  34. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
  35. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.NETCore.App.deps.json +153 -149
  36. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Diagnostics.dll +0 -0
  37. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Management.dll +0 -0
  38. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Utility.dll +0 -0
  39. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.ConsoleHost.dll +0 -0
  40. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.CoreCLR.Eventing.dll +0 -0
  41. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.MarkdownRender.dll +0 -0
  42. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Security.dll +0 -0
  43. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Management.dll +0 -0
  44. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Runtime.dll +0 -0
  45. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Newtonsoft.Json.dll +0 -0
  46. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll +0 -0
  47. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll +0 -0
  48. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.Common.dll +0 -0
  49. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Management.Automation.dll +0 -0
  50. data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Pkcs.dll +0 -0
  51. data/lib/chef/application/base.rb +1 -1
  52. data/lib/chef/applications.rb +0 -1
  53. data/lib/chef/chef_fs/command_line.rb +5 -2
  54. data/lib/chef/chef_fs/file_pattern.rb +2 -2
  55. data/lib/chef/chef_fs/file_system.rb +9 -10
  56. data/lib/chef/client.rb +2 -2
  57. data/lib/chef/compliance/default_attributes.rb +11 -6
  58. data/lib/chef/compliance/fetcher/automate.rb +0 -7
  59. data/lib/chef/compliance/reporter/automate.rb +17 -7
  60. data/lib/chef/compliance/reporter/chef_server_automate.rb +11 -6
  61. data/lib/chef/compliance/reporter/cli.rb +77 -0
  62. data/lib/chef/compliance/reporter/compliance_enforcer.rb +4 -0
  63. data/lib/chef/compliance/reporter/json_file.rb +8 -1
  64. data/lib/chef/compliance/runner.rb +71 -28
  65. data/lib/chef/cookbook/cookbook_version_loader.rb +3 -3
  66. data/lib/chef/cookbook/gem_installer.rb +5 -1
  67. data/lib/chef/cookbook/synchronizer.rb +3 -5
  68. data/lib/chef/cookbook_loader.rb +2 -4
  69. data/lib/chef/cookbook_uploader.rb +0 -1
  70. data/lib/chef/data_bag_item.rb +11 -2
  71. data/lib/chef/delayed_evaluator.rb +4 -0
  72. data/lib/chef/deprecated.rb +4 -0
  73. data/lib/chef/dsl/chef_vault.rb +6 -6
  74. data/lib/chef/dsl/declare_resource.rb +5 -10
  75. data/lib/chef/dsl/reboot_pending.rb +1 -2
  76. data/lib/chef/formatters/doc.rb +2 -1
  77. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +20 -22
  78. data/lib/chef/group.rb +75 -0
  79. data/lib/chef/mixin/get_source_from_package.rb +1 -1
  80. data/lib/chef/node.rb +1 -1
  81. data/lib/chef/node/attribute.rb +6 -4
  82. data/lib/chef/node/immutable_collections.rb +13 -0
  83. data/lib/chef/node/mixin/deep_merge_cache.rb +11 -7
  84. data/lib/chef/org.rb +3 -2
  85. data/lib/chef/property.rb +18 -0
  86. data/lib/chef/provider.rb +1 -1
  87. data/lib/chef/provider/cron.rb +1 -1
  88. data/lib/chef/provider/directory.rb +6 -6
  89. data/lib/chef/provider/execute.rb +2 -1
  90. data/lib/chef/provider/file.rb +2 -2
  91. data/lib/chef/provider/git.rb +5 -7
  92. data/lib/chef/provider/group/groupadd.rb +3 -3
  93. data/lib/chef/provider/group/groupmod.rb +3 -3
  94. data/lib/chef/provider/group/pw.rb +3 -3
  95. data/lib/chef/provider/ifconfig.rb +2 -2
  96. data/lib/chef/provider/link.rb +3 -3
  97. data/lib/chef/provider/mount.rb +12 -7
  98. data/lib/chef/provider/mount/aix.rb +3 -3
  99. data/lib/chef/provider/mount/mount.rb +5 -5
  100. data/lib/chef/provider/mount/windows.rb +1 -1
  101. data/lib/chef/provider/package.rb +17 -21
  102. data/lib/chef/provider/package/apt.rb +27 -1
  103. data/lib/chef/provider/package/deb.rb +3 -3
  104. data/lib/chef/provider/package/dnf/dnf_helper.py +16 -11
  105. data/lib/chef/provider/package/dnf/python_helper.rb +9 -8
  106. data/lib/chef/provider/package/portage.rb +2 -2
  107. data/lib/chef/provider/package/rubygems.rb +11 -17
  108. data/lib/chef/provider/package/windows.rb +2 -4
  109. data/lib/chef/provider/package/yum.rb +1 -4
  110. data/lib/chef/provider/package/yum/python_helper.rb +15 -10
  111. data/lib/chef/provider/package/yum/yum_helper.py +51 -63
  112. data/lib/chef/provider/registry_key.rb +1 -1
  113. data/lib/chef/provider/route.rb +2 -2
  114. data/lib/chef/provider/service.rb +6 -6
  115. data/lib/chef/provider/service/aixinit.rb +1 -1
  116. data/lib/chef/provider/service/debian.rb +1 -1
  117. data/lib/chef/provider/service/freebsd.rb +15 -21
  118. data/lib/chef/provider/service/macosx.rb +7 -7
  119. data/lib/chef/provider/service/systemd.rb +43 -14
  120. data/lib/chef/provider/service/upstart.rb +2 -13
  121. data/lib/chef/provider/service/windows.rb +12 -12
  122. data/lib/chef/provider/subversion.rb +10 -12
  123. data/lib/chef/provider/systemd_unit.rb +36 -10
  124. data/lib/chef/provider/template/content.rb +3 -7
  125. data/lib/chef/provider/user.rb +2 -2
  126. data/lib/chef/provider/user/dscl.rb +1 -1
  127. data/lib/chef/provider/user/mac.rb +17 -20
  128. data/lib/chef/provider/user/pw.rb +1 -1
  129. data/lib/chef/provider/user/windows.rb +1 -1
  130. data/lib/chef/provider/windows_script.rb +1 -1
  131. data/lib/chef/provider/zypper_repository.rb +2 -2
  132. data/lib/chef/providers.rb +0 -1
  133. data/lib/chef/resource.rb +6 -7
  134. data/lib/chef/resource/alternatives.rb +6 -6
  135. data/lib/chef/resource/apt_package.rb +1 -1
  136. data/lib/chef/resource/apt_preference.rb +2 -2
  137. data/lib/chef/resource/apt_repository.rb +6 -6
  138. data/lib/chef/resource/apt_update.rb +3 -2
  139. data/lib/chef/resource/archive_file.rb +2 -3
  140. data/lib/chef/resource/breakpoint.rb +1 -1
  141. data/lib/chef/resource/build_essential.rb +2 -6
  142. data/lib/chef/resource/chef_client_config.rb +2 -2
  143. data/lib/chef/resource/chef_client_cron.rb +5 -5
  144. data/lib/chef/resource/chef_client_launchd.rb +4 -4
  145. data/lib/chef/resource/chef_client_scheduled_task.rb +1 -1
  146. data/lib/chef/resource/chef_client_systemd_timer.rb +2 -2
  147. data/lib/chef/resource/chef_handler.rb +3 -7
  148. data/lib/chef/resource/chef_sleep.rb +1 -1
  149. data/lib/chef/resource/chef_vault_secret.rb +3 -8
  150. data/lib/chef/resource/chocolatey_config.rb +2 -6
  151. data/lib/chef/resource/chocolatey_feature.rb +2 -6
  152. data/lib/chef/resource/chocolatey_source.rb +4 -10
  153. data/lib/chef/resource/cron/_cron_shared.rb +2 -2
  154. data/lib/chef/resource/cron_access.rb +2 -4
  155. data/lib/chef/resource/dmg_package.rb +6 -10
  156. data/lib/chef/resource/dpkg_package.rb +1 -1
  157. data/lib/chef/resource/execute.rb +8 -3
  158. data/lib/chef/resource/file.rb +1 -1
  159. data/lib/chef/resource/group.rb +2 -2
  160. data/lib/chef/resource/homebrew_cask.rb +2 -6
  161. data/lib/chef/resource/homebrew_tap.rb +2 -6
  162. data/lib/chef/resource/hostname.rb +21 -17
  163. data/lib/chef/resource/http_request.rb +1 -1
  164. data/lib/chef/resource/inspec_waiver_file_entry.rb +155 -0
  165. data/lib/chef/resource/kernel_module.rb +6 -17
  166. data/lib/chef/resource/locale.rb +2 -3
  167. data/lib/chef/resource/lwrp_base.rb +19 -0
  168. data/lib/chef/resource/macos_userdefaults.rb +10 -14
  169. data/lib/chef/resource/mdadm.rb +53 -7
  170. data/lib/chef/resource/mount.rb +2 -1
  171. data/lib/chef/resource/openssl_ec_private_key.rb +2 -2
  172. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
  173. data/lib/chef/resource/openssl_x509_certificate.rb +2 -2
  174. data/lib/chef/resource/plist.rb +7 -7
  175. data/lib/chef/resource/powershell_script.rb +1 -1
  176. data/lib/chef/resource/remote_file.rb +3 -3
  177. data/lib/chef/resource/rhsm_errata.rb +16 -1
  178. data/lib/chef/resource/rhsm_errata_level.rb +10 -1
  179. data/lib/chef/resource/rhsm_register.rb +12 -6
  180. data/lib/chef/resource/rhsm_repo.rb +2 -6
  181. data/lib/chef/resource/rhsm_subscription.rb +2 -6
  182. data/lib/chef/resource/scm/git.rb +1 -1
  183. data/lib/chef/resource/sudo.rb +6 -6
  184. data/lib/chef/resource/sysctl.rb +2 -6
  185. data/lib/chef/resource/systemd_unit.rb +2 -2
  186. data/lib/chef/resource/template.rb +1 -1
  187. data/lib/chef/resource/timezone.rb +1 -3
  188. data/lib/chef/resource/user/mac_user.rb +1 -1
  189. data/lib/chef/resource/user_ulimit.rb +2 -2
  190. data/lib/chef/resource/windows_ad_join.rb +2 -6
  191. data/lib/chef/resource/windows_audit_policy.rb +1 -1
  192. data/lib/chef/resource/windows_auto_run.rb +2 -5
  193. data/lib/chef/resource/windows_certificate.rb +207 -73
  194. data/lib/chef/resource/windows_dfs_folder.rb +2 -6
  195. data/lib/chef/resource/windows_dfs_namespace.rb +2 -6
  196. data/lib/chef/resource/windows_dfs_server.rb +1 -3
  197. data/lib/chef/resource/windows_dns_record.rb +2 -6
  198. data/lib/chef/resource/windows_dns_zone.rb +2 -6
  199. data/lib/chef/resource/windows_env.rb +6 -5
  200. data/lib/chef/resource/windows_feature.rb +3 -9
  201. data/lib/chef/resource/windows_feature_dism.rb +2 -6
  202. data/lib/chef/resource/windows_feature_powershell.rb +3 -3
  203. data/lib/chef/resource/windows_firewall_profile.rb +4 -4
  204. data/lib/chef/resource/windows_firewall_rule.rb +2 -5
  205. data/lib/chef/resource/windows_font.rb +3 -5
  206. data/lib/chef/resource/windows_pagefile.rb +4 -8
  207. data/lib/chef/resource/windows_path.rb +4 -4
  208. data/lib/chef/resource/windows_printer.rb +4 -4
  209. data/lib/chef/resource/windows_printer_port.rb +6 -6
  210. data/lib/chef/resource/windows_security_policy.rb +56 -40
  211. data/lib/chef/resource/windows_share.rb +14 -21
  212. data/lib/chef/resource/windows_shortcut.rb +4 -6
  213. data/lib/chef/resource/windows_task.rb +18 -6
  214. data/lib/chef/resource/windows_uac.rb +1 -1
  215. data/lib/chef/resource/windows_user_privilege.rb +4 -4
  216. data/lib/chef/resource/windows_workgroup.rb +1 -2
  217. data/lib/chef/resource_builder.rb +8 -2
  218. data/lib/chef/resources.rb +1 -1
  219. data/lib/chef/run_lock.rb +1 -1
  220. data/lib/chef/runner.rb +1 -1
  221. data/lib/chef/shell/ext.rb +3 -3
  222. data/lib/chef/user.rb +0 -1
  223. data/lib/chef/user_v1.rb +3 -4
  224. data/lib/chef/util/dsc/configuration_generator.rb +1 -0
  225. data/lib/chef/util/dsc/local_configuration_manager.rb +1 -1
  226. data/lib/chef/version.rb +1 -1
  227. data/lib/chef/win32/api.rb +9 -2
  228. data/lib/chef/win32/registry.rb +4 -2
  229. data/spec/data/cookbooks/openldap/libraries/openldap.rb +1 -1
  230. data/spec/data/lwrp/resources/bar.rb +2 -0
  231. data/spec/data/lwrp/resources/buck_passer.rb +1 -0
  232. data/spec/data/lwrp/resources/buck_passer_2.rb +1 -0
  233. data/spec/data/lwrp/resources/embedded_resource_accesses_providers_scope.rb +1 -0
  234. data/spec/data/lwrp/resources/foo.rb +2 -0
  235. data/spec/data/lwrp/resources/inline_compiler.rb +1 -0
  236. data/spec/data/lwrp/resources/monkey_name_printer.rb +1 -0
  237. data/spec/data/lwrp/resources/paint_drying_watcher.rb +1 -0
  238. data/spec/data/lwrp/resources/thumb_twiddler.rb +1 -0
  239. data/spec/data/lwrp/resources_with_default_attributes/nodeattr.rb +2 -0
  240. data/spec/data/lwrp_const_scoping/resources/conflict.rb +1 -0
  241. data/spec/data/lwrp_override/resources/foo.rb +1 -0
  242. data/spec/data/rubygems.org/nonexistent_gem-info +1 -0
  243. data/spec/data/rubygems.org/sexp_processor-info +49 -0
  244. data/spec/data/run_context/cookbooks/circular-dep1/resources/resource.rb +1 -0
  245. data/spec/data/run_context/cookbooks/circular-dep2/resources/resource.rb +1 -0
  246. data/spec/data/run_context/cookbooks/dependency1/resources/resource.rb +1 -0
  247. data/spec/data/run_context/cookbooks/dependency2/resources/resource.rb +1 -0
  248. data/spec/data/run_context/cookbooks/no-default-attr/resources/resource.rb +1 -0
  249. data/spec/data/run_context/cookbooks/test-with-circular-deps/resources/resource.rb +2 -0
  250. data/spec/data/run_context/cookbooks/test-with-deps/resources/resource.rb +1 -0
  251. data/spec/data/run_context/cookbooks/test/resources/resource.rb +2 -0
  252. data/spec/functional/dsl/registry_helper_spec.rb +1 -1
  253. data/spec/functional/resource/aixinit_service_spec.rb +7 -7
  254. data/spec/functional/resource/apt_package_spec.rb +1 -1
  255. data/spec/functional/resource/chocolatey_package_spec.rb +13 -0
  256. data/spec/functional/resource/cron_spec.rb +1 -1
  257. data/spec/functional/resource/dnf_package_spec.rb +857 -534
  258. data/spec/functional/resource/group_spec.rb +1 -1
  259. data/spec/functional/resource/link_spec.rb +1 -1
  260. data/spec/functional/resource/registry_spec.rb +8 -8
  261. data/spec/functional/resource/remote_file_spec.rb +1 -1
  262. data/spec/functional/resource/user/mac_user_spec.rb +2 -2
  263. data/spec/functional/resource/windows_certificate_spec.rb +92 -35
  264. data/spec/functional/resource/windows_env_spec.rb +2 -2
  265. data/spec/functional/resource/yum_package_spec.rb +495 -428
  266. data/spec/functional/version_spec.rb +1 -1
  267. data/spec/functional/win32/registry_spec.rb +1 -1
  268. data/spec/integration/client/client_spec.rb +5 -22
  269. data/spec/integration/client/exit_code_spec.rb +1 -1
  270. data/spec/integration/client/ipv6_spec.rb +1 -1
  271. data/spec/integration/compliance/compliance_spec.rb +3 -2
  272. data/spec/integration/ohai/ohai_spec.rb +7 -6
  273. data/spec/integration/recipes/accumulator_spec.rb +13 -1
  274. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +5 -1
  275. data/spec/integration/recipes/lwrp_spec.rb +3 -1
  276. data/spec/integration/recipes/notifies_spec.rb +15 -1
  277. data/spec/integration/recipes/notifying_block_spec.rb +2 -1
  278. data/spec/integration/recipes/recipe_dsl_spec.rb +9 -9
  279. data/spec/integration/recipes/unified_mode_spec.rb +71 -1
  280. data/spec/integration/recipes/use_partial_spec.rb +4 -1
  281. data/spec/spec_helper.rb +14 -13
  282. data/spec/support/chef_helpers.rb +1 -17
  283. data/spec/support/lib/chef/resource/with_state.rb +0 -1
  284. data/spec/support/lib/chef/resource/zen_follower.rb +0 -1
  285. data/spec/support/lib/chef/resource/zen_master.rb +0 -1
  286. data/spec/support/matchers/leak.rb +7 -9
  287. data/spec/support/platform_helpers.rb +5 -8
  288. data/spec/support/shared/functional/execute_resource.rb +1 -1
  289. data/spec/support/shared/integration/integration_helper.rb +0 -1
  290. data/spec/support/shared/unit/provider/file.rb +15 -1
  291. data/spec/support/shared/unit/script_resource.rb +2 -2
  292. data/spec/unit/application/solo_spec.rb +2 -2
  293. data/spec/unit/chef_fs/diff_spec.rb +1 -1
  294. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
  295. data/spec/unit/chef_fs/file_system_spec.rb +1 -1
  296. data/spec/unit/compliance/fetcher/automate_spec.rb +0 -16
  297. data/spec/unit/compliance/reporter/automate_spec.rb +26 -2
  298. data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +20 -0
  299. data/spec/unit/compliance/reporter/compliance_enforcer_spec.rb +1 -0
  300. data/spec/unit/compliance/runner_spec.rb +85 -10
  301. data/spec/unit/data_bag_item_spec.rb +1 -6
  302. data/spec/unit/dsl/reboot_pending_spec.rb +2 -2
  303. data/spec/unit/dsl/registry_helper_spec.rb +1 -1
  304. data/spec/unit/lwrp_spec.rb +1 -1
  305. data/spec/unit/mixin/params_validate_spec.rb +4 -3
  306. data/spec/unit/node/attribute_spec.rb +1 -1
  307. data/spec/unit/node_spec.rb +78 -0
  308. data/spec/unit/org_group_spec.rb +45 -0
  309. data/spec/unit/property_spec.rb +23 -22
  310. data/spec/unit/provider/cron_spec.rb +1 -1
  311. data/spec/unit/provider/group/gpasswd_spec.rb +2 -2
  312. data/spec/unit/provider/group/groupmod_spec.rb +2 -2
  313. data/spec/unit/provider/group/pw_spec.rb +2 -2
  314. data/spec/unit/provider/group_spec.rb +1 -1
  315. data/spec/unit/provider/link_spec.rb +1 -1
  316. data/spec/unit/provider/mount/mount_spec.rb +51 -0
  317. data/spec/unit/provider/package/apt_spec.rb +84 -18
  318. data/spec/unit/provider/package/deb_spec.rb +3 -3
  319. data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -0
  320. data/spec/unit/provider/package/rubygems_spec.rb +21 -33
  321. data/spec/unit/provider/package/yum/python_helper_spec.rb +1 -0
  322. data/spec/unit/provider/service/arch_service_spec.rb +1 -0
  323. data/spec/unit/provider/service/debian_service_spec.rb +1 -0
  324. data/spec/unit/provider/service/macosx_spec.rb +5 -5
  325. data/spec/unit/provider/service/systemd_service_spec.rb +138 -23
  326. data/spec/unit/provider/service/upstart_service_spec.rb +0 -29
  327. data/spec/unit/provider/service/windows_spec.rb +2 -2
  328. data/spec/unit/provider/subversion_spec.rb +2 -2
  329. data/spec/unit/provider/systemd_unit_spec.rb +79 -60
  330. data/spec/unit/provider/zypper_repository_spec.rb +2 -2
  331. data/spec/unit/provider_spec.rb +0 -8
  332. data/spec/unit/resource/chef_client_cron_spec.rb +8 -8
  333. data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +80 -0
  334. data/spec/unit/resource/powershell_script_spec.rb +2 -2
  335. data/spec/unit/resource/windows_task_spec.rb +1 -1
  336. data/spec/unit/user_spec.rb +1 -1
  337. data/spec/unit/user_v1_spec.rb +6 -4
  338. data/tasks/rspec.rb +9 -6
  339. metadata +23 -528
  340. data/bin/knife +0 -24
  341. data/lib/chef/application/knife.rb +0 -234
  342. data/lib/chef/application/windows_service.rb +0 -338
  343. data/lib/chef/application/windows_service_manager.rb +0 -205
  344. data/lib/chef/chef_fs/knife.rb +0 -160
  345. data/lib/chef/chef_fs/parallelizer.rb +0 -102
  346. data/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb +0 -35
  347. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +0 -278
  348. data/lib/chef/cookbook_site_streaming_uploader.rb +0 -244
  349. data/lib/chef/knife.rb +0 -665
  350. data/lib/chef/knife/acl_add.rb +0 -57
  351. data/lib/chef/knife/acl_base.rb +0 -183
  352. data/lib/chef/knife/acl_bulk_add.rb +0 -78
  353. data/lib/chef/knife/acl_bulk_remove.rb +0 -83
  354. data/lib/chef/knife/acl_remove.rb +0 -62
  355. data/lib/chef/knife/acl_show.rb +0 -56
  356. data/lib/chef/knife/bootstrap.rb +0 -1192
  357. data/lib/chef/knife/bootstrap/chef_vault_handler.rb +0 -162
  358. data/lib/chef/knife/bootstrap/client_builder.rb +0 -212
  359. data/lib/chef/knife/bootstrap/templates/README.md +0 -11
  360. data/lib/chef/knife/bootstrap/templates/chef-full.erb +0 -242
  361. data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +0 -278
  362. data/lib/chef/knife/bootstrap/train_connector.rb +0 -336
  363. data/lib/chef/knife/client_bulk_delete.rb +0 -104
  364. data/lib/chef/knife/client_create.rb +0 -101
  365. data/lib/chef/knife/client_delete.rb +0 -62
  366. data/lib/chef/knife/client_edit.rb +0 -52
  367. data/lib/chef/knife/client_key_create.rb +0 -73
  368. data/lib/chef/knife/client_key_delete.rb +0 -80
  369. data/lib/chef/knife/client_key_edit.rb +0 -83
  370. data/lib/chef/knife/client_key_list.rb +0 -73
  371. data/lib/chef/knife/client_key_show.rb +0 -80
  372. data/lib/chef/knife/client_list.rb +0 -41
  373. data/lib/chef/knife/client_reregister.rb +0 -58
  374. data/lib/chef/knife/client_show.rb +0 -48
  375. data/lib/chef/knife/config_get.rb +0 -39
  376. data/lib/chef/knife/config_get_profile.rb +0 -37
  377. data/lib/chef/knife/config_list.rb +0 -139
  378. data/lib/chef/knife/config_list_profiles.rb +0 -37
  379. data/lib/chef/knife/config_show.rb +0 -127
  380. data/lib/chef/knife/config_use.rb +0 -61
  381. data/lib/chef/knife/config_use_profile.rb +0 -47
  382. data/lib/chef/knife/configure.rb +0 -150
  383. data/lib/chef/knife/configure_client.rb +0 -48
  384. data/lib/chef/knife/cookbook_bulk_delete.rb +0 -71
  385. data/lib/chef/knife/cookbook_delete.rb +0 -151
  386. data/lib/chef/knife/cookbook_download.rb +0 -142
  387. data/lib/chef/knife/cookbook_list.rb +0 -47
  388. data/lib/chef/knife/cookbook_metadata.rb +0 -106
  389. data/lib/chef/knife/cookbook_metadata_from_file.rb +0 -49
  390. data/lib/chef/knife/cookbook_show.rb +0 -98
  391. data/lib/chef/knife/cookbook_upload.rb +0 -292
  392. data/lib/chef/knife/core/bootstrap_context.rb +0 -264
  393. data/lib/chef/knife/core/cookbook_scm_repo.rb +0 -159
  394. data/lib/chef/knife/core/formatting_options.rb +0 -49
  395. data/lib/chef/knife/core/gem_glob_loader.rb +0 -138
  396. data/lib/chef/knife/core/generic_presenter.rb +0 -232
  397. data/lib/chef/knife/core/hashed_command_loader.rb +0 -100
  398. data/lib/chef/knife/core/node_editor.rb +0 -130
  399. data/lib/chef/knife/core/node_presenter.rb +0 -133
  400. data/lib/chef/knife/core/object_loader.rb +0 -115
  401. data/lib/chef/knife/core/status_presenter.rb +0 -147
  402. data/lib/chef/knife/core/subcommand_loader.rb +0 -203
  403. data/lib/chef/knife/core/text_formatter.rb +0 -85
  404. data/lib/chef/knife/core/ui.rb +0 -338
  405. data/lib/chef/knife/core/windows_bootstrap_context.rb +0 -406
  406. data/lib/chef/knife/data_bag_create.rb +0 -81
  407. data/lib/chef/knife/data_bag_delete.rb +0 -49
  408. data/lib/chef/knife/data_bag_edit.rb +0 -74
  409. data/lib/chef/knife/data_bag_from_file.rb +0 -113
  410. data/lib/chef/knife/data_bag_list.rb +0 -42
  411. data/lib/chef/knife/data_bag_secret_options.rb +0 -122
  412. data/lib/chef/knife/data_bag_show.rb +0 -69
  413. data/lib/chef/knife/delete.rb +0 -125
  414. data/lib/chef/knife/deps.rb +0 -156
  415. data/lib/chef/knife/diff.rb +0 -83
  416. data/lib/chef/knife/download.rb +0 -84
  417. data/lib/chef/knife/edit.rb +0 -88
  418. data/lib/chef/knife/environment_compare.rb +0 -128
  419. data/lib/chef/knife/environment_create.rb +0 -52
  420. data/lib/chef/knife/environment_delete.rb +0 -44
  421. data/lib/chef/knife/environment_edit.rb +0 -44
  422. data/lib/chef/knife/environment_from_file.rb +0 -84
  423. data/lib/chef/knife/environment_list.rb +0 -41
  424. data/lib/chef/knife/environment_show.rb +0 -47
  425. data/lib/chef/knife/exec.rb +0 -99
  426. data/lib/chef/knife/group_add.rb +0 -55
  427. data/lib/chef/knife/group_create.rb +0 -49
  428. data/lib/chef/knife/group_destroy.rb +0 -53
  429. data/lib/chef/knife/group_list.rb +0 -43
  430. data/lib/chef/knife/group_remove.rb +0 -56
  431. data/lib/chef/knife/group_show.rb +0 -49
  432. data/lib/chef/knife/key_create.rb +0 -112
  433. data/lib/chef/knife/key_create_base.rb +0 -50
  434. data/lib/chef/knife/key_delete.rb +0 -55
  435. data/lib/chef/knife/key_edit.rb +0 -118
  436. data/lib/chef/knife/key_edit_base.rb +0 -55
  437. data/lib/chef/knife/key_list.rb +0 -90
  438. data/lib/chef/knife/key_list_base.rb +0 -45
  439. data/lib/chef/knife/key_show.rb +0 -53
  440. data/lib/chef/knife/list.rb +0 -177
  441. data/lib/chef/knife/node_bulk_delete.rb +0 -75
  442. data/lib/chef/knife/node_create.rb +0 -47
  443. data/lib/chef/knife/node_delete.rb +0 -46
  444. data/lib/chef/knife/node_edit.rb +0 -70
  445. data/lib/chef/knife/node_environment_set.rb +0 -53
  446. data/lib/chef/knife/node_from_file.rb +0 -51
  447. data/lib/chef/knife/node_list.rb +0 -44
  448. data/lib/chef/knife/node_policy_set.rb +0 -79
  449. data/lib/chef/knife/node_run_list_add.rb +0 -104
  450. data/lib/chef/knife/node_run_list_remove.rb +0 -67
  451. data/lib/chef/knife/node_run_list_set.rb +0 -66
  452. data/lib/chef/knife/node_show.rb +0 -63
  453. data/lib/chef/knife/null.rb +0 -12
  454. data/lib/chef/knife/raw.rb +0 -123
  455. data/lib/chef/knife/recipe_list.rb +0 -32
  456. data/lib/chef/knife/rehash.rb +0 -50
  457. data/lib/chef/knife/role_bulk_delete.rb +0 -66
  458. data/lib/chef/knife/role_create.rb +0 -53
  459. data/lib/chef/knife/role_delete.rb +0 -46
  460. data/lib/chef/knife/role_edit.rb +0 -45
  461. data/lib/chef/knife/role_env_run_list_add.rb +0 -87
  462. data/lib/chef/knife/role_env_run_list_clear.rb +0 -55
  463. data/lib/chef/knife/role_env_run_list_remove.rb +0 -57
  464. data/lib/chef/knife/role_env_run_list_replace.rb +0 -60
  465. data/lib/chef/knife/role_env_run_list_set.rb +0 -70
  466. data/lib/chef/knife/role_from_file.rb +0 -51
  467. data/lib/chef/knife/role_list.rb +0 -42
  468. data/lib/chef/knife/role_run_list_add.rb +0 -87
  469. data/lib/chef/knife/role_run_list_clear.rb +0 -55
  470. data/lib/chef/knife/role_run_list_remove.rb +0 -56
  471. data/lib/chef/knife/role_run_list_replace.rb +0 -60
  472. data/lib/chef/knife/role_run_list_set.rb +0 -69
  473. data/lib/chef/knife/role_show.rb +0 -48
  474. data/lib/chef/knife/search.rb +0 -194
  475. data/lib/chef/knife/serve.rb +0 -65
  476. data/lib/chef/knife/show.rb +0 -72
  477. data/lib/chef/knife/ssh.rb +0 -645
  478. data/lib/chef/knife/ssl_check.rb +0 -284
  479. data/lib/chef/knife/ssl_fetch.rb +0 -161
  480. data/lib/chef/knife/status.rb +0 -95
  481. data/lib/chef/knife/supermarket_download.rb +0 -121
  482. data/lib/chef/knife/supermarket_install.rb +0 -192
  483. data/lib/chef/knife/supermarket_list.rb +0 -76
  484. data/lib/chef/knife/supermarket_search.rb +0 -53
  485. data/lib/chef/knife/supermarket_share.rb +0 -166
  486. data/lib/chef/knife/supermarket_show.rb +0 -66
  487. data/lib/chef/knife/supermarket_unshare.rb +0 -61
  488. data/lib/chef/knife/tag_create.rb +0 -52
  489. data/lib/chef/knife/tag_delete.rb +0 -60
  490. data/lib/chef/knife/tag_list.rb +0 -47
  491. data/lib/chef/knife/upload.rb +0 -86
  492. data/lib/chef/knife/user_create.rb +0 -107
  493. data/lib/chef/knife/user_delete.rb +0 -44
  494. data/lib/chef/knife/user_dissociate.rb +0 -42
  495. data/lib/chef/knife/user_edit.rb +0 -52
  496. data/lib/chef/knife/user_invite_add.rb +0 -43
  497. data/lib/chef/knife/user_invite_list.rb +0 -34
  498. data/lib/chef/knife/user_invite_rescind.rb +0 -63
  499. data/lib/chef/knife/user_key_create.rb +0 -73
  500. data/lib/chef/knife/user_key_delete.rb +0 -80
  501. data/lib/chef/knife/user_key_edit.rb +0 -83
  502. data/lib/chef/knife/user_key_list.rb +0 -73
  503. data/lib/chef/knife/user_key_show.rb +0 -80
  504. data/lib/chef/knife/user_list.rb +0 -42
  505. data/lib/chef/knife/user_reregister.rb +0 -59
  506. data/lib/chef/knife/user_show.rb +0 -48
  507. data/lib/chef/knife/xargs.rb +0 -282
  508. data/lib/chef/knife/yaml_convert.rb +0 -91
  509. data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +0 -79
  510. data/lib/chef/provider/package/yum/simplejson/__init__.py +0 -318
  511. data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
  512. data/lib/chef/provider/package/yum/simplejson/decoder.py +0 -354
  513. data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
  514. data/lib/chef/provider/package/yum/simplejson/encoder.py +0 -440
  515. data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
  516. data/lib/chef/provider/package/yum/simplejson/scanner.py +0 -65
  517. data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
  518. data/lib/chef/provider/package/yum/simplejson/tool.py +0 -37
  519. data/lib/chef/resource/user/dscl_user.rb +0 -35
  520. data/spec/functional/knife/configure_spec.rb +0 -33
  521. data/spec/functional/knife/cookbook_delete_spec.rb +0 -156
  522. data/spec/functional/knife/exec_spec.rb +0 -55
  523. data/spec/functional/knife/rehash_spec.rb +0 -39
  524. data/spec/functional/knife/smoke_test.rb +0 -42
  525. data/spec/functional/knife/ssh_spec.rb +0 -352
  526. data/spec/functional/resource/user/dscl_spec.rb +0 -188
  527. data/spec/functional/resource/windows_service_spec.rb +0 -105
  528. data/spec/functional/win32/service_manager_spec.rb +0 -220
  529. data/spec/integration/knife/chef_fs_data_store_spec.rb +0 -557
  530. data/spec/integration/knife/chef_repo_path_spec.rb +0 -962
  531. data/spec/integration/knife/chef_repository_file_system_spec.rb +0 -200
  532. data/spec/integration/knife/chefignore_spec.rb +0 -301
  533. data/spec/integration/knife/client_bulk_delete_spec.rb +0 -131
  534. data/spec/integration/knife/client_create_spec.rb +0 -70
  535. data/spec/integration/knife/client_delete_spec.rb +0 -64
  536. data/spec/integration/knife/client_key_create_spec.rb +0 -66
  537. data/spec/integration/knife/client_key_delete_spec.rb +0 -43
  538. data/spec/integration/knife/client_key_list_spec.rb +0 -61
  539. data/spec/integration/knife/client_key_show_spec.rb +0 -45
  540. data/spec/integration/knife/client_list_spec.rb +0 -49
  541. data/spec/integration/knife/client_show_spec.rb +0 -37
  542. data/spec/integration/knife/common_options_spec.rb +0 -174
  543. data/spec/integration/knife/config_list_spec.rb +0 -220
  544. data/spec/integration/knife/config_show_spec.rb +0 -192
  545. data/spec/integration/knife/config_use_spec.rb +0 -198
  546. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +0 -113
  547. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +0 -65
  548. data/spec/integration/knife/cookbook_download_spec.rb +0 -72
  549. data/spec/integration/knife/cookbook_list_spec.rb +0 -55
  550. data/spec/integration/knife/cookbook_show_spec.rb +0 -149
  551. data/spec/integration/knife/cookbook_upload_spec.rb +0 -128
  552. data/spec/integration/knife/data_bag_create_spec.rb +0 -125
  553. data/spec/integration/knife/data_bag_delete_spec.rb +0 -59
  554. data/spec/integration/knife/data_bag_edit_spec.rb +0 -105
  555. data/spec/integration/knife/data_bag_from_file_spec.rb +0 -116
  556. data/spec/integration/knife/data_bag_list_spec.rb +0 -44
  557. data/spec/integration/knife/data_bag_show_spec.rb +0 -95
  558. data/spec/integration/knife/delete_spec.rb +0 -1018
  559. data/spec/integration/knife/deps_spec.rb +0 -703
  560. data/spec/integration/knife/diff_spec.rb +0 -605
  561. data/spec/integration/knife/download_spec.rb +0 -1336
  562. data/spec/integration/knife/environment_compare_spec.rb +0 -75
  563. data/spec/integration/knife/environment_create_spec.rb +0 -41
  564. data/spec/integration/knife/environment_delete_spec.rb +0 -37
  565. data/spec/integration/knife/environment_from_file_spec.rb +0 -116
  566. data/spec/integration/knife/environment_list_spec.rb +0 -42
  567. data/spec/integration/knife/environment_show_spec.rb +0 -77
  568. data/spec/integration/knife/list_spec.rb +0 -1060
  569. data/spec/integration/knife/node_bulk_delete_spec.rb +0 -52
  570. data/spec/integration/knife/node_create_spec.rb +0 -47
  571. data/spec/integration/knife/node_delete_spec.rb +0 -48
  572. data/spec/integration/knife/node_environment_set_spec.rb +0 -46
  573. data/spec/integration/knife/node_from_file_spec.rb +0 -59
  574. data/spec/integration/knife/node_list_spec.rb +0 -45
  575. data/spec/integration/knife/node_run_list_add_spec.rb +0 -54
  576. data/spec/integration/knife/node_run_list_remove_spec.rb +0 -36
  577. data/spec/integration/knife/node_run_list_set_spec.rb +0 -41
  578. data/spec/integration/knife/node_show_spec.rb +0 -36
  579. data/spec/integration/knife/raw_spec.rb +0 -297
  580. data/spec/integration/knife/redirection_spec.rb +0 -64
  581. data/spec/integration/knife/role_bulk_delete_spec.rb +0 -52
  582. data/spec/integration/knife/role_create_spec.rb +0 -41
  583. data/spec/integration/knife/role_delete_spec.rb +0 -48
  584. data/spec/integration/knife/role_from_file_spec.rb +0 -96
  585. data/spec/integration/knife/role_list_spec.rb +0 -45
  586. data/spec/integration/knife/role_show_spec.rb +0 -51
  587. data/spec/integration/knife/search_node_spec.rb +0 -40
  588. data/spec/integration/knife/serve_spec.rb +0 -92
  589. data/spec/integration/knife/show_spec.rb +0 -197
  590. data/spec/integration/knife/upload_spec.rb +0 -1617
  591. data/spec/support/shared/functional/win32_service.rb +0 -57
  592. data/spec/unit/application/knife_spec.rb +0 -241
  593. data/spec/unit/chef_fs/parallelizer_spec.rb +0 -479
  594. data/spec/unit/cookbook_site_streaming_uploader_spec.rb +0 -198
  595. data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +0 -152
  596. data/spec/unit/knife/bootstrap/client_builder_spec.rb +0 -207
  597. data/spec/unit/knife/bootstrap/train_connector_spec.rb +0 -244
  598. data/spec/unit/knife/bootstrap_spec.rb +0 -2220
  599. data/spec/unit/knife/client_bulk_delete_spec.rb +0 -166
  600. data/spec/unit/knife/client_create_spec.rb +0 -169
  601. data/spec/unit/knife/client_delete_spec.rb +0 -99
  602. data/spec/unit/knife/client_edit_spec.rb +0 -53
  603. data/spec/unit/knife/client_list_spec.rb +0 -34
  604. data/spec/unit/knife/client_reregister_spec.rb +0 -62
  605. data/spec/unit/knife/client_show_spec.rb +0 -52
  606. data/spec/unit/knife/configure_client_spec.rb +0 -81
  607. data/spec/unit/knife/configure_spec.rb +0 -190
  608. data/spec/unit/knife/cookbook_bulk_delete_spec.rb +0 -87
  609. data/spec/unit/knife/cookbook_delete_spec.rb +0 -239
  610. data/spec/unit/knife/cookbook_download_spec.rb +0 -255
  611. data/spec/unit/knife/cookbook_list_spec.rb +0 -88
  612. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +0 -72
  613. data/spec/unit/knife/cookbook_metadata_spec.rb +0 -182
  614. data/spec/unit/knife/cookbook_show_spec.rb +0 -253
  615. data/spec/unit/knife/cookbook_upload_spec.rb +0 -364
  616. data/spec/unit/knife/core/bootstrap_context_spec.rb +0 -287
  617. data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +0 -187
  618. data/spec/unit/knife/core/gem_glob_loader_spec.rb +0 -209
  619. data/spec/unit/knife/core/hashed_command_loader_spec.rb +0 -112
  620. data/spec/unit/knife/core/node_editor_spec.rb +0 -211
  621. data/spec/unit/knife/core/object_loader_spec.rb +0 -81
  622. data/spec/unit/knife/core/status_presenter_spec.rb +0 -54
  623. data/spec/unit/knife/core/subcommand_loader_spec.rb +0 -64
  624. data/spec/unit/knife/core/ui_spec.rb +0 -656
  625. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +0 -238
  626. data/spec/unit/knife/data_bag_create_spec.rb +0 -175
  627. data/spec/unit/knife/data_bag_edit_spec.rb +0 -126
  628. data/spec/unit/knife/data_bag_from_file_spec.rb +0 -174
  629. data/spec/unit/knife/data_bag_secret_options_spec.rb +0 -173
  630. data/spec/unit/knife/data_bag_show_spec.rb +0 -139
  631. data/spec/unit/knife/environment_compare_spec.rb +0 -112
  632. data/spec/unit/knife/environment_create_spec.rb +0 -91
  633. data/spec/unit/knife/environment_delete_spec.rb +0 -71
  634. data/spec/unit/knife/environment_edit_spec.rb +0 -79
  635. data/spec/unit/knife/environment_from_file_spec.rb +0 -90
  636. data/spec/unit/knife/environment_list_spec.rb +0 -54
  637. data/spec/unit/knife/environment_show_spec.rb +0 -52
  638. data/spec/unit/knife/key_create_spec.rb +0 -223
  639. data/spec/unit/knife/key_delete_spec.rb +0 -133
  640. data/spec/unit/knife/key_edit_spec.rb +0 -264
  641. data/spec/unit/knife/key_helper.rb +0 -74
  642. data/spec/unit/knife/key_list_spec.rb +0 -216
  643. data/spec/unit/knife/key_show_spec.rb +0 -126
  644. data/spec/unit/knife/node_bulk_delete_spec.rb +0 -94
  645. data/spec/unit/knife/node_delete_spec.rb +0 -77
  646. data/spec/unit/knife/node_edit_spec.rb +0 -116
  647. data/spec/unit/knife/node_environment_set_spec.rb +0 -61
  648. data/spec/unit/knife/node_from_file_spec.rb +0 -59
  649. data/spec/unit/knife/node_list_spec.rb +0 -62
  650. data/spec/unit/knife/node_policy_set_spec.rb +0 -122
  651. data/spec/unit/knife/node_run_list_add_spec.rb +0 -145
  652. data/spec/unit/knife/node_run_list_remove_spec.rb +0 -106
  653. data/spec/unit/knife/node_run_list_set_spec.rb +0 -115
  654. data/spec/unit/knife/node_show_spec.rb +0 -65
  655. data/spec/unit/knife/raw_spec.rb +0 -43
  656. data/spec/unit/knife/role_bulk_delete_spec.rb +0 -80
  657. data/spec/unit/knife/role_create_spec.rb +0 -80
  658. data/spec/unit/knife/role_delete_spec.rb +0 -67
  659. data/spec/unit/knife/role_edit_spec.rb +0 -77
  660. data/spec/unit/knife/role_env_run_list_add_spec.rb +0 -217
  661. data/spec/unit/knife/role_env_run_list_clear_spec.rb +0 -94
  662. data/spec/unit/knife/role_env_run_list_remove_spec.rb +0 -102
  663. data/spec/unit/knife/role_env_run_list_replace_spec.rb +0 -105
  664. data/spec/unit/knife/role_env_run_list_set_spec.rb +0 -99
  665. data/spec/unit/knife/role_from_file_spec.rb +0 -69
  666. data/spec/unit/knife/role_list_spec.rb +0 -54
  667. data/spec/unit/knife/role_run_list_add_spec.rb +0 -179
  668. data/spec/unit/knife/role_run_list_clear_spec.rb +0 -84
  669. data/spec/unit/knife/role_run_list_remove_spec.rb +0 -92
  670. data/spec/unit/knife/role_run_list_replace_spec.rb +0 -98
  671. data/spec/unit/knife/role_run_list_set_spec.rb +0 -89
  672. data/spec/unit/knife/role_show_spec.rb +0 -59
  673. data/spec/unit/knife/ssh_spec.rb +0 -403
  674. data/spec/unit/knife/ssl_check_spec.rb +0 -256
  675. data/spec/unit/knife/ssl_fetch_spec.rb +0 -222
  676. data/spec/unit/knife/status_spec.rb +0 -112
  677. data/spec/unit/knife/supermarket_download_spec.rb +0 -152
  678. data/spec/unit/knife/supermarket_install_spec.rb +0 -202
  679. data/spec/unit/knife/supermarket_list_spec.rb +0 -70
  680. data/spec/unit/knife/supermarket_search_spec.rb +0 -85
  681. data/spec/unit/knife/supermarket_share_spec.rb +0 -208
  682. data/spec/unit/knife/supermarket_unshare_spec.rb +0 -78
  683. data/spec/unit/knife/tag_create_spec.rb +0 -23
  684. data/spec/unit/knife/tag_delete_spec.rb +0 -25
  685. data/spec/unit/knife/tag_list_spec.rb +0 -23
  686. data/spec/unit/knife/user_create_spec.rb +0 -184
  687. data/spec/unit/knife/user_delete_spec.rb +0 -46
  688. data/spec/unit/knife/user_edit_spec.rb +0 -48
  689. data/spec/unit/knife/user_list_spec.rb +0 -36
  690. data/spec/unit/knife/user_reregister_spec.rb +0 -56
  691. data/spec/unit/knife/user_show_spec.rb +0 -46
  692. data/spec/unit/knife_spec.rb +0 -634
  693. data/spec/unit/provider/user/dscl_spec.rb +0 -699
  694. data/spec/unit/windows_service_spec.rb +0 -118
@@ -1,4 +1,4 @@
1
- require_relative './openldap/version.rb'
1
+ require_relative './openldap/version'
2
2
 
3
3
  class OpenLDAP
4
4
  end
@@ -1,2 +1,4 @@
1
+ unified_mode true
2
+
1
3
  provides :lwrp_bar # This makes sure that we cover the case of lwrps using provides
2
4
  actions :pass_buck, :prepare_eyes, :watch_paint_dry
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  provides :buck_passer
3
4
 
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  default_action :pass_buck
3
4
  actions :pass_buck
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  default_action :twiddle_thumbs
3
4
  actions :twiddle_thumbs
@@ -1,3 +1,5 @@
1
+ unified_mode true
2
+
1
3
  actions :prepare_thumbs, :twiddle_thumbs
2
4
  default_action :pass_buck
3
5
 
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  default_action :test
3
4
  actions :test, :no_updates
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  property :monkey
3
4
 
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  default_action :prepare_eyes
3
4
  actions :prepare_eyes, :watch_paint_dry
@@ -1,3 +1,4 @@
1
+ unified_mode true
1
2
 
2
3
  default_action :prepare_thumbs
3
4
  actions :prepare_thumbs, :twiddle_thumbs
@@ -1 +1,3 @@
1
+ unified_mode true
2
+
1
3
  attribute :penguin, :kind_of => String, :default => node[:penguin_name]
@@ -0,0 +1 @@
1
+ unified_mode true
@@ -1,4 +1,5 @@
1
1
  # Starting with Chef 12 reloading an LWRP shouldn't reload the file anymore
2
+ unified_mode true
2
3
 
3
4
  actions :never_execute
4
5
 
@@ -0,0 +1 @@
1
+ This gem could not be found
@@ -0,0 +1,49 @@
1
+ ---
2
+ 3.0.0 |checksum:ff9abf0d904ba57b9654352b396aa28cf6ad5315af99d8bbf664f5ff6efd3a5d
3
+ 3.0.1 |checksum:d012a759dc6950dcda667a359051c2e62e4bd19790aeed698a5e47d013ef3ae7
4
+ 3.0.2 |checksum:ba85e835493e6099c2f52937b77ce518d65af39409befdd9b43927c0a604ed87
5
+ 3.0.3 |checksum:a433b01d821f5e81200fbec77fc26a1ecb186ad7d8e40d19ed34ea295287170a
6
+ 3.0.4 |checksum:5f394545863d5abe5c3f53c3b883128f58900cd792504076a765b53c9a49f10a
7
+ 3.0.5 |checksum:8e06c84ed3a0159a0f2e6f7b10bbd056954ac2d33548318ccc3088556c8a8891
8
+ 3.0.6 |checksum:e6e0f30ff14b73b28f8e5803646aa6d2ed81b3b239e76815fd8160ea4121c650
9
+ 3.0.7 |checksum:7647c24bbebea0ef57a892953fc96349091924a399ee5d98f41da5d9db484816
10
+ 3.0.8 |checksum:6c8ff89feab635e332e115356451614a16d171485e34b6b30a6dea243caaaed7
11
+ 3.0.9 |checksum:b55c35100f5e1e191ff67eac8667aea9433d1492697c9434cdb35550cf6e4dd0
12
+ 3.0.10 |checksum:e168db8d4eccfc721685d939654698f1b419f018f45e38d17ab40033102987f4
13
+ 3.1.0 |checksum:3d9dd950ba0b235c4901d04e410c7e716feb491148bf0ca7daa0f510838b3bf7
14
+ 3.2.0 |checksum:5951f8d33ede2f68686c701142c6cc1004d6f525b0aa8e8279a1bf075542b0f0
15
+ 4.0.0 |checksum:36c185f8caecacb178500cabdc3e038862df640536c2e84ab763ae134462896f
16
+ 4.0.1 |checksum:efd33857c0f41a413ec3ea20251f43c4826fe8a11b01099335f4a3b6777eb727
17
+ 4.1.0 |checksum:d26879b9a0675ea156c82e26971149349a1474aac3da4d0d2a04cc18e6df73a3
18
+ 4.1.1 |checksum:15df4e54e0fab19e225862b36dff823d5b87d57ea998f2e47c52ce01de82b3d9
19
+ 4.1.2 |checksum:7c2ed2d62d0305f2c33cba2e99b288df0f3f4343c367b8ee8cad8c735abc8568
20
+ 4.1.3 |checksum:d02f1465c7f012f77a61abdaa841a5273a2277247bc143bfa11cf139a29dbdf8
21
+ 4.1.4 |checksum:f7798b1682dcf750dab5f4f8da548fee36f30864a4e4b0d8a63295d159357c3b
22
+ 4.1.5 |checksum:741c7dfe5e392ae39e22399546d25fe00ffdfc7a55e653e6a99b6770b1c0066c
23
+ 4.2.0 |checksum:3cde88e3d440f63af3cd48edca88bd98872622403740ecda78b7d27161367486
24
+ 4.2.1 |checksum:dfc3eef6ef13c5750c3faab782c4db6c74a7bcc5d03e56e4edeec21aab034185
25
+ 4.3.0 |checksum:7accb37900d1599c6f0f40be92bc62a5db4e5a7eb64f33a858cf83e798dd1ddc
26
+ 4.4.0 |checksum:71591ddbda99b5e12e4a46d377c87513850ca7aa4b1aa800ae02792cadee6be7
27
+ 4.4.1 |checksum:8a10333552216bf3d3846476cfe78dbc9b5724864e3f5016837724622d828f16
28
+ 4.4.2 |checksum:adba9d17de5957532223a1bf0e7bdba5ab849d6576e9210439a7d99e0cfa2595
29
+ 4.4.3 |checksum:b3eb96da1fe998f1c00665a9c645878518134cca7c35d39c4bb716e866f4cc57
30
+ 4.4.4 |checksum:43cab5a67ca409d62411f869ddb7a0a4de0988b489d3f1d610d9b6e521964fd5
31
+ 4.4.5 |checksum:af8713761f1b6604865830c54324e57c33e7cc05107ebdbee4e6d458f8f8fe7c
32
+ 4.5.0 |checksum:54d94dc52cf98a51548c8f3e77031a3347508b542b8cb066100ed3ac40c03081
33
+ 4.5.1 |checksum:1456a9be103bf1de0d34ff6980b77a5a72cf3d4b35bbd2182ac62506981a234c
34
+ 4.6.0 |checksum:e2498f90c75bd4c19d1739afadde8c03af26a881c8bd775f71d2f180de65b43f
35
+ 4.6.1 |checksum:e2e96c2ee3ea81e1dc7b4b4abee23b6e552e669cfe456ee69126a29a03373cd7
36
+ 4.7.0 |checksum:963a1f5b21c95595fb3cf1e8531784bf3d8fe30302cf6f271b08aefdc63e453f
37
+ 4.8.0 |checksum:5b9325f28b5be80ba8d43b7660f60ad67c9304fe8181dee89d3a348b13d2fada
38
+ 4.9.0 |checksum:333619bc71d563ee60f26fc5f3a7f57bd89ee3191177fdce87a014dcb1b8d3b0
39
+ 4.10.0b1 |checksum:8791e2006a2ddbf8dc96cfc19633de01af8cb8687703177a85aeb3f959974d5b,rubygems:> 1.3.1
40
+ 4.10.0 |checksum:b67a289ae4a3968d93dab0803d0ef5a262b6f94138ab98072e489d2aa8af4034
41
+ 4.10.1 |checksum:63d2297712eb1d6219ab1cb9207d9a239ac9ad20463c0b58ca865f0b46deb5ec
42
+ 4.11.0 |checksum:4c90ff17c492789fdd248369fa16ce65ef05576b3d9f593a49c6a0961dbcd5ee
43
+ 4.12.0 |checksum:671110574e96377a03b328bfb7f6339540443eca0b62913bf8fe38e9ebcb4470
44
+ 4.12.1 |checksum:f87cd92457a343b4e951e1f1ac3e8183f98de4640a32f6ceb44628332d21a088
45
+ 4.13.0 |checksum:47e86c22a2d7810897e3eae9669ab9afa220f5e6cea5ac1d47164650a9b857d3
46
+ 4.14.0 |checksum:99a20cc5e7b901f6b493a8ca5e13439b73b19671eaaca68a00216c4f66765edc
47
+ 4.14.1 |checksum:0fa8731445cf4a0c01570ec29aac4b50a0451ce66b1b31ad768f5035e3af7b90,ruby:~> 2.2
48
+ 4.15.0 |checksum:a5ec27d8055ad47444cfb7ce860bad8af2365772a82892f4a8a0d97e8e9e3b34,ruby:~> 2.2
49
+ 4.15.1 |checksum:9291a0f2247f50d15068ee6965b67cd7b678b0d273e18adf3c0b2ea4a890125c,ruby:< 3.1&>= 2.1
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('circular-dep1-resource')
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('circular-dep2-resource')
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('dependency1-resource')
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('dependency2-resource')
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('no-default-attr-resource')
@@ -1 +1,3 @@
1
+ unified_mode true
2
+
1
3
  LibraryLoadOrder.record('test-with-circular-deps-resource')
@@ -1 +1,2 @@
1
+ unified_mode true
1
2
  LibraryLoadOrder.record('test-with-deps-resource')
@@ -1 +1,3 @@
1
+ unified_mode true
2
+
1
3
  LibraryLoadOrder.record('test-resource')
@@ -21,7 +21,7 @@ require "spec_helper"
21
21
 
22
22
  describe Chef::Resource::RegistryKey, :windows_only do
23
23
 
24
- before (:all) do
24
+ before(:all) do
25
25
  ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root"
26
26
  ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
27
27
  ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
@@ -34,7 +34,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
34
34
  expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
35
35
  end
36
36
 
37
- def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
37
+ def valid_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
38
38
  directory = []
39
39
  if priority.is_a? Hash
40
40
  priority.each do |level, o|
@@ -129,7 +129,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
129
129
  context "when the service doesn't set a priority" do
130
130
  it "creates symlink with status S" do
131
131
  new_resource.run_action(:enable)
132
- valide_symlinks(["/etc/rc.d/rc2.d/Schefinittest"], 2, "S")
132
+ valid_symlinks(["/etc/rc.d/rc2.d/Schefinittest"], 2, "S")
133
133
  end
134
134
  end
135
135
 
@@ -140,7 +140,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
140
140
 
141
141
  it "creates a symlink with status S and a priority" do
142
142
  new_resource.run_action(:enable)
143
- valide_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2, "S", 75)
143
+ valid_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2, "S", 75)
144
144
  end
145
145
  end
146
146
 
@@ -152,7 +152,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
152
152
 
153
153
  it "create symlink with status start (S) or stop (K) and a priority " do
154
154
  new_resource.run_action(:enable)
155
- valide_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2, "S", new_resource.priority)
155
+ valid_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2, "S", new_resource.priority)
156
156
  end
157
157
  end
158
158
  end
@@ -170,7 +170,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
170
170
 
171
171
  it "creates symlink with status K" do
172
172
  new_resource.run_action(:disable)
173
- valide_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2, "K")
173
+ valid_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2, "K")
174
174
  end
175
175
  end
176
176
 
@@ -186,7 +186,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
186
186
 
187
187
  it "creates a symlink with status K and a priority" do
188
188
  new_resource.run_action(:disable)
189
- valide_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2, "K", 25)
189
+ valid_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2, "K", 25)
190
190
  end
191
191
  end
192
192
 
@@ -203,7 +203,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
203
203
 
204
204
  it "create symlink with status stop (K) and a priority " do
205
205
  new_resource.run_action(:disable)
206
- valide_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2, "K", 80)
206
+ valid_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2, "K", 80)
207
207
  end
208
208
  end
209
209
  end
@@ -186,7 +186,7 @@ describe Chef::Resource::AptPackage, metadata do
186
186
  it "raises a reasonable error for action :install" do
187
187
  expect do
188
188
  package_resource.run_action(:install)
189
- end.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
189
+ end.to raise_error(Chef::Exceptions::Package)
190
190
  end
191
191
 
192
192
  end
@@ -41,6 +41,19 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
41
41
  provider
42
42
  end
43
43
 
44
+ # This bit of magic ensures that we pass a mixed-case Path var in the env to chocolatey and not PATH
45
+ # (both ENV["PATH"] and ENV["Path"] are the same thing in ruby-on-windows, and the first created key
46
+ # is the one that is actually passed to a subprocess, and choco demands it be Path)
47
+ #
48
+ # This is not a no-op.
49
+ #
50
+ # I don't know how to tell what state we were in to begin with, so we cannot restore. Nothing else
51
+ # seems to care.
52
+ #
53
+ before(:all) do
54
+ ENV["Path"] = ENV.delete("Path")
55
+ end
56
+
44
57
  context "installing a package" do
45
58
  after { remove_package }
46
59
 
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
  require "chef/mixin/shell_out"
21
21
 
22
- describe Chef::Resource::Cron, :requires_root, :unix_only do
22
+ describe Chef::Resource::Cron, :requires_root, :unix_only, :not_macos_gte_11 do
23
23
 
24
24
  include Chef::Mixin::ShellOut
25
25
 
@@ -18,9 +18,10 @@
18
18
  require "spec_helper"
19
19
  require "chef/mixin/shell_out"
20
20
 
21
- # run this test only for following platforms.
22
- exclude_test = !(%w{rhel fedora amazon}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
21
+ # test on any fedora-ish platform with dnf
22
+ exclude_test = !(%w{rhel amazon fedora}.include?(OHAI_SYSTEM[:platform_family]) && File.exist?("/usr/bin/dnf"))
23
23
  describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
24
+ include RecipeDSLHelper
24
25
  include Chef::Mixin::ShellOut
25
26
 
26
27
  # NOTE: every single test here either needs to explicitly call flush_cache or needs to explicitly
@@ -30,7 +31,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
30
31
  def flush_cache
31
32
  # needed on at least fc23/fc24 sometimes to deal with the dnf cache getting out of sync with the rpm db
32
33
  FileUtils.rm_f "/var/cache/dnf/@System.solv"
33
- Chef::Resource::DnfPackage.new("shouldnt-matter", run_context).run_action(:flush_cache)
34
+ Chef::Provider::Package::Dnf::PythonHelper.instance.reap
34
35
  end
35
36
 
36
37
  def preinstall(*rpms)
@@ -40,11 +41,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
40
41
  flush_cache
41
42
  end
42
43
 
44
+ def expect_matching_installed_version(version)
45
+ expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(version)
46
+ end
47
+
43
48
  before(:all) do
44
49
  shell_out!("dnf -y install dnf-plugins-core")
45
50
  end
46
51
 
47
52
  before(:each) do
53
+ # force errors to fail and not retry
54
+ ENV["DNF_HELPER_NO_RETRIES"] = "true"
48
55
  File.open("/etc/yum.repos.d/chef-dnf-localtesting.repo", "w+") do |f|
49
56
  f.write <<~EOF
50
57
  [chef-dnf-localtesting]
@@ -54,6 +61,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
54
61
  gpgcheck=0
55
62
  EOF
56
63
  end
64
+ # ensure we don't have any stray chef_rpms installed
57
65
  shell_out!("rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep chef_rpm | xargs -r rpm -e")
58
66
  # next line is useful cleanup if you happen to have been testing both yum + dnf func tests on the same box and
59
67
  # have some yum garbage left around
@@ -65,64 +73,71 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
65
73
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
66
74
  end
67
75
 
68
- let(:run_context) do
69
- Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
70
- end
71
-
72
- let(:package_name) { "chef_rpm" }
73
- let(:dnf_package) { Chef::Resource::DnfPackage.new(package_name, run_context) }
76
+ let(:default_options) { "--nogpgcheck --disablerepo=* --enablerepo=chef-dnf-localtesting" }
74
77
 
75
78
  def pkg_arch
76
- ohai[:kernel][:machine]
79
+ OHAI_SYSTEM[:kernel][:machine]
77
80
  end
78
81
 
79
82
  describe ":install" do
80
83
  context "vanilla use case" do
81
- let(:package_name) { "chef_rpm" }
82
-
83
84
  it "installs if the package is not installed" do
84
85
  flush_cache
85
- dnf_package.run_action(:install)
86
- expect(dnf_package.updated_by_last_action?).to be true
86
+ dnf_package "chef_rpm" do
87
+ options default_options
88
+ action :install
89
+ end.should_be_updated
87
90
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
88
91
  end
89
92
 
90
93
  it "does not install if the package is installed" do
91
94
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
92
- dnf_package.run_action(:install)
93
- expect(dnf_package.updated_by_last_action?).to be false
95
+ dnf_package "chef_rpm" do
96
+ options default_options
97
+ action :install
98
+ end.should_not_be_updated
94
99
  end
95
100
 
96
101
  it "does not install twice" do
97
102
  flush_cache
98
- dnf_package.run_action(:install)
99
- expect(dnf_package.updated_by_last_action?).to be true
103
+ dnf_package "chef_rpm" do
104
+ options default_options
105
+ action :install
106
+ end.should_be_updated
100
107
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
101
- dnf_package.run_action(:install)
102
- expect(dnf_package.updated_by_last_action?).to be false
108
+ dnf_package "chef_rpm" do
109
+ options default_options
110
+ action :install
111
+ end.should_not_be_updated
103
112
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
104
113
  end
105
114
 
106
115
  it "does not install if the prior version package is installed" do
107
116
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
108
- dnf_package.run_action(:install)
109
- expect(dnf_package.updated_by_last_action?).to be false
117
+ dnf_package "chef_rpm" do
118
+ options default_options
119
+ action :install
120
+ end.should_not_be_updated
110
121
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
111
122
  end
112
123
 
113
124
  it "does not install if the i686 package is installed", :intel_64bit do
114
125
  skip "FIXME: do nothing, or install the #{pkg_arch} version?"
115
126
  preinstall("chef_rpm-1.10-1.i686.rpm")
116
- dnf_package.run_action(:install)
117
- expect(dnf_package.updated_by_last_action?).to be false
127
+ dnf_package "chef_rpm" do
128
+ options default_options
129
+ action :install
130
+ end.should_not_be_updated
118
131
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
119
132
  end
120
133
 
121
134
  it "does not install if the prior version i686 package is installed", :intel_64bit do
122
135
  skip "FIXME: do nothing, or install the #{pkg_arch} version?"
123
136
  preinstall("chef_rpm-1.2-1.i686.rpm")
124
- dnf_package.run_action(:install)
125
- expect(dnf_package.updated_by_last_action?).to be false
137
+ dnf_package "chef_rpm" do
138
+ options default_options
139
+ action :install
140
+ end.should_not_be_updated
126
141
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
127
142
  end
128
143
  end
@@ -131,72 +146,81 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
131
146
  %w{1.10 1* 1.10-1 1*-1 1.10-* 1*-* 0:1.10 0:1* 0:1.10-1 0:1*-1 *:1.10-* *:1*-*}.each do |vstring|
132
147
  it "installs the rpm when #{vstring} is in the package_name" do
133
148
  flush_cache
134
- dnf_package.package_name("chef_rpm-#{vstring}")
135
- dnf_package.run_action(:install)
136
- expect(dnf_package.updated_by_last_action?).to be true
149
+ dnf_package "chef_rpm-#{vstring}" do
150
+ options default_options
151
+ action :install
152
+ end.should_be_updated
137
153
  end
138
154
 
139
155
  it "is idempotent when #{vstring} is in the package_name" do
140
156
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
141
- dnf_package.package_name("chef_rpm-#{vstring}")
142
- dnf_package.run_action(:install)
143
- expect(dnf_package.updated_by_last_action?).to be false
157
+ dnf_package "chef_rpm-#{vstring}" do
158
+ options default_options
159
+ action :install
160
+ end.should_not_be_updated
144
161
  end
145
162
 
146
163
  it "installs the rpm when #{vstring} is in the version property" do
147
164
  flush_cache
148
- dnf_package.package_name("chef_rpm")
149
- dnf_package.version(vstring)
150
- dnf_package.run_action(:install)
151
- expect(dnf_package.updated_by_last_action?).to be true
165
+ dnf_package "chef_rpm" do
166
+ options default_options
167
+ version vstring
168
+ action :install
169
+ end.should_be_updated
152
170
  end
153
171
 
154
172
  it "is idempotent when #{vstring} is in the version property" do
155
173
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
156
- dnf_package.package_name("chef_rpm")
157
- dnf_package.version(vstring)
158
- dnf_package.run_action(:install)
159
- expect(dnf_package.updated_by_last_action?).to be false
174
+ dnf_package "chef_rpm" do
175
+ options default_options
176
+ version vstring
177
+ action :install
178
+ end.should_not_be_updated
160
179
  end
161
180
 
162
181
  it "upgrades the rpm when #{vstring} is in the package_name" do
163
182
  flush_cache
164
- dnf_package.package_name("chef_rpm-#{vstring}")
165
- dnf_package.run_action(:upgrade)
166
- expect(dnf_package.updated_by_last_action?).to be true
183
+ dnf_package "chef_rpm-#{vstring}" do
184
+ options default_options
185
+ action :upgrade
186
+ end.should_be_updated
167
187
  end
168
188
 
169
189
  it "is idempotent when #{vstring} is in the package_name" do
170
190
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
171
- dnf_package.package_name("chef_rpm-#{vstring}")
172
- dnf_package.run_action(:upgrade)
173
- expect(dnf_package.updated_by_last_action?).to be false
191
+ dnf_package "chef_rpm-#{vstring}" do
192
+ options default_options
193
+ action :upgrade
194
+ end.should_not_be_updated
174
195
  end
175
196
 
176
197
  it "upgrades the rpm when #{vstring} is in the version property" do
177
198
  flush_cache
178
- dnf_package.package_name("chef_rpm")
179
- dnf_package.version(vstring)
180
- dnf_package.run_action(:upgrade)
181
- expect(dnf_package.updated_by_last_action?).to be true
199
+ dnf_package "chef_rpm" do
200
+ options default_options
201
+ version vstring
202
+ action :upgrade
203
+ end.should_be_updated
182
204
  end
183
205
 
184
206
  it "is idempotent when #{vstring} is in the version property" do
185
207
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
186
- dnf_package.package_name("chef_rpm")
187
- dnf_package.version(vstring)
188
- dnf_package.run_action(:upgrade)
189
- expect(dnf_package.updated_by_last_action?).to be false
208
+ dnf_package "chef_rpm" do
209
+ options default_options
210
+ version vstring
211
+ action :upgrade
212
+ end.should_not_be_updated
190
213
  end
191
214
  end
192
215
 
193
216
  %w{1.2 1* 1.2-1 1*-1 1.2-* 1*-* 0:1.2 0:1* 0:1.2-1 0:1*-1 *:1.2-* *:1*-*}.each do |vstring|
194
217
  it "is idempotent when #{vstring} is in the version property and there is a candidate version" do
195
218
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
196
- dnf_package.package_name("chef_rpm")
197
- dnf_package.version(vstring)
198
- dnf_package.run_action(:install)
199
- expect(dnf_package.updated_by_last_action?).to be false
219
+ dnf_package "chef_rpm" do
220
+ options default_options
221
+ version vstring
222
+ action :install
223
+ end.should_not_be_updated
200
224
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
201
225
  end
202
226
  end
@@ -204,10 +228,11 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
204
228
  %w{1.2 1.2-1 1.2-* 0:1.2 0:1.2-1 *:1.2-*}.each do |vstring|
205
229
  it "is idempotent when #{vstring} is in the version property on upgrade and it doesn't match the candidate version" do
206
230
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
207
- dnf_package.package_name("chef_rpm")
208
- dnf_package.version(vstring)
209
- dnf_package.run_action(:upgrade)
210
- expect(dnf_package.updated_by_last_action?).to be false
231
+ dnf_package "chef_rpm" do
232
+ options default_options
233
+ version vstring
234
+ action :upgrade
235
+ end.should_not_be_updated
211
236
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
212
237
  end
213
238
  end
@@ -215,13 +240,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
215
240
  %w{1* 1*-1 1*-* 0:1* 0:1*-1 *:1*-*}.each do |vstring|
216
241
  it "upgrades when #{vstring} is in the version property on upgrade and it matches the candidate version" do
217
242
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
218
- dnf_package.package_name("chef_rpm")
219
- dnf_package.version(vstring)
220
- dnf_package.run_action(:upgrade)
221
- expect(dnf_package.updated_by_last_action?).to be true
243
+ dnf_package "chef_rpm" do
244
+ options default_options
245
+ version vstring
246
+ action :upgrade
247
+ end.should_be_updated
222
248
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
223
- dnf_package.run_action(:upgrade)
224
- expect(dnf_package.updated_by_last_action?).to be false
249
+ dnf_package "chef_rpm" do
250
+ options default_options
251
+ version vstring
252
+ action :upgrade
253
+ end.should_not_be_updated
225
254
  end
226
255
  end
227
256
  end
@@ -229,82 +258,106 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
229
258
  context "with versions or globs in the name" do
230
259
  it "works with a version" do
231
260
  flush_cache
232
- dnf_package.package_name("chef_rpm-1.10")
233
- dnf_package.run_action(:install)
234
- expect(dnf_package.updated_by_last_action?).to be true
261
+ dnf_package "chef_rpm-1.10" do
262
+ options default_options
263
+ action :install
264
+ end.should_be_updated
235
265
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
236
- dnf_package.run_action(:install)
237
- expect(dnf_package.updated_by_last_action?).to be false
266
+ dnf_package "chef_rpm-1.10" do
267
+ options default_options
268
+ action :install
269
+ end.should_not_be_updated
238
270
  end
239
271
 
240
272
  it "works with an older version" do
241
273
  flush_cache
242
- dnf_package.package_name("chef_rpm-1.2")
243
- dnf_package.run_action(:install)
244
- expect(dnf_package.updated_by_last_action?).to be true
274
+ dnf_package "chef_rpm-1.2" do
275
+ options default_options
276
+ action :install
277
+ end.should_be_updated
245
278
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
246
- dnf_package.run_action(:install)
247
- expect(dnf_package.updated_by_last_action?).to be false
279
+ dnf_package "chef_rpm-1.2" do
280
+ options default_options
281
+ action :install
282
+ end.should_not_be_updated
248
283
  end
249
284
 
250
285
  it "works with an evra" do
251
286
  flush_cache
252
- dnf_package.package_name("chef_rpm-0:1.2-1.#{pkg_arch}")
253
- dnf_package.run_action(:install)
254
- expect(dnf_package.updated_by_last_action?).to be true
287
+ dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
288
+ options default_options
289
+ action :install
290
+ end.should_be_updated
255
291
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
256
- dnf_package.run_action(:install)
257
- expect(dnf_package.updated_by_last_action?).to be false
292
+ dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
293
+ options default_options
294
+ action :install
295
+ end.should_not_be_updated
258
296
  end
259
297
 
260
298
  it "works with version and release" do
261
299
  flush_cache
262
- dnf_package.package_name("chef_rpm-1.2-1")
263
- dnf_package.run_action(:install)
264
- expect(dnf_package.updated_by_last_action?).to be true
300
+ dnf_package "chef_rpm-1.2-1" do
301
+ options default_options
302
+ action :install
303
+ end.should_be_updated
265
304
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
266
- dnf_package.run_action(:install)
267
- expect(dnf_package.updated_by_last_action?).to be false
305
+ dnf_package "chef_rpm-1.2-1" do
306
+ options default_options
307
+ action :install
308
+ end.should_not_be_updated
268
309
  end
269
310
 
270
311
  it "works with a version glob" do
271
312
  flush_cache
272
- dnf_package.package_name("chef_rpm-1*")
273
- dnf_package.run_action(:install)
274
- expect(dnf_package.updated_by_last_action?).to be true
313
+ dnf_package "chef_rpm-1*" do
314
+ options default_options
315
+ action :install
316
+ end.should_be_updated
275
317
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
276
- dnf_package.run_action(:install)
277
- expect(dnf_package.updated_by_last_action?).to be false
318
+ dnf_package "chef_rpm-1*" do
319
+ options default_options
320
+ action :install
321
+ end.should_not_be_updated
278
322
  end
279
323
 
280
324
  it "works with a name glob + version glob" do
281
325
  flush_cache
282
- dnf_package.package_name("chef_rp*-1*")
283
- dnf_package.run_action(:install)
284
- expect(dnf_package.updated_by_last_action?).to be true
326
+ dnf_package "chef_rp*-1*" do
327
+ options default_options
328
+ action :install
329
+ end.should_be_updated
285
330
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
286
- dnf_package.run_action(:install)
287
- expect(dnf_package.updated_by_last_action?).to be false
331
+ dnf_package "chef_rp*-1*" do
332
+ options default_options
333
+ action :install
334
+ end.should_not_be_updated
288
335
  end
289
336
 
290
337
  it "upgrades when the installed version does not match the version string" do
291
338
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
292
- dnf_package.package_name("chef_rpm-1.10")
293
- dnf_package.run_action(:install)
294
- expect(dnf_package.updated_by_last_action?).to be true
339
+ dnf_package "chef_rpm-1.10" do
340
+ options default_options
341
+ action :install
342
+ end.should_be_updated
295
343
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}")
296
- dnf_package.run_action(:install)
297
- expect(dnf_package.updated_by_last_action?).to be false
344
+ dnf_package "chef_rpm-1.10" do
345
+ options default_options
346
+ action :install
347
+ end.should_not_be_updated
298
348
  end
299
349
 
300
350
  it "downgrades when the installed version is higher than the package_name version" do
301
351
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
302
- dnf_package.package_name("chef_rpm-1.2")
303
- dnf_package.run_action(:install)
304
- expect(dnf_package.updated_by_last_action?).to be true
352
+ dnf_package "chef_rpm-1.2" do
353
+ options default_options
354
+ action :install
355
+ end.should_be_updated
305
356
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
306
- dnf_package.run_action(:install)
307
- expect(dnf_package.updated_by_last_action?).to be false
357
+ dnf_package "chef_rpm-1.2" do
358
+ options default_options
359
+ action :install
360
+ end.should_not_be_updated
308
361
  end
309
362
  end
310
363
 
@@ -312,68 +365,92 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
312
365
  context "with version property" do
313
366
  it "matches the full version" do
314
367
  flush_cache
315
- dnf_package.package_name("chef_rpm")
316
- dnf_package.version("1.10")
317
- dnf_package.run_action(:install)
318
- expect(dnf_package.updated_by_last_action?).to be true
368
+ dnf_package "chef_rpm" do
369
+ options default_options
370
+ version "1.10"
371
+ action :install
372
+ end.should_be_updated
319
373
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
320
- dnf_package.run_action(:install)
321
- expect(dnf_package.updated_by_last_action?).to be false
374
+ dnf_package "chef_rpm" do
375
+ options default_options
376
+ version "1.10"
377
+ action :install
378
+ end.should_not_be_updated
322
379
  end
323
380
 
324
381
  it "matches with a glob" do
325
382
  flush_cache
326
- dnf_package.package_name("chef_rpm")
327
- dnf_package.version("1*")
328
- dnf_package.run_action(:install)
329
- expect(dnf_package.updated_by_last_action?).to be true
383
+ dnf_package "chef_rpm" do
384
+ options default_options
385
+ version "1*"
386
+ action :install
387
+ end.should_be_updated
330
388
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
331
- dnf_package.run_action(:install)
332
- expect(dnf_package.updated_by_last_action?).to be false
389
+ dnf_package "chef_rpm" do
390
+ options default_options
391
+ version "1*"
392
+ action :install
393
+ end.should_not_be_updated
333
394
  end
334
395
 
335
396
  it "matches the vr" do
336
397
  flush_cache
337
- dnf_package.package_name("chef_rpm")
338
- dnf_package.version("1.10-1")
339
- dnf_package.run_action(:install)
340
- expect(dnf_package.updated_by_last_action?).to be true
398
+ dnf_package "chef_rpm" do
399
+ options default_options
400
+ version "1.10-1"
401
+ action :install
402
+ end.should_be_updated
341
403
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
342
- dnf_package.run_action(:install)
343
- expect(dnf_package.updated_by_last_action?).to be false
404
+ dnf_package "chef_rpm" do
405
+ options default_options
406
+ version "1.10-1"
407
+ action :install
408
+ end.should_not_be_updated
344
409
  end
345
410
 
346
411
  it "matches the evr" do
347
412
  flush_cache
348
- dnf_package.package_name("chef_rpm")
349
- dnf_package.version("0:1.10-1")
350
- dnf_package.run_action(:install)
351
- expect(dnf_package.updated_by_last_action?).to be true
413
+ dnf_package "chef_rpm" do
414
+ options default_options
415
+ version "0:1.10-1"
416
+ action :install
417
+ end.should_be_updated
352
418
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
353
- dnf_package.run_action(:install)
354
- expect(dnf_package.updated_by_last_action?).to be false
419
+ dnf_package "chef_rpm" do
420
+ options default_options
421
+ version "0:1.10-1"
422
+ action :install
423
+ end.should_not_be_updated
355
424
  end
356
425
 
357
426
  it "matches with a vr glob", :rhel_gte_8 do
358
427
  flush_cache
359
- dnf_package.package_name("chef_rpm")
360
- dnf_package.version("1.10-1*")
361
- dnf_package.run_action(:install)
362
- expect(dnf_package.updated_by_last_action?).to be true
428
+ dnf_package "chef_rpm" do
429
+ options default_options
430
+ version "1.10-1*"
431
+ action :install
432
+ end.should_be_updated
363
433
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
364
- dnf_package.run_action(:install)
365
- expect(dnf_package.updated_by_last_action?).to be false
434
+ dnf_package "chef_rpm" do
435
+ options default_options
436
+ version "1.10-1*"
437
+ action :install
438
+ end.should_not_be_updated
366
439
  end
367
440
 
368
441
  it "matches with an evr glob", :rhel_gte_8 do
369
442
  flush_cache
370
- dnf_package.package_name("chef_rpm")
371
- dnf_package.version("0:1.10-1*")
372
- dnf_package.run_action(:install)
373
- expect(dnf_package.updated_by_last_action?).to be true
443
+ dnf_package "chef_rpm" do
444
+ options default_options
445
+ version "0:1.10-1*"
446
+ action :install
447
+ end.should_be_updated
374
448
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
375
- dnf_package.run_action(:install)
376
- expect(dnf_package.updated_by_last_action?).to be false
449
+ dnf_package "chef_rpm" do
450
+ options default_options
451
+ version "0:1.10-1*"
452
+ action :install
453
+ end.should_not_be_updated
377
454
  end
378
455
  end
379
456
 
@@ -381,274 +458,345 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
381
458
  it "downgrades the package when allow_downgrade" do
382
459
  flush_cache
383
460
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
384
- dnf_package.package_name("chef_rpm")
385
- dnf_package.version("1.2-1")
386
- dnf_package.run_action(:install)
387
- expect(dnf_package.updated_by_last_action?).to be true
461
+ dnf_package "chef_rpm" do
462
+ options default_options
463
+ version "1.2-1"
464
+ action :install
465
+ end.should_be_updated
388
466
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
389
- dnf_package.run_action(:install)
390
- expect(dnf_package.updated_by_last_action?).to be false
467
+ dnf_package "chef_rpm" do
468
+ options default_options
469
+ version "1.2-1"
470
+ action :install
471
+ end.should_not_be_updated
391
472
  end
392
473
  end
393
474
 
394
475
  context "with arches", :intel_64bit do
395
476
  it "installs with 64-bit arch in the name" do
396
477
  flush_cache
397
- dnf_package.package_name("chef_rpm.#{pkg_arch}")
398
- dnf_package.run_action(:install)
399
- expect(dnf_package.updated_by_last_action?).to be true
478
+ dnf_package "chef_rpm.#{pkg_arch}" do
479
+ options default_options
480
+ action :install
481
+ end.should_be_updated
400
482
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
401
- dnf_package.run_action(:install)
402
- expect(dnf_package.updated_by_last_action?).to be false
483
+ dnf_package "chef_rpm.#{pkg_arch}" do
484
+ options default_options
485
+ action :install
486
+ end.should_not_be_updated
403
487
  end
404
488
 
405
489
  it "installs with 32-bit arch in the name" do
406
490
  flush_cache
407
- dnf_package.package_name("chef_rpm.i686")
408
- dnf_package.run_action(:install)
409
- expect(dnf_package.updated_by_last_action?).to be true
491
+ dnf_package "chef_rpm.i686" do
492
+ options default_options
493
+ action :install
494
+ end.should_be_updated
410
495
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
411
- dnf_package.run_action(:install)
412
- expect(dnf_package.updated_by_last_action?).to be false
496
+ dnf_package "chef_rpm.i686" do
497
+ options default_options
498
+ action :install
499
+ end.should_not_be_updated
413
500
  end
414
501
 
415
502
  it "installs with 64-bit arch in the property" do
416
503
  flush_cache
417
- dnf_package.package_name("chef_rpm")
418
- dnf_package.arch((pkg_arch).to_s)
419
- dnf_package.run_action(:install)
420
- expect(dnf_package.updated_by_last_action?).to be true
504
+ dnf_package "chef_rpm" do
505
+ options default_options
506
+ arch pkg_arch
507
+ action :install
508
+ end.should_be_updated
421
509
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
422
- dnf_package.run_action(:install)
423
- expect(dnf_package.updated_by_last_action?).to be false
510
+ dnf_package "chef_rpm" do
511
+ options default_options
512
+ arch pkg_arch
513
+ action :install
514
+ end.should_not_be_updated
424
515
  end
425
516
 
426
517
  it "installs with 32-bit arch in the property" do
427
518
  flush_cache
428
- dnf_package.package_name("chef_rpm")
429
- dnf_package.arch("i686")
430
- dnf_package.run_action(:install)
431
- expect(dnf_package.updated_by_last_action?).to be true
519
+ dnf_package "chef_rpm" do
520
+ options default_options
521
+ arch "i686"
522
+ action :install
523
+ end.should_be_updated
432
524
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
433
- dnf_package.run_action(:install)
434
- expect(dnf_package.updated_by_last_action?).to be false
525
+ dnf_package "chef_rpm" do
526
+ options default_options
527
+ arch "i686"
528
+ action :install
529
+ end.should_not_be_updated
435
530
  end
436
531
 
437
532
  it "installs when the 32-bit arch is in the name and the version is in the property" do
438
533
  flush_cache
439
- dnf_package.package_name("chef_rpm.i686")
440
- dnf_package.version("1.10-1")
441
- dnf_package.run_action(:install)
442
- expect(dnf_package.updated_by_last_action?).to be true
534
+ dnf_package "chef_rpm.i686" do
535
+ options default_options
536
+ version "1.10-1"
537
+ action :install
538
+ end.should_be_updated
443
539
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
444
- dnf_package.run_action(:install)
445
- expect(dnf_package.updated_by_last_action?).to be false
540
+ dnf_package "chef_rpm.i686" do
541
+ options default_options
542
+ version "1.10-1"
543
+ action :install
544
+ end.should_not_be_updated
446
545
  end
447
546
 
448
547
  it "installs when the 64-bit arch is in the name and the version is in the property" do
449
548
  flush_cache
450
- dnf_package.package_name("chef_rpm.#{pkg_arch}")
451
- dnf_package.version("1.10-1")
452
- dnf_package.run_action(:install)
453
- expect(dnf_package.updated_by_last_action?).to be true
549
+ dnf_package "chef_rpm.#{pkg_arch}" do
550
+ options default_options
551
+ version "1.10-1"
552
+ action :install
553
+ end.should_be_updated
454
554
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
455
- dnf_package.run_action(:install)
456
- expect(dnf_package.updated_by_last_action?).to be false
555
+ dnf_package "chef_rpm.#{pkg_arch}" do
556
+ options default_options
557
+ version "1.10-1"
558
+ action :install
559
+ end.should_not_be_updated
457
560
  end
458
561
  end
459
562
 
460
563
  context "with constraints" do
461
564
  it "with nothing installed, it installs the latest version" do
462
565
  flush_cache
463
- dnf_package.package_name("chef_rpm >= 1.2")
464
- dnf_package.run_action(:install)
465
- expect(dnf_package.updated_by_last_action?).to be true
566
+ dnf_package "chef_rpm >= 1.2" do
567
+ options default_options
568
+ action :install
569
+ end.should_be_updated
466
570
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
467
- dnf_package.run_action(:install)
468
- expect(dnf_package.updated_by_last_action?).to be false
571
+ dnf_package "chef_rpm >= 1.2" do
572
+ options default_options
573
+ action :install
574
+ end.should_not_be_updated
469
575
  end
470
576
 
471
577
  it "when it is met, it does nothing" do
472
578
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
473
- dnf_package.package_name("chef_rpm >= 1.2")
474
- dnf_package.run_action(:install)
475
- expect(dnf_package.updated_by_last_action?).to be false
579
+ dnf_package "chef_rpm >= 1.2" do
580
+ options default_options
581
+ action :install
582
+ end.should_not_be_updated
476
583
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
477
584
  end
478
585
 
479
586
  it "when it is met, it does nothing" do
480
587
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
481
- dnf_package.package_name("chef_rpm >= 1.2")
482
- dnf_package.run_action(:install)
483
- expect(dnf_package.updated_by_last_action?).to be false
588
+ dnf_package "chef_rpm >= 1.2" do
589
+ options default_options
590
+ action :install
591
+ end.should_not_be_updated
484
592
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
485
593
  end
486
594
 
487
595
  it "with nothing installed, it installs the latest version" do
488
596
  flush_cache
489
- dnf_package.package_name("chef_rpm > 1.2")
490
- dnf_package.run_action(:install)
491
- expect(dnf_package.updated_by_last_action?).to be true
597
+ dnf_package "chef_rpm > 1.2" do
598
+ options default_options
599
+ action :install
600
+ end.should_be_updated
492
601
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
493
- dnf_package.run_action(:install)
494
- expect(dnf_package.updated_by_last_action?).to be false
602
+ dnf_package "chef_rpm > 1.2" do
603
+ options default_options
604
+ action :install
605
+ end.should_not_be_updated
495
606
  end
496
607
 
497
608
  it "when it is not met by an installed rpm, it upgrades" do
498
609
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
499
- dnf_package.package_name("chef_rpm > 1.2")
500
- dnf_package.run_action(:install)
501
- expect(dnf_package.updated_by_last_action?).to be true
610
+ dnf_package "chef_rpm > 1.2" do
611
+ options default_options
612
+ action :install
613
+ end.should_be_updated
502
614
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
503
- dnf_package.run_action(:install)
504
- expect(dnf_package.updated_by_last_action?).to be false
615
+ dnf_package "chef_rpm > 1.2" do
616
+ options default_options
617
+ action :install
618
+ end.should_not_be_updated
505
619
  end
506
620
 
507
621
  it "with an equality constraint, when it is not met by an installed rpm, it upgrades" do
508
622
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
509
- dnf_package.package_name("chef_rpm = 1.10")
510
- dnf_package.run_action(:install)
511
- expect(dnf_package.updated_by_last_action?).to be true
623
+ dnf_package "chef_rpm = 1.10" do
624
+ options default_options
625
+ action :install
626
+ end.should_be_updated
512
627
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
513
- dnf_package.run_action(:install)
514
- expect(dnf_package.updated_by_last_action?).to be false
628
+ dnf_package "chef_rpm = 1.10" do
629
+ options default_options
630
+ action :install
631
+ end.should_not_be_updated
515
632
  end
516
633
 
517
634
  it "with an equality constraint, when it is met by an installed rpm, it does nothing" do
518
635
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
519
- dnf_package.package_name("chef_rpm = 1.2")
520
- dnf_package.run_action(:install)
521
- expect(dnf_package.updated_by_last_action?).to be false
636
+ dnf_package "chef_rpm = 1.2" do
637
+ options default_options
638
+ action :install
639
+ end.should_not_be_updated
522
640
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
523
641
  end
524
642
 
525
643
  it "when it is met by an installed rpm, it does nothing" do
526
644
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
527
- dnf_package.package_name("chef_rpm > 1.2")
528
- dnf_package.run_action(:install)
529
- expect(dnf_package.updated_by_last_action?).to be false
645
+ dnf_package "chef_rpm > 1.2" do
646
+ options default_options
647
+ action :install
648
+ end.should_not_be_updated
530
649
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
531
650
  end
532
651
 
533
652
  it "when there is no solution to the contraint" do
534
653
  flush_cache
535
- dnf_package.package_name("chef_rpm > 2.0")
536
- expect { dnf_package.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
654
+ expect {
655
+ dnf_package "chef_rpm > 2.0"
656
+ }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
537
657
  end
538
658
 
539
659
  it "when there is no solution to the contraint but an rpm is preinstalled" do
540
660
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
541
- dnf_package.package_name("chef_rpm > 2.0")
542
- expect { dnf_package.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
661
+ expect {
662
+ dnf_package "chef_rpm > 2.0"
663
+ }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
543
664
  end
544
665
 
545
666
  it "with a less than constraint, when nothing is installed, it installs" do
546
667
  flush_cache
547
- dnf_package.package_name("chef_rpm < 1.10")
548
- dnf_package.run_action(:install)
549
- expect(dnf_package.updated_by_last_action?).to be true
668
+ dnf_package "chef_rpm < 1.10" do
669
+ options default_options
670
+ action :install
671
+ end.should_be_updated
550
672
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
551
- dnf_package.run_action(:install)
552
- expect(dnf_package.updated_by_last_action?).to be false
673
+ dnf_package "chef_rpm < 1.10" do
674
+ options default_options
675
+ action :install
676
+ end.should_not_be_updated
553
677
  end
554
678
 
555
679
  it "with a less than constraint, when the install version matches, it does nothing" do
556
680
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
557
- dnf_package.package_name("chef_rpm < 1.10")
558
- dnf_package.run_action(:install)
559
- expect(dnf_package.updated_by_last_action?).to be false
681
+ dnf_package "chef_rpm < 1.10" do
682
+ options default_options
683
+ action :install
684
+ end.should_not_be_updated
560
685
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
561
686
  end
562
687
 
563
688
  it "with a less than constraint, when the install version fails, it should downgrade" do
564
689
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
565
- dnf_package.package_name("chef_rpm < 1.10")
566
- dnf_package.run_action(:install)
567
- expect(dnf_package.updated_by_last_action?).to be true
690
+ dnf_package "chef_rpm < 1.10" do
691
+ options default_options
692
+ action :install
693
+ end.should_be_updated
568
694
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
569
- dnf_package.run_action(:install)
570
- expect(dnf_package.updated_by_last_action?).to be false
695
+ dnf_package "chef_rpm < 1.10" do
696
+ options default_options
697
+ action :install
698
+ end.should_not_be_updated
571
699
  end
572
700
  end
573
701
 
574
702
  context "with source arguments" do
575
703
  it "raises an exception when the package does not exist" do
576
704
  flush_cache
577
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm")
578
- expect { dnf_package.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
705
+ expect {
706
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm"
707
+ }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
579
708
  end
580
709
 
581
710
  it "does not raise a hard exception in why-run mode when the package does not exist" do
582
711
  Chef::Config[:why_run] = true
583
712
  flush_cache
584
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm")
585
- dnf_package.run_action(:install)
586
- expect { dnf_package.run_action(:install) }.not_to raise_error
713
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm" do
714
+ options default_options
715
+ action :install
716
+ end
587
717
  end
588
718
 
589
719
  it "installs the package when using the source argument" do
590
720
  flush_cache
591
- dnf_package.name "something"
592
- dnf_package.package_name "somethingelse"
593
- dnf_package.source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
594
- dnf_package.run_action(:install)
595
- expect(dnf_package.updated_by_last_action?).to be true
721
+ dnf_package "something" do
722
+ source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
723
+ options default_options
724
+ package_name "somethingelse"
725
+ name "something"
726
+ action :install
727
+ end.should_be_updated
596
728
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
597
- dnf_package.run_action(:install)
598
- expect(dnf_package.updated_by_last_action?).to be false
729
+ dnf_package "something" do
730
+ source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
731
+ options default_options
732
+ package_name "somethingelse"
733
+ name "something"
734
+ action :install
735
+ end.should_not_be_updated
599
736
  end
600
737
 
601
738
  it "installs the package when the name is a path to a file" do
602
739
  flush_cache
603
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
604
- dnf_package.run_action(:install)
605
- expect(dnf_package.updated_by_last_action?).to be true
740
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
741
+ options default_options
742
+ action :install
743
+ end.should_be_updated
606
744
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
607
- dnf_package.run_action(:install)
608
- expect(dnf_package.updated_by_last_action?).to be false
745
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
746
+ options default_options
747
+ action :install
748
+ end.should_not_be_updated
609
749
  end
610
750
 
611
751
  it "downgrade on a local file with allow_downgrade true works" do
612
752
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
613
- dnf_package.version "1.2-1"
614
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
615
- dnf_package.run_action(:install)
616
- expect(dnf_package.updated_by_last_action?).to be true
753
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
754
+ options default_options
755
+ version "1.2-1"
756
+ action :install
757
+ end.should_be_updated
617
758
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
618
- dnf_package.run_action(:install)
619
- expect(dnf_package.updated_by_last_action?).to be false
759
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
760
+ options default_options
761
+ version "1.2-1"
762
+ action :install
763
+ end.should_not_be_updated
620
764
  end
621
765
 
622
766
  it "does not downgrade the package with :install" do
623
767
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
624
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
625
- dnf_package.run_action(:install)
626
- expect(dnf_package.updated_by_last_action?).to be false
768
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
769
+ options default_options
770
+ action :install
771
+ end.should_not_be_updated
627
772
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
628
773
  end
629
774
 
630
775
  it "does not upgrade the package with :install" do
631
776
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
632
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm")
633
- dnf_package.run_action(:install)
634
- expect(dnf_package.updated_by_last_action?).to be false
777
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
778
+ options default_options
779
+ action :install
780
+ end.should_not_be_updated
635
781
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
636
782
  end
637
783
 
638
784
  it "is idempotent when the package is already installed" do
639
785
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
640
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
641
- dnf_package.run_action(:install)
642
- expect(dnf_package.updated_by_last_action?).to be false
786
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
787
+ options default_options
788
+ action :install
789
+ end.should_not_be_updated
643
790
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
644
791
  end
645
792
 
646
793
  it "is idempotent when the package is already installed and there is a version string" do
647
794
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
648
- dnf_package.version "1.2-1"
649
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
650
- dnf_package.run_action(:install)
651
- expect(dnf_package.updated_by_last_action?).to be false
795
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
796
+ options default_options
797
+ version "1.2-1"
798
+ action :install
799
+ end.should_not_be_updated
652
800
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
653
801
  end
654
802
  end
@@ -657,142 +805,183 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
657
805
  it "works when a package is installed" do
658
806
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
659
807
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
660
- dnf_package.run_action(:install)
661
- expect(dnf_package.updated_by_last_action?).to be false
808
+ dnf_package "chef_rpm" do
809
+ options "--nogpgcheck --disablerepo=*"
810
+ action :install
811
+ end.should_not_be_updated
662
812
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
663
813
  end
664
814
 
665
815
  it "works with a local source" do
666
816
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
667
817
  flush_cache
668
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
669
- dnf_package.run_action(:install)
670
- expect(dnf_package.updated_by_last_action?).to be true
818
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
819
+ options "--nogpgcheck --disablerepo=*"
820
+ action :install
821
+ end.should_be_updated
671
822
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
672
- dnf_package.run_action(:install)
673
- expect(dnf_package.updated_by_last_action?).to be false
823
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
824
+ options "--nogpgcheck --disablerepo=*"
825
+ action :install
826
+ end.should_not_be_updated
674
827
  end
675
828
  end
676
829
 
677
830
  context "multipackage with arches", :intel_64bit do
678
831
  it "installs two rpms" do
679
832
  flush_cache
680
- dnf_package.package_name([ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] )
681
- dnf_package.run_action(:install)
682
- expect(dnf_package.updated_by_last_action?).to be true
833
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
834
+ options default_options
835
+ action :install
836
+ end.should_be_updated
683
837
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
684
838
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
685
- dnf_package.run_action(:install)
686
- expect(dnf_package.updated_by_last_action?).to be false
839
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
840
+ options default_options
841
+ action :install
842
+ end.should_not_be_updated
687
843
  end
688
844
 
689
845
  it "does nothing if both are installed" do
690
846
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
691
847
  flush_cache
692
- dnf_package.package_name([ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] )
693
- dnf_package.run_action(:install)
694
- expect(dnf_package.updated_by_last_action?).to be false
848
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
849
+ options default_options
850
+ action :install
851
+ end.should_not_be_updated
695
852
  end
696
853
 
697
854
  it "installs the second rpm if the first is installed" do
698
855
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
699
- dnf_package.package_name([ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] )
700
- dnf_package.run_action(:install)
701
- expect(dnf_package.updated_by_last_action?).to be true
856
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
857
+ options default_options
858
+ action :install
859
+ end.should_be_updated
702
860
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
703
861
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
704
- dnf_package.run_action(:install)
705
- expect(dnf_package.updated_by_last_action?).to be false
862
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
863
+ options default_options
864
+ action :install
865
+ end.should_not_be_updated
706
866
  end
707
867
 
708
868
  it "installs the first rpm if the second is installed" do
709
869
  preinstall("chef_rpm-1.10-1.i686.rpm")
710
- dnf_package.package_name([ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] )
711
- dnf_package.run_action(:install)
712
- expect(dnf_package.updated_by_last_action?).to be true
870
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
871
+ options default_options
872
+ action :install
873
+ end.should_be_updated
713
874
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
714
875
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
715
- dnf_package.run_action(:install)
716
- expect(dnf_package.updated_by_last_action?).to be false
876
+ dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
877
+ options default_options
878
+ action :install
879
+ end.should_not_be_updated
717
880
  end
718
881
 
719
882
  # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
720
883
  it "installs two rpms with multi-arch" do
721
884
  flush_cache
722
- dnf_package.package_name(%w{chef_rpm chef_rpm} )
723
- dnf_package.arch([pkg_arch, "i686"])
724
- dnf_package.run_action(:install)
725
- expect(dnf_package.updated_by_last_action?).to be true
885
+ dnf_package %w{chef_rpm chef_rpm} do
886
+ options default_options
887
+ arch [pkg_arch, "i686"]
888
+ action :install
889
+ end.should_be_updated
726
890
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
727
891
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
728
- dnf_package.run_action(:install)
729
- expect(dnf_package.updated_by_last_action?).to be false
892
+ dnf_package %w{chef_rpm chef_rpm} do
893
+ options default_options
894
+ arch [pkg_arch, "i686"]
895
+ action :install
896
+ end.should_not_be_updated
730
897
  end
731
898
 
732
899
  # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
733
900
  it "installs the second rpm if the first is installed (muti-arch)" do
734
901
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
735
- dnf_package.package_name(%w{chef_rpm chef_rpm} )
736
- dnf_package.arch([pkg_arch, "i686"])
737
- dnf_package.run_action(:install)
738
- expect(dnf_package.updated_by_last_action?).to be true
902
+ dnf_package %w{chef_rpm chef_rpm} do
903
+ options default_options
904
+ arch [pkg_arch, "i686"]
905
+ action :install
906
+ end.should_be_updated
739
907
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
740
908
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
741
- dnf_package.run_action(:install)
742
- expect(dnf_package.updated_by_last_action?).to be false
909
+ dnf_package %w{chef_rpm chef_rpm} do
910
+ options default_options
911
+ action :install
912
+ end.should_not_be_updated
743
913
  end
744
914
 
745
915
  # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
746
916
  it "installs the first rpm if the second is installed (muti-arch)" do
747
917
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
748
- dnf_package.package_name(%w{chef_rpm chef_rpm} )
749
- dnf_package.arch([pkg_arch, "i686"])
750
- dnf_package.run_action(:install)
751
- expect(dnf_package.updated_by_last_action?).to be true
918
+ dnf_package %w{chef_rpm chef_rpm} do
919
+ options default_options
920
+ arch [pkg_arch, "i686"]
921
+ action :install
922
+ end.should_be_updated
752
923
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
753
924
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
754
- dnf_package.run_action(:install)
755
- expect(dnf_package.updated_by_last_action?).to be false
925
+ dnf_package %w{chef_rpm chef_rpm} do
926
+ options default_options
927
+ action :install
928
+ end.should_not_be_updated
756
929
  end
757
930
 
758
931
  # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
759
932
  it "does nothing if both are installed (muti-arch)" do
760
933
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
761
- dnf_package.package_name(%w{chef_rpm chef_rpm} )
762
- dnf_package.arch([pkg_arch, "i686"])
763
- dnf_package.run_action(:install)
764
- expect(dnf_package.updated_by_last_action?).to be false
934
+ dnf_package %w{chef_rpm chef_rpm} do
935
+ options default_options
936
+ arch [pkg_arch, "i686"]
937
+ action :install
938
+ end.should_not_be_updated
765
939
  end
766
940
  end
767
941
 
768
942
  context "repo controls" do
769
943
  it "should fail with the repo disabled" do
770
944
  flush_cache
771
- dnf_package.options("--disablerepo=chef-dnf-localtesting")
772
- expect { dnf_package.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
945
+ expect {
946
+ dnf_package "chef_rpm" do
947
+ options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
948
+ action :install
949
+ end
950
+ }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
773
951
  end
774
952
 
775
953
  it "should work with disablerepo first" do
776
954
  flush_cache
777
- dnf_package.options(["--disablerepo=*", "--enablerepo=chef-dnf-localtesting"])
778
- dnf_package.run_action(:install)
779
- expect(dnf_package.updated_by_last_action?).to be true
955
+ dnf_package "chef_rpm" do
956
+ options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
957
+ action :install
958
+ end.should_be_updated
780
959
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
781
- dnf_package.run_action(:install)
782
- expect(dnf_package.updated_by_last_action?).to be false
960
+ dnf_package "chef_rpm" do
961
+ options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
962
+ action :install
963
+ end.should_not_be_updated
783
964
  end
784
965
 
785
966
  it "should work to enable a disabled repo" do
786
967
  shell_out!("dnf config-manager --set-disabled chef-dnf-localtesting")
787
968
  flush_cache
788
- expect { dnf_package.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
969
+ expect {
970
+ dnf_package "chef_rpm" do
971
+ options "--nogpgcheck"
972
+ action :install
973
+ end
974
+ }.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
789
975
  flush_cache
790
- dnf_package.options("--enablerepo=chef-dnf-localtesting")
791
- dnf_package.run_action(:install)
792
- expect(dnf_package.updated_by_last_action?).to be true
976
+ dnf_package "chef_rpm" do
977
+ options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
978
+ action :install
979
+ end.should_be_updated
793
980
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
794
- dnf_package.run_action(:install)
795
- expect(dnf_package.updated_by_last_action?).to be false
981
+ dnf_package "chef_rpm" do
982
+ options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
983
+ action :install
984
+ end.should_not_be_updated
796
985
  end
797
986
 
798
987
  it "when an idempotent install action is run, does not leave repos disabled" do
@@ -802,19 +991,22 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
802
991
  # accomplishes both those goals (it would be easier if we had other rpms in this repo, but with
803
992
  # one rpm we need to do this).
804
993
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
805
- dnf_package.options("--disablerepo=chef-dnf-localtesting")
806
- dnf_package.run_action(:upgrade)
807
- expect(dnf_package.updated_by_last_action?).to be false
994
+ dnf_package "chef_rpm" do
995
+ options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
996
+ action :upgrade
997
+ end.should_not_be_updated
808
998
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
809
999
  # now we're still using the same cache in the dnf_helper.py cache and we test to see if the
810
1000
  # repo that we temporarily disabled is enabled on this pass.
811
- dnf_package.package_name("chef_rpm-1.10-1.#{pkg_arch}")
812
- dnf_package.options(nil)
813
- dnf_package.run_action(:install)
814
- expect(dnf_package.updated_by_last_action?).to be true
1001
+ dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
1002
+ options "--nogpgcheck"
1003
+ action :install
1004
+ end.should_be_updated
815
1005
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
816
- dnf_package.run_action(:install)
817
- expect(dnf_package.updated_by_last_action?).to be false
1006
+ dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
1007
+ options "--nogpgcheck"
1008
+ action :install
1009
+ end.should_not_be_updated
818
1010
  end
819
1011
  end
820
1012
  end
@@ -823,76 +1015,102 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
823
1015
  context "downgrades" do
824
1016
  it "just work with DNF" do
825
1017
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
826
- dnf_package.version("1.2")
827
- dnf_package.run_action(:install)
828
- expect(dnf_package.updated_by_last_action?).to be true
1018
+ dnf_package "chef_rpm" do
1019
+ options default_options
1020
+ version "1.2"
1021
+ action :install
1022
+ end.should_be_updated
829
1023
  expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
830
- dnf_package.run_action(:install)
831
- expect(dnf_package.updated_by_last_action?).to be false
1024
+ dnf_package "chef_rpm" do
1025
+ options default_options
1026
+ version "1.2"
1027
+ action :install
1028
+ end.should_not_be_updated
832
1029
  end
833
1030
 
834
1031
  it "throws a deprecation warning with allow_downgrade" do
835
1032
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
836
- expect(Chef).to receive(:deprecated).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
1033
+ expect(Chef).to receive(:deprecated).at_least(:once).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
837
1034
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
838
- dnf_package.version("1.2")
839
- dnf_package.allow_downgrade true
840
- dnf_package.run_action(:install)
841
- expect(dnf_package.updated_by_last_action?).to be true
1035
+ dnf_package "chef_rpm" do
1036
+ options default_options
1037
+ version "1.2"
1038
+ allow_downgrade true
1039
+ action :install
1040
+ end.should_be_updated
842
1041
  expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
843
- dnf_package.run_action(:install)
844
- expect(dnf_package.updated_by_last_action?).to be false
1042
+ dnf_package "chef_rpm" do
1043
+ options default_options
1044
+ version "1.2"
1045
+ allow_downgrade true
1046
+ action :install
1047
+ end.should_not_be_updated
845
1048
  end
846
1049
  end
847
1050
 
848
1051
  context "with source arguments" do
849
1052
  it "installs the package when using the source argument" do
850
1053
  flush_cache
851
- dnf_package.name "something"
852
- dnf_package.package_name "somethingelse"
853
- dnf_package.source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
854
- dnf_package.run_action(:upgrade)
855
- expect(dnf_package.updated_by_last_action?).to be true
1054
+ dnf_package "something" do
1055
+ options default_options
1056
+ package_name "somethingelse"
1057
+ source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
1058
+ action :upgrade
1059
+ end.should_be_updated
856
1060
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
857
- dnf_package.run_action(:upgrade)
858
- expect(dnf_package.updated_by_last_action?).to be false
1061
+ dnf_package "something" do
1062
+ options default_options
1063
+ package_name "somethingelse"
1064
+ source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
1065
+ action :upgrade
1066
+ end.should_not_be_updated
859
1067
  end
860
1068
 
861
1069
  it "installs the package when the name is a path to a file" do
862
1070
  flush_cache
863
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
864
- dnf_package.run_action(:upgrade)
865
- expect(dnf_package.updated_by_last_action?).to be true
1071
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1072
+ options default_options
1073
+ action :upgrade
1074
+ end.should_be_updated
866
1075
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
867
- dnf_package.run_action(:upgrade)
868
- expect(dnf_package.updated_by_last_action?).to be false
1076
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1077
+ options default_options
1078
+ action :upgrade
1079
+ end.should_not_be_updated
869
1080
  end
870
1081
 
871
1082
  it "downgrades the package when allow_downgrade is true" do
872
1083
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
873
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
874
- dnf_package.run_action(:upgrade)
875
- expect(dnf_package.updated_by_last_action?).to be true
1084
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1085
+ options default_options
1086
+ action :upgrade
1087
+ end.should_be_updated
876
1088
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
877
- dnf_package.run_action(:upgrade)
878
- expect(dnf_package.updated_by_last_action?).to be false
1089
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1090
+ options default_options
1091
+ action :upgrade
1092
+ end.should_not_be_updated
879
1093
  end
880
1094
 
881
1095
  it "upgrades the package" do
882
1096
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
883
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm")
884
- dnf_package.run_action(:upgrade)
885
- expect(dnf_package.updated_by_last_action?).to be true
1097
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
1098
+ options default_options
1099
+ action :upgrade
1100
+ end.should_be_updated
886
1101
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
887
- dnf_package.run_action(:upgrade)
888
- expect(dnf_package.updated_by_last_action?).to be false
1102
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
1103
+ options default_options
1104
+ action :upgrade
1105
+ end.should_not_be_updated
889
1106
  end
890
1107
 
891
1108
  it "is idempotent when the package is already installed" do
892
1109
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
893
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
894
- dnf_package.run_action(:upgrade)
895
- expect(dnf_package.updated_by_last_action?).to be false
1110
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1111
+ options default_options
1112
+ action :upgrade
1113
+ end.should_not_be_updated
896
1114
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
897
1115
  end
898
1116
  end
@@ -901,295 +1119,382 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
901
1119
  it "works when a package is installed" do
902
1120
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
903
1121
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
904
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
905
- dnf_package.run_action(:upgrade)
906
- expect(dnf_package.updated_by_last_action?).to be false
1122
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1123
+ options "--nogpgcheck --disablerepo=*"
1124
+ action :upgrade
1125
+ end.should_not_be_updated
907
1126
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
908
1127
  end
909
1128
 
910
1129
  it "works with a local source" do
911
1130
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
912
1131
  flush_cache
913
- dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
914
- dnf_package.run_action(:upgrade)
915
- expect(dnf_package.updated_by_last_action?).to be true
1132
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1133
+ options "--nogpgcheck --disablerepo=*"
1134
+ action :upgrade
1135
+ end.should_be_updated
916
1136
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
917
- dnf_package.run_action(:upgrade)
918
- expect(dnf_package.updated_by_last_action?).to be false
1137
+ dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
1138
+ options default_options
1139
+ action :upgrade
1140
+ end.should_not_be_updated
919
1141
  end
920
1142
  end
921
1143
 
922
1144
  context "version pinning" do
923
1145
  it "with a full version pin it installs a later package" do
924
1146
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
925
- dnf_package.package_name("chef_rpm")
926
- dnf_package.version("1.10-1")
927
- dnf_package.run_action(:upgrade)
928
- expect(dnf_package.updated_by_last_action?).to be true
1147
+ dnf_package "chef_rpm" do
1148
+ options default_options
1149
+ version "1.10-1"
1150
+ action :upgrade
1151
+ end.should_be_updated
929
1152
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
930
- dnf_package.run_action(:upgrade)
931
- expect(dnf_package.updated_by_last_action?).to be false
1153
+ dnf_package "chef_rpm" do
1154
+ options default_options
1155
+ version "1.10-1"
1156
+ action :upgrade
1157
+ end.should_not_be_updated
932
1158
  end
933
1159
 
934
1160
  it "with a full version pin in the name it downgrades the package" do
935
1161
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
936
- dnf_package.package_name("chef_rpm")
937
- dnf_package.version("1.2-1")
938
- dnf_package.run_action(:upgrade)
939
- expect(dnf_package.updated_by_last_action?).to be true
1162
+ dnf_package "chef_rpm" do
1163
+ options default_options
1164
+ version "1.2-1"
1165
+ action :upgrade
1166
+ end.should_be_updated
940
1167
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
941
- dnf_package.run_action(:upgrade)
942
- expect(dnf_package.updated_by_last_action?).to be false
1168
+ dnf_package "chef_rpm" do
1169
+ options default_options
1170
+ version "1.2-1"
1171
+ action :upgrade
1172
+ end.should_not_be_updated
943
1173
  end
944
1174
 
945
1175
  it "with a partial (no release) version pin it installs a later package" do
946
1176
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
947
- dnf_package.package_name("chef_rpm")
948
- dnf_package.version("1.10")
949
- dnf_package.run_action(:upgrade)
950
- expect(dnf_package.updated_by_last_action?).to be true
1177
+ dnf_package "chef_rpm" do
1178
+ options default_options
1179
+ version "1.10"
1180
+ action :upgrade
1181
+ end.should_be_updated
951
1182
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
952
- dnf_package.run_action(:upgrade)
953
- expect(dnf_package.updated_by_last_action?).to be false
1183
+ dnf_package "chef_rpm" do
1184
+ options default_options
1185
+ version "1.10"
1186
+ action :upgrade
1187
+ end.should_not_be_updated
954
1188
  end
955
1189
 
956
1190
  it "with a partial (no release) version pin in the name it downgrades the package" do
957
1191
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
958
- dnf_package.package_name("chef_rpm")
959
- dnf_package.version("1.2")
960
- dnf_package.run_action(:upgrade)
961
- expect(dnf_package.updated_by_last_action?).to be true
1192
+ dnf_package "chef_rpm" do
1193
+ options default_options
1194
+ version("1.2")
1195
+ action :upgrade
1196
+ end.should_be_updated
962
1197
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
963
- dnf_package.run_action(:upgrade)
964
- expect(dnf_package.updated_by_last_action?).to be false
1198
+ dnf_package "chef_rpm" do
1199
+ options default_options
1200
+ version("1.2")
1201
+ action :upgrade
1202
+ end.should_not_be_updated
965
1203
  end
966
1204
 
967
1205
  it "with a full version pin it installs a later package" do
968
1206
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
969
- dnf_package.package_name("chef_rpm-1.10-1")
970
- dnf_package.run_action(:upgrade)
971
- expect(dnf_package.updated_by_last_action?).to be true
1207
+ dnf_package "chef_rpm-1.10-1" do
1208
+ options default_options
1209
+ action :upgrade
1210
+ end.should_be_updated
972
1211
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
973
- dnf_package.run_action(:upgrade)
974
- expect(dnf_package.updated_by_last_action?).to be false
1212
+ dnf_package "chef_rpm-1.10-1" do
1213
+ options default_options
1214
+ action :upgrade
1215
+ end.should_not_be_updated
975
1216
  end
976
1217
 
977
1218
  it "with a full version pin in the name it downgrades the package" do
978
1219
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
979
- dnf_package.package_name("chef_rpm-1.2-1")
980
- dnf_package.run_action(:upgrade)
981
- expect(dnf_package.updated_by_last_action?).to be true
1220
+ dnf_package "chef_rpm-1.2-1" do
1221
+ options default_options
1222
+ action :upgrade
1223
+ end.should_be_updated
982
1224
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
983
- dnf_package.run_action(:upgrade)
984
- expect(dnf_package.updated_by_last_action?).to be false
1225
+ dnf_package "chef_rpm-1.2-1" do
1226
+ options default_options
1227
+ action :upgrade
1228
+ end.should_not_be_updated
985
1229
  end
986
1230
 
987
1231
  it "with a partial (no release) version pin it installs a later package" do
988
1232
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
989
- dnf_package.package_name("chef_rpm-1.10")
990
- dnf_package.run_action(:upgrade)
991
- expect(dnf_package.updated_by_last_action?).to be true
1233
+ dnf_package "chef_rpm-1.10" do
1234
+ options default_options
1235
+ action :upgrade
1236
+ end.should_be_updated
992
1237
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
993
- dnf_package.run_action(:upgrade)
994
- expect(dnf_package.updated_by_last_action?).to be false
1238
+ dnf_package "chef_rpm-1.10" do
1239
+ options default_options
1240
+ action :upgrade
1241
+ end.should_not_be_updated
995
1242
  end
996
1243
 
997
1244
  it "with a partial (no release) version pin in the name it downgrades the package" do
998
1245
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
999
- dnf_package.package_name("chef_rpm-1.2")
1000
- dnf_package.run_action(:upgrade)
1001
- expect(dnf_package.updated_by_last_action?).to be true
1246
+ dnf_package "chef_rpm-1.2" do
1247
+ options default_options
1248
+ action :upgrade
1249
+ end.should_be_updated
1002
1250
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1003
- dnf_package.run_action(:upgrade)
1004
- expect(dnf_package.updated_by_last_action?).to be false
1251
+ dnf_package "chef_rpm-1.2" do
1252
+ options default_options
1253
+ action :upgrade
1254
+ end.should_not_be_updated
1005
1255
  end
1006
1256
 
1007
1257
  it "with a prco equality pin in the name it upgrades a prior package" do
1008
1258
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1009
- dnf_package.package_name("chef_rpm = 1.10")
1010
- dnf_package.run_action(:upgrade)
1011
- expect(dnf_package.updated_by_last_action?).to be true
1259
+ dnf_package "chef_rpm = 1.10" do
1260
+ options default_options
1261
+ action :upgrade
1262
+ end.should_be_updated
1012
1263
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1013
- dnf_package.run_action(:upgrade)
1014
- expect(dnf_package.updated_by_last_action?).to be false
1264
+ dnf_package "chef_rpm = 1.10" do
1265
+ options default_options
1266
+ action :upgrade
1267
+ end.should_not_be_updated
1015
1268
  end
1016
1269
 
1017
1270
  it "with a prco equality pin in the name it downgrades a later package" do
1018
1271
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1019
- dnf_package.package_name("chef_rpm = 1.2")
1020
- dnf_package.run_action(:upgrade)
1021
- expect(dnf_package.updated_by_last_action?).to be true
1272
+ dnf_package "chef_rpm = 1.2" do
1273
+ options default_options
1274
+ action :upgrade
1275
+ end.should_be_updated
1022
1276
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1023
- dnf_package.run_action(:upgrade)
1024
- expect(dnf_package.updated_by_last_action?).to be false
1277
+ dnf_package "chef_rpm = 1.2" do
1278
+ options default_options
1279
+ action :upgrade
1280
+ end.should_not_be_updated
1025
1281
  end
1026
1282
 
1027
1283
  it "with a > pin in the name and no rpm installed it installs" do
1028
1284
  flush_cache
1029
- dnf_package.package_name("chef_rpm > 1.2")
1030
- dnf_package.run_action(:upgrade)
1031
- expect(dnf_package.updated_by_last_action?).to be true
1285
+ dnf_package "chef_rpm > 1.2" do
1286
+ options default_options
1287
+ action :upgrade
1288
+ end.should_be_updated
1032
1289
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1033
- dnf_package.run_action(:upgrade)
1034
- expect(dnf_package.updated_by_last_action?).to be false
1290
+ dnf_package "chef_rpm > 1.2" do
1291
+ options default_options
1292
+ action :upgrade
1293
+ end.should_not_be_updated
1035
1294
  end
1036
1295
 
1037
1296
  it "with a < pin in the name and no rpm installed it installs" do
1038
1297
  flush_cache
1039
- dnf_package.package_name("chef_rpm < 1.10")
1040
- dnf_package.run_action(:upgrade)
1041
- expect(dnf_package.updated_by_last_action?).to be true
1298
+ dnf_package "chef_rpm < 1.10" do
1299
+ options default_options
1300
+ action :upgrade
1301
+ end.should_be_updated
1042
1302
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1043
- dnf_package.run_action(:upgrade)
1044
- expect(dnf_package.updated_by_last_action?).to be false
1303
+ dnf_package "chef_rpm < 1.10" do
1304
+ options default_options
1305
+ action :upgrade
1306
+ end.should_not_be_updated
1045
1307
  end
1046
1308
 
1047
1309
  it "with a > pin in the name and matching rpm installed it does nothing" do
1048
1310
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1049
- dnf_package.package_name("chef_rpm > 1.2")
1050
- dnf_package.run_action(:upgrade)
1051
- expect(dnf_package.updated_by_last_action?).to be false
1311
+ dnf_package "chef_rpm > 1.2" do
1312
+ options default_options
1313
+ action :upgrade
1314
+ end.should_not_be_updated
1052
1315
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1053
1316
  end
1054
1317
 
1055
1318
  it "with a < pin in the name and no rpm installed it installs" do
1056
1319
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1057
- dnf_package.package_name("chef_rpm < 1.10")
1058
- dnf_package.run_action(:upgrade)
1059
- expect(dnf_package.updated_by_last_action?).to be false
1320
+ dnf_package "chef_rpm < 1.10" do
1321
+ options default_options
1322
+ action :upgrade
1323
+ end.should_not_be_updated
1060
1324
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1061
1325
  end
1062
1326
 
1063
1327
  it "with a > pin in the name and non-matching rpm installed it upgrades" do
1064
1328
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1065
- dnf_package.package_name("chef_rpm > 1.2")
1066
- dnf_package.run_action(:upgrade)
1067
- expect(dnf_package.updated_by_last_action?).to be true
1329
+ dnf_package "chef_rpm > 1.2" do
1330
+ options default_options
1331
+ action :upgrade
1332
+ end.should_be_updated
1068
1333
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1069
- dnf_package.run_action(:upgrade)
1070
- expect(dnf_package.updated_by_last_action?).to be false
1334
+ dnf_package "chef_rpm > 1.2" do
1335
+ options default_options
1336
+ action :upgrade
1337
+ end.should_not_be_updated
1071
1338
  end
1072
1339
 
1073
1340
  it "with a < pin in the name and non-matching rpm installed it downgrades" do
1074
1341
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1075
- dnf_package.package_name("chef_rpm < 1.10")
1076
- dnf_package.run_action(:upgrade)
1077
- expect(dnf_package.updated_by_last_action?).to be true
1342
+ dnf_package "chef_rpm < 1.10" do
1343
+ options default_options
1344
+ action :upgrade
1345
+ end.should_be_updated
1078
1346
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
1079
- dnf_package.run_action(:upgrade)
1080
- expect(dnf_package.updated_by_last_action?).to be false
1347
+ dnf_package "chef_rpm < 1.10" do
1348
+ options default_options
1349
+ action :upgrade
1350
+ end.should_not_be_updated
1081
1351
  end
1082
1352
  end
1083
1353
  end
1084
1354
 
1085
1355
  describe ":remove" do
1086
1356
  context "vanilla use case" do
1087
- let(:package_name) { "chef_rpm" }
1088
1357
  it "does nothing if the package is not installed" do
1089
1358
  flush_cache
1090
- dnf_package.run_action(:remove)
1091
- expect(dnf_package.updated_by_last_action?).to be false
1359
+ dnf_package "chef_rpm" do
1360
+ options default_options
1361
+ action :remove
1362
+ end.should_not_be_updated
1092
1363
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1093
1364
  end
1094
1365
 
1095
1366
  it "removes the package if the package is installed" do
1096
1367
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1097
- dnf_package.run_action(:remove)
1098
- expect(dnf_package.updated_by_last_action?).to be true
1368
+ dnf_package "chef_rpm" do
1369
+ options default_options
1370
+ action :remove
1371
+ end.should_be_updated
1099
1372
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1100
1373
  end
1101
1374
 
1102
1375
  it "does not remove the package twice" do
1103
1376
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1104
- dnf_package.run_action(:remove)
1105
- expect(dnf_package.updated_by_last_action?).to be true
1377
+ dnf_package "chef_rpm" do
1378
+ options default_options
1379
+ action :remove
1380
+ end.should_be_updated
1106
1381
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1107
- dnf_package.run_action(:remove)
1108
- expect(dnf_package.updated_by_last_action?).to be false
1382
+ dnf_package "chef_rpm" do
1383
+ options default_options
1384
+ action :remove
1385
+ end.should_not_be_updated
1109
1386
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1110
1387
  end
1111
1388
 
1112
1389
  it "removes the package if the prior version package is installed" do
1113
1390
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1114
- dnf_package.run_action(:remove)
1115
- expect(dnf_package.updated_by_last_action?).to be true
1391
+ dnf_package "chef_rpm" do
1392
+ options default_options
1393
+ action :remove
1394
+ end.should_be_updated
1116
1395
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1117
- dnf_package.run_action(:remove)
1118
- expect(dnf_package.updated_by_last_action?).to be false
1396
+ dnf_package "chef_rpm" do
1397
+ options default_options
1398
+ action :remove
1399
+ end.should_not_be_updated
1119
1400
  end
1120
1401
 
1121
1402
  it "removes the package if the i686 package is installed", :intel_64bit do
1122
1403
  skip "FIXME: should this be fixed or is the current behavior correct?"
1123
1404
  preinstall("chef_rpm-1.10-1.i686.rpm")
1124
- dnf_package.run_action(:remove)
1125
- expect(dnf_package.updated_by_last_action?).to be true
1405
+ dnf_package "chef_rpm" do
1406
+ options default_options
1407
+ action :remove
1408
+ end.should_be_updated
1126
1409
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1127
- dnf_package.run_action(:remove)
1128
- expect(dnf_package.updated_by_last_action?).to be false
1410
+ dnf_package "chef_rpm" do
1411
+ options default_options
1412
+ action :remove
1413
+ end.should_not_be_updated
1129
1414
  end
1130
1415
 
1131
1416
  it "removes the package if the prior version i686 package is installed", :intel_64bit do
1132
1417
  skip "FIXME: should this be fixed or is the current behavior correct?"
1133
1418
  preinstall("chef_rpm-1.2-1.i686.rpm")
1134
- dnf_package.run_action(:remove)
1135
- expect(dnf_package.updated_by_last_action?).to be true
1419
+ dnf_package "chef_rpm" do
1420
+ options default_options
1421
+ action :remove
1422
+ end.should_be_updated
1136
1423
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1137
- dnf_package.run_action(:remove)
1138
- expect(dnf_package.updated_by_last_action?).to be false
1424
+ dnf_package "chef_rpm" do
1425
+ options default_options
1426
+ action :remove
1427
+ end.should_not_be_updated
1139
1428
  end
1140
1429
  end
1141
1430
 
1142
1431
  context "with 64-bit arch", :intel_64bit do
1143
- let(:package_name) { "chef_rpm.#{pkg_arch}" }
1144
1432
  it "does nothing if the package is not installed" do
1145
1433
  flush_cache
1146
- dnf_package.run_action(:remove)
1147
- expect(dnf_package.updated_by_last_action?).to be false
1434
+ dnf_package "chef_rpm.#{pkg_arch}" do
1435
+ options default_options
1436
+ action :remove
1437
+ end.should_not_be_updated
1148
1438
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1149
1439
  end
1150
1440
 
1151
1441
  it "removes the package if the package is installed" do
1152
1442
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
1153
- dnf_package.run_action(:remove)
1154
- expect(dnf_package.updated_by_last_action?).to be true
1443
+ dnf_package "chef_rpm.#{pkg_arch}" do
1444
+ options default_options
1445
+ action :remove
1446
+ end.should_be_updated
1155
1447
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1156
- dnf_package.run_action(:remove)
1157
- expect(dnf_package.updated_by_last_action?).to be false
1448
+ dnf_package "chef_rpm.#{pkg_arch}" do
1449
+ options default_options
1450
+ action :remove
1451
+ end.should_not_be_updated
1158
1452
  end
1159
1453
 
1160
1454
  it "removes the package if the prior version package is installed" do
1161
1455
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1162
- dnf_package.run_action(:remove)
1163
- expect(dnf_package.updated_by_last_action?).to be true
1456
+ dnf_package "chef_rpm.#{pkg_arch}" do
1457
+ options default_options
1458
+ action :remove
1459
+ end.should_be_updated
1164
1460
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1165
- dnf_package.run_action(:remove)
1166
- expect(dnf_package.updated_by_last_action?).to be false
1461
+ dnf_package "chef_rpm.#{pkg_arch}" do
1462
+ options default_options
1463
+ action :remove
1464
+ end.should_not_be_updated
1167
1465
  end
1168
1466
 
1169
1467
  it "does nothing if the i686 package is installed" do
1170
1468
  preinstall("chef_rpm-1.10-1.i686.rpm")
1171
- dnf_package.run_action(:remove)
1172
- expect(dnf_package.updated_by_last_action?).to be false
1469
+ dnf_package "chef_rpm.#{pkg_arch}" do
1470
+ options default_options
1471
+ action :remove
1472
+ end.should_not_be_updated
1173
1473
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
1174
1474
  end
1175
1475
 
1176
1476
  it "does nothing if the prior version i686 package is installed" do
1177
1477
  preinstall("chef_rpm-1.2-1.i686.rpm")
1178
- dnf_package.run_action(:remove)
1179
- expect(dnf_package.updated_by_last_action?).to be false
1478
+ dnf_package "chef_rpm.#{pkg_arch}" do
1479
+ options default_options
1480
+ action :remove
1481
+ end.should_not_be_updated
1180
1482
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
1181
1483
  end
1182
1484
  end
1183
1485
 
1184
1486
  context "with 32-bit arch", :intel_64bit do
1185
- let(:package_name) { "chef_rpm.i686" }
1186
1487
  it "removes only the 32-bit arch if both are installed" do
1187
1488
  preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
1188
- dnf_package.run_action(:remove)
1189
- expect(dnf_package.updated_by_last_action?).to be true
1489
+ dnf_package "chef_rpm.i686" do
1490
+ options default_options
1491
+ action :remove
1492
+ end.should_be_updated
1190
1493
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
1191
- dnf_package.run_action(:remove)
1192
- expect(dnf_package.updated_by_last_action?).to be false
1494
+ dnf_package "chef_rpm.i686" do
1495
+ options default_options
1496
+ action :remove
1497
+ end.should_not_be_updated
1193
1498
  end
1194
1499
  end
1195
1500
 
@@ -1197,11 +1502,15 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1197
1502
  it "works when a package is installed" do
1198
1503
  FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
1199
1504
  preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
1200
- dnf_package.run_action(:remove)
1201
- expect(dnf_package.updated_by_last_action?).to be true
1505
+ dnf_package "chef_rpm" do
1506
+ options "--nogpgcheck --disablerepo=*"
1507
+ action :remove
1508
+ end.should_be_updated
1202
1509
  expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
1203
- dnf_package.run_action(:remove)
1204
- expect(dnf_package.updated_by_last_action?).to be false
1510
+ dnf_package "chef_rpm" do
1511
+ options "--nogpgcheck --disablerepo=*"
1512
+ action :remove
1513
+ end.should_not_be_updated
1205
1514
  end
1206
1515
  end
1207
1516
  end
@@ -1217,61 +1526,75 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
1217
1526
 
1218
1527
  it "locks an rpm" do
1219
1528
  flush_cache
1220
- dnf_package.package_name("chef_rpm")
1221
- dnf_package.run_action(:lock)
1222
- expect(dnf_package.updated_by_last_action?).to be true
1529
+ dnf_package "chef_rpm" do
1530
+ options default_options
1531
+ action :lock
1532
+ end.should_be_updated
1223
1533
  expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
1224
- dnf_package.run_action(:lock)
1225
- expect(dnf_package.updated_by_last_action?).to be false
1534
+ dnf_package "chef_rpm" do
1535
+ options default_options
1536
+ action :lock
1537
+ end.should_not_be_updated
1226
1538
  end
1227
1539
 
1228
1540
  it "does not lock if its already locked" do
1229
1541
  flush_cache
1230
1542
  shell_out!("dnf versionlock add chef_rpm")
1231
- dnf_package.package_name("chef_rpm")
1232
- dnf_package.run_action(:lock)
1233
- expect(dnf_package.updated_by_last_action?).to be false
1543
+ dnf_package "chef_rpm" do
1544
+ options default_options
1545
+ action :lock
1546
+ end.should_not_be_updated
1234
1547
  expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
1235
1548
  end
1236
1549
 
1237
1550
  it "unlocks an rpm" do
1238
1551
  flush_cache
1239
1552
  shell_out!("dnf versionlock add chef_rpm")
1240
- dnf_package.package_name("chef_rpm")
1241
- dnf_package.run_action(:unlock)
1242
- expect(dnf_package.updated_by_last_action?).to be true
1553
+ dnf_package "chef_rpm" do
1554
+ options default_options
1555
+ action :unlock
1556
+ end.should_be_updated
1243
1557
  expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
1244
- dnf_package.run_action(:unlock)
1245
- expect(dnf_package.updated_by_last_action?).to be false
1558
+ dnf_package "chef_rpm" do
1559
+ options default_options
1560
+ action :unlock
1561
+ end.should_not_be_updated
1246
1562
  end
1247
1563
 
1248
1564
  it "does not unlock an already locked rpm" do
1249
1565
  flush_cache
1250
- dnf_package.package_name("chef_rpm")
1251
- dnf_package.run_action(:unlock)
1252
- expect(dnf_package.updated_by_last_action?).to be false
1566
+ dnf_package "chef_rpm" do
1567
+ options default_options
1568
+ action :unlock
1569
+ end.should_not_be_updated
1253
1570
  expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
1254
1571
  end
1255
1572
 
1256
1573
  it "check that we can lock based on provides" do
1257
1574
  flush_cache
1258
- dnf_package.package_name("chef_rpm_provides")
1259
- dnf_package.run_action(:lock)
1260
- expect(dnf_package.updated_by_last_action?).to be true
1575
+ dnf_package "chef_rpm_provides" do
1576
+ options default_options
1577
+ action :lock
1578
+ end.should_be_updated
1261
1579
  expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
1262
- dnf_package.run_action(:lock)
1263
- expect(dnf_package.updated_by_last_action?).to be false
1580
+ dnf_package "chef_rpm_provides" do
1581
+ options default_options
1582
+ action :lock
1583
+ end.should_not_be_updated
1264
1584
  end
1265
1585
 
1266
1586
  it "check that we can unlock based on provides" do
1267
1587
  flush_cache
1268
1588
  shell_out!("dnf versionlock add chef_rpm")
1269
- dnf_package.package_name("chef_rpm_provides")
1270
- dnf_package.run_action(:unlock)
1271
- expect(dnf_package.updated_by_last_action?).to be true
1589
+ dnf_package "chef_rpm_provides" do
1590
+ options default_options
1591
+ action :unlock
1592
+ end.should_be_updated
1272
1593
  expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
1273
- dnf_package.run_action(:unlock)
1274
- expect(dnf_package.updated_by_last_action?).to be false
1594
+ dnf_package "chef_rpm_provides" do
1595
+ options default_options
1596
+ action :unlock
1597
+ end.should_not_be_updated
1275
1598
  end
1276
1599
  end
1277
1600
  end