chef 18.10.17 → 19.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (715) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +24 -18
  3. data/README.md +6 -2
  4. data/Rakefile +1 -2
  5. data/chef-universal-mingw-ucrt.gemspec +1 -1
  6. data/chef.gemspec +17 -19
  7. data/lib/chef/action_collection.rb +3 -1
  8. data/lib/chef/api_client/registration.rb +1 -1
  9. data/lib/chef/api_client.rb +1 -1
  10. data/lib/chef/api_client_v1.rb +1 -1
  11. data/lib/chef/application/apply.rb +30 -3
  12. data/lib/chef/application/base.rb +34 -3
  13. data/lib/chef/application/client.rb +15 -1
  14. data/lib/chef/application/exit_code.rb +3 -1
  15. data/lib/chef/application/solo.rb +1 -1
  16. data/lib/chef/application.rb +6 -1
  17. data/lib/chef/chef_class.rb +1 -1
  18. data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
  19. data/lib/chef/chef_fs/command_line.rb +7 -6
  20. data/lib/chef/chef_fs/config.rb +1 -1
  21. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  22. data/lib/chef/chef_fs/file_pattern.rb +1 -1
  23. data/lib/chef/chef_fs/file_system/base_fs_dir.rb +1 -1
  24. data/lib/chef/chef_fs/file_system/base_fs_object.rb +1 -1
  25. data/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb +1 -1
  26. data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
  27. data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
  28. data/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +1 -1
  29. data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb +1 -1
  30. data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +1 -1
  31. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +2 -2
  32. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
  33. data/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb +1 -1
  35. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
  36. data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
  37. data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +1 -1
  38. data/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb +1 -1
  39. data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
  40. data/lib/chef/chef_fs/file_system/chef_server/policies_acl_dir.rb +1 -1
  41. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
  42. data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
  43. data/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb +1 -1
  44. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
  45. data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +1 -1
  46. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb +2 -2
  47. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +1 -1
  48. data/lib/chef/chef_fs/file_system/exceptions.rb +1 -1
  49. data/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb +1 -1
  50. data/lib/chef/chef_fs/file_system/repository/acl.rb +1 -1
  51. data/lib/chef/chef_fs/file_system/repository/acls_dir.rb +1 -1
  52. data/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb +1 -1
  53. data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -1
  54. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
  55. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +1 -1
  56. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +7 -6
  57. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +1 -1
  58. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
  59. data/lib/chef/chef_fs/file_system/repository/client.rb +1 -1
  60. data/lib/chef/chef_fs/file_system/repository/client_key.rb +1 -1
  61. data/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb +1 -1
  62. data/lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb +1 -1
  63. data/lib/chef/chef_fs/file_system/repository/clients_dir.rb +1 -1
  64. data/lib/chef/chef_fs/file_system/repository/container.rb +1 -1
  65. data/lib/chef/chef_fs/file_system/repository/containers_dir.rb +1 -1
  66. data/lib/chef/chef_fs/file_system/repository/cookbook_artifacts_dir.rb +1 -1
  67. data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
  68. data/lib/chef/chef_fs/file_system/repository/data_bag.rb +1 -1
  69. data/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +1 -1
  70. data/lib/chef/chef_fs/file_system/repository/data_bags_dir.rb +1 -1
  71. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  72. data/lib/chef/chef_fs/file_system/repository/environment.rb +1 -1
  73. data/lib/chef/chef_fs/file_system/repository/environments_dir.rb +1 -1
  74. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  75. data/lib/chef/chef_fs/file_system/repository/group.rb +1 -1
  76. data/lib/chef/chef_fs/file_system/repository/groups_dir.rb +1 -1
  77. data/lib/chef/chef_fs/file_system/repository/node.rb +1 -1
  78. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +1 -1
  79. data/lib/chef/chef_fs/file_system/repository/policies_dir.rb +1 -1
  80. data/lib/chef/chef_fs/file_system/repository/policy.rb +1 -1
  81. data/lib/chef/chef_fs/file_system/repository/policy_group.rb +1 -1
  82. data/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +1 -1
  83. data/lib/chef/chef_fs/file_system/repository/role.rb +1 -1
  84. data/lib/chef/chef_fs/file_system/repository/roles_dir.rb +1 -1
  85. data/lib/chef/chef_fs/file_system/repository/user.rb +1 -1
  86. data/lib/chef/chef_fs/file_system/repository/users_dir.rb +1 -1
  87. data/lib/chef/chef_fs/file_system/repository/versioned_cookbooks_dir.rb +1 -1
  88. data/lib/chef/chef_fs/file_system.rb +1 -1
  89. data/lib/chef/chef_fs/file_system_cache.rb +1 -1
  90. data/lib/chef/chef_fs/path_utils.rb +1 -1
  91. data/lib/chef/client.rb +13 -3
  92. data/lib/chef/compliance/default_attributes.rb +1 -1
  93. data/lib/chef/compliance/fetcher/chef_server.rb +1 -1
  94. data/lib/chef/compliance/input.rb +1 -1
  95. data/lib/chef/compliance/input_collection.rb +1 -1
  96. data/lib/chef/compliance/profile.rb +1 -1
  97. data/lib/chef/compliance/profile_collection.rb +1 -1
  98. data/lib/chef/compliance/runner.rb +19 -1
  99. data/lib/chef/compliance/waiver.rb +1 -1
  100. data/lib/chef/compliance/waiver_collection.rb +1 -1
  101. data/lib/chef/config.rb +1 -1
  102. data/lib/chef/constants.rb +1 -1
  103. data/lib/chef/context.rb +53 -0
  104. data/lib/chef/cookbook/chefignore.rb +2 -2
  105. data/lib/chef/cookbook/cookbook_collection.rb +1 -1
  106. data/lib/chef/cookbook/cookbook_version_loader.rb +2 -1
  107. data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
  108. data/lib/chef/cookbook/file_vendor.rb +1 -1
  109. data/lib/chef/cookbook/gem_installer.rb +1 -1
  110. data/lib/chef/cookbook/manifest_v0.rb +1 -1
  111. data/lib/chef/cookbook/manifest_v2.rb +1 -1
  112. data/lib/chef/cookbook/metadata.rb +1 -1
  113. data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
  114. data/lib/chef/cookbook/synchronizer.rb +5 -0
  115. data/lib/chef/cookbook/syntax_check.rb +1 -1
  116. data/lib/chef/cookbook_loader.rb +1 -1
  117. data/lib/chef/cookbook_manifest.rb +1 -1
  118. data/lib/chef/cookbook_version.rb +3 -3
  119. data/lib/chef/daemon.rb +1 -1
  120. data/lib/chef/data_bag.rb +3 -3
  121. data/lib/chef/data_bag_item.rb +2 -2
  122. data/lib/chef/data_collector/config_validation.rb +1 -1
  123. data/lib/chef/data_collector/error_handlers.rb +1 -1
  124. data/lib/chef/data_collector/message_helpers.rb +1 -1
  125. data/lib/chef/data_collector/run_end_message.rb +1 -1
  126. data/lib/chef/data_collector/run_start_message.rb +2 -2
  127. data/lib/chef/data_collector.rb +2 -2
  128. data/lib/chef/decorator/lazy.rb +1 -1
  129. data/lib/chef/decorator/lazy_array.rb +1 -1
  130. data/lib/chef/decorator.rb +1 -1
  131. data/lib/chef/delayed_evaluator.rb +1 -1
  132. data/lib/chef/deprecated.rb +1 -1
  133. data/lib/chef/deprecation/warnings.rb +1 -1
  134. data/lib/chef/digester.rb +1 -1
  135. data/lib/chef/dsl/chef_vault.rb +2 -2
  136. data/lib/chef/dsl/cheffish.rb +1 -1
  137. data/lib/chef/dsl/compliance.rb +1 -1
  138. data/lib/chef/dsl/data_query.rb +1 -1
  139. data/lib/chef/dsl/declare_resource.rb +1 -1
  140. data/lib/chef/dsl/include_attribute.rb +1 -1
  141. data/lib/chef/dsl/include_recipe.rb +1 -1
  142. data/lib/chef/dsl/platform_introspection.rb +1 -1
  143. data/lib/chef/dsl/powershell.rb +1 -1
  144. data/lib/chef/dsl/reader_helpers.rb +3 -1
  145. data/lib/chef/dsl/reboot_pending.rb +1 -1
  146. data/lib/chef/dsl/recipe.rb +1 -1
  147. data/lib/chef/dsl/registry_helper.rb +1 -1
  148. data/lib/chef/dsl/render_helpers.rb +1 -1
  149. data/lib/chef/dsl/resources.rb +1 -1
  150. data/lib/chef/dsl/rest_resource.rb +165 -5
  151. data/lib/chef/dsl/secret.rb +1 -1
  152. data/lib/chef/dsl/universal.rb +1 -1
  153. data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +1 -1
  154. data/lib/chef/encrypted_data_bag_item/decryption_failure.rb +1 -1
  155. data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -1
  156. data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -1
  157. data/lib/chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb +1 -1
  158. data/lib/chef/encrypted_data_bag_item/unsupported_cipher.rb +1 -1
  159. data/lib/chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format.rb +1 -1
  160. data/lib/chef/encrypted_data_bag_item.rb +1 -1
  161. data/lib/chef/environment.rb +2 -2
  162. data/lib/chef/event_loggers/base.rb +1 -1
  163. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  164. data/lib/chef/exceptions.rb +2 -12
  165. data/lib/chef/file_access_control/unix.rb +10 -10
  166. data/lib/chef/file_access_control/windows.rb +1 -1
  167. data/lib/chef/file_access_control.rb +1 -1
  168. data/lib/chef/file_cache.rb +1 -1
  169. data/lib/chef/file_content_management/content_base.rb +1 -1
  170. data/lib/chef/file_content_management/deploy/cp.rb +1 -1
  171. data/lib/chef/file_content_management/deploy/mv_unix.rb +1 -1
  172. data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
  173. data/lib/chef/file_content_management/deploy/target_io.rb +27 -0
  174. data/lib/chef/file_content_management/deploy.rb +5 -2
  175. data/lib/chef/file_content_management/tempfile.rb +1 -1
  176. data/lib/chef/formatters/base.rb +1 -1
  177. data/lib/chef/formatters/error_description.rb +1 -1
  178. data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +1 -1
  179. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +1 -1
  180. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +3 -2
  181. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +3 -2
  182. data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
  183. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +1 -1
  184. data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
  185. data/lib/chef/formatters/error_mapper.rb +1 -1
  186. data/lib/chef/group.rb +1 -1
  187. data/lib/chef/guard_interpreter/default_guard_interpreter.rb +1 -1
  188. data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +1 -1
  189. data/lib/chef/guard_interpreter.rb +1 -1
  190. data/lib/chef/handler/error_report.rb +1 -1
  191. data/lib/chef/handler/json_file.rb +1 -1
  192. data/lib/chef/handler/slow_report.rb +1 -1
  193. data/lib/chef/handler.rb +1 -1
  194. data/lib/chef/http/api_versions.rb +1 -1
  195. data/lib/chef/http/auth_credentials.rb +1 -1
  196. data/lib/chef/http/authenticator.rb +10 -10
  197. data/lib/chef/http/basic_client.rb +1 -2
  198. data/lib/chef/http/cookie_jar.rb +1 -1
  199. data/lib/chef/http/cookie_manager.rb +1 -1
  200. data/lib/chef/http/decompressor.rb +1 -1
  201. data/lib/chef/http/http_request.rb +17 -16
  202. data/lib/chef/http/json_input.rb +1 -1
  203. data/lib/chef/http/json_output.rb +1 -1
  204. data/lib/chef/http/json_to_model_output.rb +1 -1
  205. data/lib/chef/http/remote_request_id.rb +1 -1
  206. data/lib/chef/http/simple.rb +1 -1
  207. data/lib/chef/http/simple_json.rb +1 -1
  208. data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
  209. data/lib/chef/http/ssl_policies.rb +1 -1
  210. data/lib/chef/http/validate_content_length.rb +1 -1
  211. data/lib/chef/http.rb +1 -2
  212. data/lib/chef/json_compat.rb +1 -1
  213. data/lib/chef/key.rb +1 -1
  214. data/lib/chef/licensing.rb +105 -0
  215. data/lib/chef/licensing_config.rb +20 -0
  216. data/lib/chef/local_mode.rb +1 -1
  217. data/lib/chef/log/syslog.rb +1 -1
  218. data/lib/chef/log/winevt.rb +1 -1
  219. data/lib/chef/log.rb +1 -1
  220. data/lib/chef/mash.rb +1 -1
  221. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  222. data/lib/chef/mixin/checksum.rb +1 -1
  223. data/lib/chef/mixin/chef_utils_wiring.rb +1 -1
  224. data/lib/chef/mixin/convert_to_class_name.rb +1 -1
  225. data/lib/chef/mixin/create_path.rb +1 -1
  226. data/lib/chef/mixin/deep_merge.rb +1 -1
  227. data/lib/chef/mixin/default_paths.rb +1 -1
  228. data/lib/chef/mixin/deprecation.rb +1 -1
  229. data/lib/chef/mixin/enforce_ownership_and_permissions.rb +1 -1
  230. data/lib/chef/mixin/file_class.rb +4 -2
  231. data/lib/chef/mixin/from_file.rb +1 -1
  232. data/lib/chef/mixin/get_source_from_package.rb +2 -2
  233. data/lib/chef/mixin/homebrew.rb +3 -4
  234. data/lib/chef/mixin/lazy_module_include.rb +1 -1
  235. data/lib/chef/mixin/notifying_block.rb +1 -1
  236. data/lib/chef/mixin/openssl_helper.rb +1 -1
  237. data/lib/chef/mixin/params_validate.rb +1 -1
  238. data/lib/chef/mixin/path_sanity.rb +1 -1
  239. data/lib/chef/mixin/powershell_exec.rb +1 -1
  240. data/lib/chef/mixin/powershell_out.rb +1 -1
  241. data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
  242. data/lib/chef/mixin/proxified_socket.rb +1 -1
  243. data/lib/chef/mixin/securable.rb +1 -1
  244. data/lib/chef/mixin/shell_out.rb +1 -1
  245. data/lib/chef/mixin/subclass_directive.rb +1 -1
  246. data/lib/chef/mixin/template.rb +1 -1
  247. data/lib/chef/mixin/unformatter.rb +1 -1
  248. data/lib/chef/mixin/uris.rb +1 -1
  249. data/lib/chef/mixin/user_context.rb +1 -1
  250. data/lib/chef/mixin/versioned_api.rb +1 -1
  251. data/lib/chef/mixin/which.rb +1 -1
  252. data/lib/chef/mixin/why_run.rb +1 -1
  253. data/lib/chef/mixin/wide_string.rb +1 -1
  254. data/lib/chef/mixin/windows_architecture_helper.rb +1 -1
  255. data/lib/chef/mixin/windows_env_helper.rb +1 -1
  256. data/lib/chef/mixin/xml_escape.rb +1 -1
  257. data/lib/chef/monkey_patches/net-http.rb +10 -11
  258. data/lib/chef/monkey_patches/win32/registry.rb +1 -1
  259. data/lib/chef/node/attribute.rb +1 -1
  260. data/lib/chef/node/attribute_collections.rb +1 -1
  261. data/lib/chef/node/common_api.rb +1 -1
  262. data/lib/chef/node/immutable_collections.rb +1 -1
  263. data/lib/chef/node/mixin/deep_merge_cache.rb +1 -1
  264. data/lib/chef/node/mixin/immutablize_array.rb +27 -1
  265. data/lib/chef/node/mixin/immutablize_hash.rb +36 -1
  266. data/lib/chef/node/mixin/mashy_array.rb +1 -1
  267. data/lib/chef/node/mixin/state_tracking.rb +1 -1
  268. data/lib/chef/node/mixin/state_tracking_array.rb +1 -1
  269. data/lib/chef/node.rb +1 -1
  270. data/lib/chef/node_map.rb +15 -3
  271. data/lib/chef/null_logger.rb +1 -1
  272. data/lib/chef/org.rb +1 -1
  273. data/lib/chef/platform/priority_map.rb +1 -1
  274. data/lib/chef/platform/provider_handler_map.rb +1 -1
  275. data/lib/chef/platform/provider_mapping.rb +1 -1
  276. data/lib/chef/platform/query_helpers.rb +1 -1
  277. data/lib/chef/platform/rebooter.rb +1 -1
  278. data/lib/chef/platform/resource_handler_map.rb +1 -1
  279. data/lib/chef/platform/service_helpers.rb +1 -1
  280. data/lib/chef/platform.rb +1 -1
  281. data/lib/chef/policy_builder/dynamic.rb +1 -1
  282. data/lib/chef/policy_builder/expand_node_object.rb +1 -1
  283. data/lib/chef/policy_builder/policyfile.rb +1 -1
  284. data/lib/chef/policy_builder.rb +1 -1
  285. data/lib/chef/property.rb +3 -3
  286. data/lib/chef/provider/batch.rb +1 -1
  287. data/lib/chef/provider/cookbook_file/content.rb +1 -1
  288. data/lib/chef/provider/cookbook_file.rb +2 -2
  289. data/lib/chef/provider/cron/aix.rb +1 -1
  290. data/lib/chef/provider/cron/solaris.rb +1 -1
  291. data/lib/chef/provider/cron.rb +15 -5
  292. data/lib/chef/provider/directory.rb +18 -18
  293. data/lib/chef/provider/dsc_resource.rb +1 -1
  294. data/lib/chef/provider/dsc_script.rb +1 -1
  295. data/lib/chef/provider/execute.rb +3 -2
  296. data/lib/chef/provider/file/content.rb +1 -1
  297. data/lib/chef/provider/file.rb +43 -30
  298. data/lib/chef/provider/git.rb +10 -10
  299. data/lib/chef/provider/group/aix.rb +1 -1
  300. data/lib/chef/provider/group/dscl.rb +2 -2
  301. data/lib/chef/provider/group/gpasswd.rb +3 -3
  302. data/lib/chef/provider/group/groupadd.rb +2 -2
  303. data/lib/chef/provider/group/groupmod.rb +3 -3
  304. data/lib/chef/provider/group/pw.rb +3 -3
  305. data/lib/chef/provider/group/solaris.rb +3 -3
  306. data/lib/chef/provider/group/usermod.rb +3 -3
  307. data/lib/chef/provider/group.rb +2 -2
  308. data/lib/chef/provider/http_request.rb +3 -4
  309. data/lib/chef/provider/ifconfig/aix.rb +2 -2
  310. data/lib/chef/provider/ifconfig/debian.rb +3 -3
  311. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  312. data/lib/chef/provider/ifconfig.rb +1 -1
  313. data/lib/chef/provider/link.rb +22 -11
  314. data/lib/chef/provider/lwrp_base.rb +1 -1
  315. data/lib/chef/provider/mount/aix.rb +5 -5
  316. data/lib/chef/provider/mount/linux.rb +4 -4
  317. data/lib/chef/provider/mount/mount.rb +12 -12
  318. data/lib/chef/provider/mount/solaris.rb +1 -1
  319. data/lib/chef/provider/mount/windows.rb +3 -3
  320. data/lib/chef/provider/mount.rb +1 -1
  321. data/lib/chef/provider/noop.rb +1 -1
  322. data/lib/chef/provider/package/apt.rb +1 -1
  323. data/lib/chef/provider/package/bff.rb +4 -4
  324. data/lib/chef/provider/package/cab.rb +1 -1
  325. data/lib/chef/provider/package/chocolatey.rb +1 -1
  326. data/lib/chef/provider/package/deb.rb +1 -1
  327. data/lib/chef/provider/package/dnf/python_helper.rb +3 -3
  328. data/lib/chef/provider/package/dnf/version.rb +1 -1
  329. data/lib/chef/provider/package/dnf.rb +1 -1
  330. data/lib/chef/provider/package/dpkg.rb +6 -6
  331. data/lib/chef/provider/package/freebsd/base.rb +1 -1
  332. data/lib/chef/provider/package/habitat.rb +6 -6
  333. data/lib/chef/provider/package/homebrew.rb +1 -1
  334. data/lib/chef/provider/package/ips.rb +3 -3
  335. data/lib/chef/provider/package/msu.rb +1 -1
  336. data/lib/chef/provider/package/openbsd.rb +3 -2
  337. data/lib/chef/provider/package/pacman.rb +4 -4
  338. data/lib/chef/provider/package/paludis.rb +3 -3
  339. data/lib/chef/provider/package/portage.rb +3 -3
  340. data/lib/chef/provider/package/powershell.rb +1 -1
  341. data/lib/chef/provider/package/rpm.rb +3 -3
  342. data/lib/chef/provider/package/rubygems.rb +19 -3
  343. data/lib/chef/provider/package/smartos.rb +2 -2
  344. data/lib/chef/provider/package/snap.rb +19 -7
  345. data/lib/chef/provider/package/snap_tm.rb +79 -0
  346. data/lib/chef/provider/package/solaris.rb +5 -5
  347. data/lib/chef/provider/package/windows/exe.rb +1 -1
  348. data/lib/chef/provider/package/windows/msi.rb +1 -1
  349. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
  350. data/lib/chef/provider/package/windows.rb +1 -1
  351. data/lib/chef/provider/package/yum/python_helper.rb +1 -1
  352. data/lib/chef/provider/package/yum/rpm_utils.rb +1 -1
  353. data/lib/chef/provider/package/yum/version.rb +1 -1
  354. data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
  355. data/lib/chef/provider/package/yum.rb +1 -1
  356. data/lib/chef/provider/package/yum_tm.rb +132 -0
  357. data/lib/chef/provider/package/zypper/version.rb +1 -1
  358. data/lib/chef/provider/package/zypper.rb +5 -5
  359. data/lib/chef/provider/package.rb +2 -2
  360. data/lib/chef/provider/powershell_script.rb +85 -85
  361. data/lib/chef/provider/registry_key.rb +2 -1
  362. data/lib/chef/provider/remote_directory.rb +6 -6
  363. data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
  364. data/lib/chef/provider/remote_file/content.rb +1 -1
  365. data/lib/chef/provider/remote_file/fetcher.rb +1 -1
  366. data/lib/chef/provider/remote_file/http.rb +2 -3
  367. data/lib/chef/provider/remote_file.rb +2 -2
  368. data/lib/chef/provider/route.rb +10 -10
  369. data/lib/chef/provider/ruby_block.rb +1 -1
  370. data/lib/chef/provider/script.rb +8 -8
  371. data/lib/chef/provider/service/aix.rb +2 -2
  372. data/lib/chef/provider/service/aixinit.rb +6 -6
  373. data/lib/chef/provider/service/arch.rb +6 -6
  374. data/lib/chef/provider/service/debian.rb +8 -8
  375. data/lib/chef/provider/service/freebsd.rb +7 -7
  376. data/lib/chef/provider/service/gentoo.rb +6 -6
  377. data/lib/chef/provider/service/init.rb +3 -3
  378. data/lib/chef/provider/service/insserv.rb +3 -3
  379. data/lib/chef/provider/service/invokercd.rb +2 -2
  380. data/lib/chef/provider/service/macosx.rb +1 -1
  381. data/lib/chef/provider/service/openbsd.rb +7 -7
  382. data/lib/chef/provider/service/redhat.rb +6 -6
  383. data/lib/chef/provider/service/solaris.rb +3 -3
  384. data/lib/chef/provider/service/systemd.rb +3 -3
  385. data/lib/chef/provider/service/upstart.rb +3 -3
  386. data/lib/chef/provider/service/windows.rb +1 -1
  387. data/lib/chef/provider/service.rb +1 -1
  388. data/lib/chef/provider/subversion.rb +10 -10
  389. data/lib/chef/provider/systemd_unit.rb +3 -3
  390. data/lib/chef/provider/template/content.rb +1 -1
  391. data/lib/chef/provider/template.rb +2 -2
  392. data/lib/chef/provider/template_finder.rb +1 -1
  393. data/lib/chef/provider/user/aix.rb +4 -4
  394. data/lib/chef/provider/user/dscl.rb +1 -1
  395. data/lib/chef/provider/user/linux.rb +8 -3
  396. data/lib/chef/provider/user/mac.rb +2 -2
  397. data/lib/chef/provider/user/pw.rb +4 -4
  398. data/lib/chef/provider/user/solaris.rb +8 -8
  399. data/lib/chef/provider/user.rb +7 -4
  400. data/lib/chef/provider/windows_script.rb +2 -2
  401. data/lib/chef/provider/yum_repository.rb +2 -4
  402. data/lib/chef/provider/zypper_repository.rb +2 -2
  403. data/lib/chef/provider.rb +1 -1
  404. data/lib/chef/providers.rb +3 -1
  405. data/lib/chef/pwsh.rb +1 -1
  406. data/lib/chef/recipe.rb +9 -6
  407. data/lib/chef/request_id.rb +1 -1
  408. data/lib/chef/resource/_rest_resource.rb +156 -11
  409. data/lib/chef/resource/action_class.rb +1 -1
  410. data/lib/chef/resource/alternatives.rb +44 -43
  411. data/lib/chef/resource/apt_package.rb +38 -33
  412. data/lib/chef/resource/apt_preference.rb +25 -24
  413. data/lib/chef/resource/apt_repository.rb +16 -11
  414. data/lib/chef/resource/apt_update.rb +5 -4
  415. data/lib/chef/resource/archive_file.rb +21 -21
  416. data/lib/chef/resource/bash.rb +132 -131
  417. data/lib/chef/resource/batch.rb +1 -1
  418. data/lib/chef/resource/bff_package.rb +18 -17
  419. data/lib/chef/resource/breakpoint.rb +46 -45
  420. data/lib/chef/resource/build_essential.rb +1 -1
  421. data/lib/chef/resource/cab_package.rb +23 -23
  422. data/lib/chef/resource/chef_client_config.rb +73 -72
  423. data/lib/chef/resource/chef_client_cron.rb +21 -19
  424. data/lib/chef/resource/chef_client_hab_ca_cert.rb +141 -0
  425. data/lib/chef/resource/chef_client_launchd.rb +6 -2
  426. data/lib/chef/resource/chef_client_scheduled_task.rb +35 -32
  427. data/lib/chef/resource/chef_client_systemd_timer.rb +21 -18
  428. data/lib/chef/resource/chef_client_trusted_certificate.rb +29 -29
  429. data/lib/chef/resource/chef_gem.rb +1 -1
  430. data/lib/chef/resource/chef_handler.rb +108 -108
  431. data/lib/chef/resource/chef_sleep.rb +3 -2
  432. data/lib/chef/resource/chef_vault_secret.rb +1 -1
  433. data/lib/chef/resource/chocolatey_config.rb +15 -15
  434. data/lib/chef/resource/chocolatey_feature.rb +2 -2
  435. data/lib/chef/resource/chocolatey_installer.rb +31 -46
  436. data/lib/chef/resource/chocolatey_package.rb +1 -1
  437. data/lib/chef/resource/chocolatey_source.rb +16 -16
  438. data/lib/chef/resource/conditional.rb +1 -1
  439. data/lib/chef/resource/cookbook_file.rb +3 -2
  440. data/lib/chef/resource/cron/_cron_shared.rb +1 -1
  441. data/lib/chef/resource/cron/cron.rb +72 -71
  442. data/lib/chef/resource/cron/cron_d.rb +3 -2
  443. data/lib/chef/resource/cron_access.rb +3 -2
  444. data/lib/chef/resource/csh.rb +3 -2
  445. data/lib/chef/resource/directory.rb +4 -3
  446. data/lib/chef/resource/dmg_package.rb +1 -1
  447. data/lib/chef/resource/dnf_package.rb +2 -2
  448. data/lib/chef/resource/dpkg_package.rb +9 -6
  449. data/lib/chef/resource/dsc_resource.rb +1 -1
  450. data/lib/chef/resource/dsc_script.rb +1 -1
  451. data/lib/chef/resource/execute.rb +8 -1
  452. data/lib/chef/resource/file/verification/json.rb +1 -1
  453. data/lib/chef/resource/file/verification/systemd_unit.rb +5 -2
  454. data/lib/chef/resource/file/verification/yaml.rb +2 -2
  455. data/lib/chef/resource/file/verification.rb +4 -1
  456. data/lib/chef/resource/file.rb +3 -2
  457. data/lib/chef/resource/freebsd_package.rb +4 -3
  458. data/lib/chef/resource/gem_package.rb +1 -1
  459. data/lib/chef/resource/group.rb +33 -30
  460. data/lib/chef/resource/habitat/_habitat_shared.rb +1 -1
  461. data/lib/chef/resource/habitat/habitat_package.rb +83 -81
  462. data/lib/chef/resource/habitat/habitat_sup.rb +96 -95
  463. data/lib/chef/resource/habitat/habitat_sup_systemd.rb +14 -13
  464. data/lib/chef/resource/habitat/habitat_sup_windows.rb +5 -4
  465. data/lib/chef/resource/habitat_config.rb +37 -23
  466. data/lib/chef/resource/habitat_install.rb +22 -22
  467. data/lib/chef/resource/habitat_service.rb +9 -5
  468. data/lib/chef/resource/habitat_user_toml.rb +12 -12
  469. data/lib/chef/resource/helpers/cron_validations.rb +1 -1
  470. data/lib/chef/resource/helpers/path_helpers.rb +54 -0
  471. data/lib/chef/resource/homebrew_cask.rb +1 -1
  472. data/lib/chef/resource/homebrew_package.rb +21 -21
  473. data/lib/chef/resource/homebrew_tap.rb +10 -2
  474. data/lib/chef/resource/homebrew_update.rb +1 -1
  475. data/lib/chef/resource/hostname.rb +14 -11
  476. data/lib/chef/resource/http_request.rb +5 -4
  477. data/lib/chef/resource/ifconfig.rb +36 -35
  478. data/lib/chef/resource/inspec_input.rb +42 -39
  479. data/lib/chef/resource/inspec_waiver.rb +66 -65
  480. data/lib/chef/resource/inspec_waiver_file_entry.rb +28 -27
  481. data/lib/chef/resource/ips_package.rb +4 -3
  482. data/lib/chef/resource/kernel_module.rb +4 -3
  483. data/lib/chef/resource/ksh.rb +3 -2
  484. data/lib/chef/resource/launchd.rb +1 -1
  485. data/lib/chef/resource/link.rb +4 -3
  486. data/lib/chef/resource/locale.rb +11 -10
  487. data/lib/chef/resource/log.rb +3 -1
  488. data/lib/chef/resource/lwrp_base.rb +1 -1
  489. data/lib/chef/resource/macos_pkg.rb +1 -1
  490. data/lib/chef/resource/macos_userdefaults.rb +1 -1
  491. data/lib/chef/resource/macports_package.rb +1 -1
  492. data/lib/chef/resource/mdadm.rb +33 -33
  493. data/lib/chef/resource/mount.rb +7 -5
  494. data/lib/chef/resource/msu_package.rb +2 -2
  495. data/lib/chef/resource/notify_group.rb +3 -2
  496. data/lib/chef/resource/ohai.rb +37 -36
  497. data/lib/chef/resource/ohai_hint.rb +27 -26
  498. data/lib/chef/resource/openbsd_package.rb +4 -3
  499. data/lib/chef/resource/openssl_dhparam.rb +1 -1
  500. data/lib/chef/resource/openssl_ec_private_key.rb +1 -1
  501. data/lib/chef/resource/openssl_ec_public_key.rb +1 -1
  502. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
  503. data/lib/chef/resource/openssl_rsa_public_key.rb +1 -1
  504. data/lib/chef/resource/openssl_x509_certificate.rb +6 -2
  505. data/lib/chef/resource/openssl_x509_crl.rb +16 -16
  506. data/lib/chef/resource/openssl_x509_request.rb +2 -2
  507. data/lib/chef/resource/package.rb +4 -3
  508. data/lib/chef/resource/pacman_package.rb +2 -1
  509. data/lib/chef/resource/paludis_package.rb +3 -2
  510. data/lib/chef/resource/perl.rb +3 -2
  511. data/lib/chef/resource/plist.rb +4 -4
  512. data/lib/chef/resource/portage_package.rb +3 -2
  513. data/lib/chef/resource/powershell_package.rb +1 -1
  514. data/lib/chef/resource/powershell_package_source.rb +11 -11
  515. data/lib/chef/resource/powershell_script.rb +1 -1
  516. data/lib/chef/resource/python.rb +3 -2
  517. data/lib/chef/resource/reboot.rb +3 -2
  518. data/lib/chef/resource/registry_key.rb +78 -83
  519. data/lib/chef/resource/remote_directory.rb +3 -2
  520. data/lib/chef/resource/remote_file.rb +74 -73
  521. data/lib/chef/resource/resource_notification.rb +1 -1
  522. data/lib/chef/resource/rhsm_errata.rb +3 -2
  523. data/lib/chef/resource/rhsm_errata_level.rb +3 -2
  524. data/lib/chef/resource/rhsm_register.rb +13 -4
  525. data/lib/chef/resource/rhsm_repo.rb +5 -5
  526. data/lib/chef/resource/rhsm_subscription.rb +10 -10
  527. data/lib/chef/resource/route.rb +2 -1
  528. data/lib/chef/resource/rpm_package.rb +3 -2
  529. data/lib/chef/resource/ruby.rb +4 -2
  530. data/lib/chef/resource/ruby_block.rb +3 -1
  531. data/lib/chef/resource/scm/_scm.rb +1 -1
  532. data/lib/chef/resource/scm/git.rb +82 -81
  533. data/lib/chef/resource/scm/subversion.rb +12 -11
  534. data/lib/chef/resource/script.rb +4 -2
  535. data/lib/chef/resource/selinux/common_helpers.rb +1 -1
  536. data/lib/chef/resource/selinux/selinux_debian.erb +1 -1
  537. data/lib/chef/resource/selinux/selinux_default.erb +1 -1
  538. data/lib/chef/resource/selinux_boolean.rb +14 -13
  539. data/lib/chef/resource/selinux_fcontext.rb +23 -22
  540. data/lib/chef/resource/selinux_install.rb +20 -19
  541. data/lib/chef/resource/selinux_login.rb +13 -12
  542. data/lib/chef/resource/selinux_module.rb +20 -19
  543. data/lib/chef/resource/selinux_permissive.rb +10 -9
  544. data/lib/chef/resource/selinux_port.rb +17 -16
  545. data/lib/chef/resource/selinux_state.rb +29 -28
  546. data/lib/chef/resource/selinux_user.rb +16 -15
  547. data/lib/chef/resource/service.rb +9 -6
  548. data/lib/chef/resource/smartos_package.rb +4 -3
  549. data/lib/chef/resource/snap_package.rb +32 -23
  550. data/lib/chef/resource/solaris_package.rb +3 -2
  551. data/lib/chef/resource/ssh_known_hosts_entry.rb +13 -12
  552. data/lib/chef/resource/sudo.rb +71 -70
  553. data/lib/chef/resource/swap_file.rb +20 -19
  554. data/lib/chef/resource/sysctl.rb +49 -48
  555. data/lib/chef/resource/systemd_unit.rb +42 -39
  556. data/lib/chef/resource/template.rb +3 -2
  557. data/lib/chef/resource/timezone.rb +23 -22
  558. data/lib/chef/resource/user/aix_user.rb +4 -3
  559. data/lib/chef/resource/user/linux_user.rb +4 -4
  560. data/lib/chef/resource/user/mac_user.rb +5 -4
  561. data/lib/chef/resource/user/pw_user.rb +4 -3
  562. data/lib/chef/resource/user/solaris_user.rb +4 -3
  563. data/lib/chef/resource/user/windows_user.rb +2 -1
  564. data/lib/chef/resource/user.rb +8 -7
  565. data/lib/chef/resource/user_ulimit.rb +25 -24
  566. data/lib/chef/resource/windows_ad_join.rb +22 -22
  567. data/lib/chef/resource/windows_audit_policy.rb +35 -35
  568. data/lib/chef/resource/windows_auto_run.rb +9 -9
  569. data/lib/chef/resource/windows_certificate.rb +20 -20
  570. data/lib/chef/resource/windows_defender.rb +23 -23
  571. data/lib/chef/resource/windows_defender_exclusion.rb +18 -18
  572. data/lib/chef/resource/windows_dfs_folder.rb +1 -1
  573. data/lib/chef/resource/windows_dfs_namespace.rb +1 -1
  574. data/lib/chef/resource/windows_dfs_server.rb +1 -1
  575. data/lib/chef/resource/windows_dns_record.rb +1 -1
  576. data/lib/chef/resource/windows_dns_zone.rb +1 -1
  577. data/lib/chef/resource/windows_env.rb +6 -6
  578. data/lib/chef/resource/windows_feature.rb +43 -43
  579. data/lib/chef/resource/windows_feature_dism.rb +9 -9
  580. data/lib/chef/resource/windows_feature_powershell.rb +21 -21
  581. data/lib/chef/resource/windows_firewall_profile.rb +29 -29
  582. data/lib/chef/resource/windows_firewall_rule.rb +48 -48
  583. data/lib/chef/resource/windows_font.rb +7 -7
  584. data/lib/chef/resource/windows_package.rb +59 -59
  585. data/lib/chef/resource/windows_pagefile.rb +30 -30
  586. data/lib/chef/resource/windows_path.rb +13 -13
  587. data/lib/chef/resource/windows_printer.rb +29 -29
  588. data/lib/chef/resource/windows_printer_port.rb +22 -22
  589. data/lib/chef/resource/windows_script.rb +1 -1
  590. data/lib/chef/resource/windows_security_policy.rb +24 -24
  591. data/lib/chef/resource/windows_service.rb +107 -107
  592. data/lib/chef/resource/windows_share.rb +17 -17
  593. data/lib/chef/resource/windows_shortcut.rb +8 -8
  594. data/lib/chef/resource/windows_task.rb +103 -105
  595. data/lib/chef/resource/windows_uac.rb +15 -15
  596. data/lib/chef/resource/windows_update_settings.rb +27 -27
  597. data/lib/chef/resource/windows_user_privilege.rb +59 -59
  598. data/lib/chef/resource/windows_workgroup.rb +11 -11
  599. data/lib/chef/resource/yum_package.rb +5 -4
  600. data/lib/chef/resource/yum_repository.rb +37 -36
  601. data/lib/chef/resource/zypper_package.rb +3 -2
  602. data/lib/chef/resource/zypper_repository.rb +4 -3
  603. data/lib/chef/resource.rb +11 -3
  604. data/lib/chef/resource_builder.rb +1 -1
  605. data/lib/chef/resource_collection/resource_collection_serialization.rb +1 -1
  606. data/lib/chef/resource_collection/resource_list.rb +1 -1
  607. data/lib/chef/resource_collection/resource_set.rb +10 -4
  608. data/lib/chef/resource_collection.rb +1 -1
  609. data/lib/chef/resource_definition.rb +1 -1
  610. data/lib/chef/resource_definition_list.rb +1 -1
  611. data/lib/chef/resource_inspector.rb +3 -1
  612. data/lib/chef/resource_reporter.rb +2 -1
  613. data/lib/chef/resource_resolver.rb +1 -1
  614. data/lib/chef/resources.rb +2 -2
  615. data/lib/chef/role.rb +1 -1
  616. data/lib/chef/run_context/cookbook_compiler.rb +1 -1
  617. data/lib/chef/run_context.rb +2 -2
  618. data/lib/chef/run_list/run_list_expansion.rb +1 -1
  619. data/lib/chef/run_list/run_list_item.rb +5 -5
  620. data/lib/chef/run_list/versioned_recipe_list.rb +1 -1
  621. data/lib/chef/run_list.rb +1 -1
  622. data/lib/chef/run_lock.rb +4 -1
  623. data/lib/chef/run_status.rb +1 -1
  624. data/lib/chef/runner.rb +1 -1
  625. data/lib/chef/scan_access_control.rb +9 -7
  626. data/lib/chef/search/query.rb +1 -1
  627. data/lib/chef/secret_fetcher/akeyless_vault.rb +1 -1
  628. data/lib/chef/secret_fetcher/aws_secrets_manager.rb +1 -1
  629. data/lib/chef/secret_fetcher/base.rb +1 -1
  630. data/lib/chef/secret_fetcher/example.rb +1 -1
  631. data/lib/chef/secret_fetcher/hashi_vault.rb +10 -1
  632. data/lib/chef/secret_fetcher.rb +1 -1
  633. data/lib/chef/server_api.rb +1 -1
  634. data/lib/chef/server_api_versions.rb +1 -1
  635. data/lib/chef/shell/ext.rb +20 -20
  636. data/lib/chef/shell/model_wrapper.rb +1 -1
  637. data/lib/chef/shell/shell_session.rb +2 -2
  638. data/lib/chef/shell.rb +30 -8
  639. data/lib/chef/target_io/dir.rb +12 -0
  640. data/lib/chef/target_io/etc.rb +16 -0
  641. data/lib/chef/target_io/file.rb +12 -0
  642. data/lib/chef/target_io/fileutils.rb +12 -0
  643. data/lib/chef/target_io/http.rb +35 -0
  644. data/lib/chef/target_io/io.rb +12 -0
  645. data/lib/chef/target_io/shadow.rb +44 -0
  646. data/lib/chef/target_io/support.rb +73 -0
  647. data/lib/chef/target_io/train/dir.rb +86 -0
  648. data/lib/chef/target_io/train/etc.rb +108 -0
  649. data/lib/chef/target_io/train/file.rb +219 -0
  650. data/lib/chef/target_io/train/fileutils.rb +201 -0
  651. data/lib/chef/target_io/train/http.rb +117 -0
  652. data/lib/chef/target_io/train/io.rb +13 -0
  653. data/lib/chef/target_io/train/shadow.rb +54 -0
  654. data/lib/chef/target_io/train_compat.rb +7 -0
  655. data/lib/chef/target_io.rb +11 -0
  656. data/lib/chef/train_transport.rb +1 -1
  657. data/lib/chef/user.rb +1 -1
  658. data/lib/chef/user_v1.rb +1 -1
  659. data/lib/chef/util/backup.rb +2 -2
  660. data/lib/chef/util/diff.rb +15 -2
  661. data/lib/chef/util/dsc/configuration_generator.rb +1 -1
  662. data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
  663. data/lib/chef/util/dsc/local_configuration_manager.rb +1 -1
  664. data/lib/chef/util/dsc/resource_store.rb +1 -1
  665. data/lib/chef/util/editor.rb +1 -1
  666. data/lib/chef/util/file_edit.rb +5 -5
  667. data/lib/chef/util/path_helper.rb +1 -1
  668. data/lib/chef/util/powershell/ps_credential.rb +1 -1
  669. data/lib/chef/util/selinux.rb +1 -1
  670. data/lib/chef/util/threaded_job_queue.rb +1 -1
  671. data/lib/chef/util/windows/logon_session.rb +1 -1
  672. data/lib/chef/version.rb +2 -2
  673. data/lib/chef/version_class.rb +1 -1
  674. data/lib/chef/version_constraint.rb +2 -2
  675. data/lib/chef/win32/api/command_line_helper.rb +1 -1
  676. data/lib/chef/win32/api/crypto.rb +1 -1
  677. data/lib/chef/win32/api/error.rb +1 -1
  678. data/lib/chef/win32/api/file.rb +3 -2
  679. data/lib/chef/win32/api/installer.rb +1 -1
  680. data/lib/chef/win32/api/memory.rb +1 -1
  681. data/lib/chef/win32/api/net.rb +1 -1
  682. data/lib/chef/win32/api/process.rb +1 -1
  683. data/lib/chef/win32/api/psapi.rb +1 -1
  684. data/lib/chef/win32/api/registry.rb +1 -1
  685. data/lib/chef/win32/api/security.rb +1 -1
  686. data/lib/chef/win32/api/synchronization.rb +1 -1
  687. data/lib/chef/win32/api/system.rb +1 -1
  688. data/lib/chef/win32/api/unicode.rb +1 -1
  689. data/lib/chef/win32/api.rb +1 -1
  690. data/lib/chef/win32/crypto.rb +1 -1
  691. data/lib/chef/win32/error.rb +3 -2
  692. data/lib/chef/win32/eventlog.rb +1 -1
  693. data/lib/chef/win32/file/info.rb +1 -1
  694. data/lib/chef/win32/file/version_info.rb +1 -1
  695. data/lib/chef/win32/file.rb +1 -1
  696. data/lib/chef/win32/handle.rb +1 -1
  697. data/lib/chef/win32/memory.rb +1 -1
  698. data/lib/chef/win32/mutex.rb +1 -1
  699. data/lib/chef/win32/net.rb +1 -1
  700. data/lib/chef/win32/process.rb +1 -1
  701. data/lib/chef/win32/registry.rb +4 -2
  702. data/lib/chef/win32/security/ace.rb +1 -1
  703. data/lib/chef/win32/security/acl.rb +1 -1
  704. data/lib/chef/win32/security/securable_object.rb +1 -1
  705. data/lib/chef/win32/security/security_descriptor.rb +1 -1
  706. data/lib/chef/win32/security/sid.rb +1 -1
  707. data/lib/chef/win32/security/token.rb +1 -1
  708. data/lib/chef/win32/security.rb +1 -1
  709. data/lib/chef/win32/system.rb +1 -1
  710. data/lib/chef/win32/unicode.rb +1 -1
  711. data/lib/chef/win32/version.rb +2 -3
  712. data/lib/chef/workstation_config_loader.rb +1 -1
  713. data/lib/chef.rb +3 -1
  714. metadata +125 -84
  715. data/lib/chef/resource/osx_profile.rb +0 -334
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Chef Software, Inc.
2
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,175 +21,176 @@ class Chef
21
21
  class Resource
22
22
  class HabitatSup < Chef::Resource
23
23
 
24
- provides :habitat_sup do |_node|
24
+ provides(:habitat_sup, target_mode: true) do |_node|
25
25
  false
26
26
  end
27
+ target_mode support: :full
27
28
 
28
29
  description "Use the **habitat_sup** resource to runs a Chef Habitat supervisor for one or more Chef Habitat services. The resource is commonly used in conjunction with `habitat_service` which will manage the services loaded and started within the supervisor."
29
30
  introduced "17.3"
30
31
  examples <<~DOC
31
- **Set up with just the defaults**
32
+ **Set up with just the defaults**
32
33
 
33
- ```ruby
34
- habitat_sup 'default'
35
- ```
34
+ ```ruby
35
+ habitat_sup 'default'
36
+ ```
36
37
 
37
- **Update listen ports and use Supervisor toml config**
38
+ **Update listen ports and use Supervisor toml config**
38
39
 
39
- ```ruby
40
- habitat_sup 'test-options' do
41
- listen_http '0.0.0.0:9999'
42
- listen_gossip '0.0.0.0:9998'
43
- toml_config true
44
- end
45
- ```
40
+ ```ruby
41
+ habitat_sup 'test-options' do
42
+ listen_http '0.0.0.0:9999'
43
+ listen_gossip '0.0.0.0:9998'
44
+ toml_config true
45
+ end
46
+ ```
46
47
 
47
- **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
48
+ **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
48
49
 
49
- ```ruby
50
- habitat_sup 'default' do
51
- bldr_url 'https://bldr.example.com'
52
- end
53
- ```
50
+ ```ruby
51
+ habitat_sup 'default' do
52
+ bldr_url 'https://bldr.example.com'
53
+ end
54
+ ```
54
55
 
55
- **Using update_condition**
56
+ **Using update_condition**
56
57
 
57
- ```ruby
58
- habitat_sup 'default' do
59
- bldr_url 'https://bldr.example.com'
60
- habitat_channel 'dev'
61
- update_condition 'track-channel'
62
- end
63
- ```
64
-
65
- **Provide event stream information**
66
-
67
- ```ruby
68
- habitat_sup 'default' do
69
- license 'accept'
70
- event_stream_application 'myapp'
71
- event_stream_environment 'production'
72
- event_stream_site 'MySite'
73
- event_stream_url 'automate.example.com:4222'
74
- event_stream_token 'myawesomea2clitoken='
75
- event_stream_cert '/hab/cache/ssl/mycert.crt'
76
- end
77
- ```
58
+ ```ruby
59
+ habitat_sup 'default' do
60
+ bldr_url 'https://bldr.example.com'
61
+ habitat_channel 'dev'
62
+ update_condition 'track-channel'
63
+ end
64
+ ```
65
+
66
+ **Provide event stream information**
67
+
68
+ ```ruby
69
+ habitat_sup 'default' do
70
+ license 'accept'
71
+ event_stream_application 'myapp'
72
+ event_stream_environment 'production'
73
+ event_stream_site 'MySite'
74
+ event_stream_url 'automate.example.com:4222'
75
+ event_stream_token 'myawesomea2clitoken='
76
+ event_stream_cert '/hab/cache/ssl/mycert.crt'
77
+ end
78
+ ```
78
79
 
79
- **Provide specific versions**
80
+ **Provide specific versions**
80
81
 
81
- ```ruby
82
- habitat_sup 'default' do
83
- bldr_url 'https://bldr.example.com'
84
- sup_version '1.5.50'
85
- launcher_version '13458'
86
- service_version '0.6.0' # WINDOWS ONLY
87
- end
88
- ```
82
+ ```ruby
83
+ habitat_sup 'default' do
84
+ bldr_url 'https://bldr.example.com'
85
+ sup_version '1.5.50'
86
+ launcher_version '13458'
87
+ service_version '0.6.0' # WINDOWS ONLY
88
+ end
89
+ ```
89
90
 
90
- **Set latest version of packages to retain**
91
+ **Set latest version of packages to retain**
91
92
 
92
- habitat_sup 'default' do
93
- bldr_url 'https://bldr.example.com'
94
- sup_version '1.5.86'
95
- launcher_version '13458'
96
- service_version '0.6.0' # WINDOWS ONLY
97
- keep_latest '2'
98
- end
99
- ```
93
+ habitat_sup 'default' do
94
+ bldr_url 'https://bldr.example.com'
95
+ sup_version '1.5.86'
96
+ launcher_version '13458'
97
+ service_version '0.6.0' # WINDOWS ONLY
98
+ keep_latest '2'
99
+ end
100
+ ```
100
101
  DOC
101
102
 
102
103
  property :bldr_url, String,
103
- description: "The Habitat Builder URL for the `habitat_package` resource, if needed."
104
+ description: "The Habitat Builder URL for the `habitat_package` resource, if needed."
104
105
 
105
106
  property :permanent_peer, [true, false], default: false,
106
- description: "Only valid for `:run` action, passes `--permanent-peer` to the hab command."
107
+ description: "Only valid for `:run` action, passes `--permanent-peer` to the hab command."
107
108
 
108
109
  property :listen_ctl, String,
109
- description: "Only valid for `:run` action, passes `--listen-ctl` with the specified address and port, e.g., `0.0.0.0:9632`, to the hab command."
110
+ description: "Only valid for `:run` action, passes `--listen-ctl` with the specified address and port, e.g., `0.0.0.0:9632`, to the hab command."
110
111
 
111
112
  property :listen_gossip, String,
112
- description: "Only valid for `:run` action, passes `--listen-gossip` with the specified address and port, e.g., `0.0.0.0:9638`, to the hab command."
113
+ description: "Only valid for `:run` action, passes `--listen-gossip` with the specified address and port, e.g., `0.0.0.0:9638`, to the hab command."
113
114
 
114
115
  property :listen_http, String,
115
- description: "Only valid for `:run` action, passes `--listen-http` with the specified address and port, e.g., `0.0.0.0:9631`, to the hab command."
116
+ description: "Only valid for `:run` action, passes `--listen-http` with the specified address and port, e.g., `0.0.0.0:9631`, to the hab command."
116
117
 
117
118
  property :org, String, default: "default",
118
- description: "Only valid for `:run` action, passes `--org` with the specified org name to the hab command."
119
+ description: "Only valid for `:run` action, passes `--org` with the specified org name to the hab command."
119
120
 
120
121
  property :peer, [String, Array], coerce: proc { |b| b.is_a?(String) ? [b] : b },
121
- description: "Only valid for `:run` action, passes `--peer` with the specified initial peer to the hab command."
122
+ description: "Only valid for `:run` action, passes `--peer` with the specified initial peer to the hab command."
122
123
 
123
124
  property :ring, String,
124
- description: "Only valid for `:run` action, passes `--ring` with the specified ring key name to the hab command."
125
+ description: "Only valid for `:run` action, passes `--ring` with the specified ring key name to the hab command."
125
126
 
126
127
  property :hab_channel, String,
127
- description: "The channel to install Habitat from. Defaults to stable"
128
+ description: "The channel to install Habitat from. Defaults to stable"
128
129
 
129
130
  property :auto_update, [true, false], default: false,
130
- description: "Passes `--auto-update`. This will set the Habitat supervisor to automatically update itself any time a stable version has been released."
131
+ description: "Passes `--auto-update`. This will set the Habitat supervisor to automatically update itself any time a stable version has been released."
131
132
 
132
133
  property :auth_token, String,
133
- description: "Auth token for accessing a private organization on bldr. This value is templated into the appropriate service file."
134
+ description: "Auth token for accessing a private organization on bldr. This value is templated into the appropriate service file."
134
135
 
135
136
  property :gateway_auth_token, String,
136
- description: "Auth token for accessing the supervisor's HTTP gateway. This value is templated into the appropriate service file."
137
+ description: "Auth token for accessing the supervisor's HTTP gateway. This value is templated into the appropriate service file."
137
138
 
138
139
  property :update_condition, String,
139
- description: "Passes `--update-condition` dictating when this service should updated. Defaults to `latest`. Options are `latest` or `track-channel` **_Note: This requires a minimum habitat version of 1.5.71_**
140
+ description: "Passes `--update-condition` dictating when this service should updated. Defaults to `latest`. Options are `latest` or `track-channel` **_Note: This requires a minimum habitat version of 1.5.71_**
140
141
  - `latest`: Runs the latest package that can be found in the configured channel and local packages.
141
142
  - `track-channel`: Always run what is at the head of a given channel. This enables service rollback where demoting a package from a channel will cause the package to rollback to an older version of the package. A ramification of enabling this condition is packages newer than the package at the head of the channel will be automatically uninstalled during a service rollback."
142
143
 
143
144
  property :limit_no_files, String,
144
- description: "allows you to set LimitNOFILE in the systemd service when used Note: Linux Only."
145
+ description: "allows you to set LimitNOFILE in the systemd service when used Note: Linux Only."
145
146
 
146
147
  property :license, String, equal_to: ["accept"],
147
- description: "Specifies acceptance of habitat license when set to `accept`."
148
+ description: "Specifies acceptance of habitat license when set to `accept`."
148
149
 
149
150
  property :health_check_interval, [String, Integer], coerce: proc { |h| h.is_a?(String) ? h : h.to_s },
150
- description: "The interval (seconds) on which to run health checks."
151
+ description: "The interval (seconds) on which to run health checks."
151
152
 
152
153
  property :event_stream_application, String,
153
- description: "The name of your application that will be displayed in the Chef Automate Applications Dashboard."
154
+ description: "The name of your application that will be displayed in the Chef Automate Applications Dashboard."
154
155
 
155
156
  property :event_stream_environment, String,
156
- description: "The application environment for the supervisor, this is for grouping in the Applications Dashboard."
157
+ description: "The application environment for the supervisor, this is for grouping in the Applications Dashboard."
157
158
 
158
159
  property :event_stream_site, String,
159
- description: "Application Dashboard label for the 'site' of the application - can be filtered in the dashboard."
160
+ description: "Application Dashboard label for the 'site' of the application - can be filtered in the dashboard."
160
161
 
161
162
  property :event_stream_url, String,
162
- description: "`AUTOMATE_HOSTNAME:4222` - the Chef Automate URL with port 4222 specified Note: The port can be changed if needed."
163
+ description: "`AUTOMATE_HOSTNAME:4222` - the Chef Automate URL with port 4222 specified Note: The port can be changed if needed."
163
164
 
164
165
  property :event_stream_token, String,
165
- description: "Chef Automate token for sending application event stream data."
166
+ description: "Chef Automate token for sending application event stream data."
166
167
 
167
168
  property :event_stream_cert, String,
168
- description: "With `Intermediary Certificates` or, Automate 2 being set to use TLS with a valid cert, you will need to provide `Habitat` with your certificate for communication with Automate to work. [Follow these steps!](https://automate.chef.io/docs/applications-setup/#share-the-tls-certificate-with-chef-habitat)."
169
+ description: "With `Intermediary Certificates` or, Automate 2 being set to use TLS with a valid cert, you will need to provide `Habitat` with your certificate for communication with Automate to work. [Follow these steps!](https://automate.chef.io/docs/applications-setup/#share-the-tls-certificate-with-chef-habitat)."
169
170
 
170
171
  property :sup_version, String,
171
- description: "Allows you to choose which version of supervisor you would like to install. Note: If a version is provided, it will also install that version of habitat if not previously installed."
172
+ description: "Allows you to choose which version of supervisor you would like to install. Note: If a version is provided, it will also install that version of habitat if not previously installed."
172
173
 
173
174
  property :launcher_version, String,
174
- description: "Allows you to choose which version of launcher to install."
175
+ description: "Allows you to choose which version of launcher to install."
175
176
 
176
177
  property :service_version, String, # Windows only
177
- description: "Allows you to choose which version of the **_Windows Service_** to install."
178
+ description: "Allows you to choose which version of the **_Windows Service_** to install."
178
179
 
179
180
  property :keep_latest, String,
180
- description: "Automatically cleans up old packages. If this flag is enabled, service startup will initiate an uninstall of all previous versions of the associated package. This also applies when a service is restarted due to an update. If a number is passed to this argument, that number of latest versions will be kept. The same logic applies to the Supervisor package `env:HAB_KEEP_LATEST_PACKAGES=1` Note: This requires Habitat version `1.5.86+`"
181
+ description: "Automatically cleans up old packages. If this flag is enabled, service startup will initiate an uninstall of all previous versions of the associated package. This also applies when a service is restarted due to an update. If a number is passed to this argument, that number of latest versions will be kept. The same logic applies to the Supervisor package `env:HAB_KEEP_LATEST_PACKAGES=1` Note: This requires Habitat version `1.5.86+`"
181
182
 
182
183
  property :toml_config, [true, false], default: false,
183
- description: "Supports using the Supervisor toml configuration instead of passing exec parameters to the service, [reference](https://www.habitat.sh/docs/reference/#supervisor-config)."
184
+ description: "Supports using the Supervisor toml configuration instead of passing exec parameters to the service, [reference](https://www.habitat.sh/docs/reference/#supervisor-config)."
184
185
 
185
186
  action :run, description: "The `run` action handles installing Habitat using the `habitat_install` resource, ensures that the appropriate versions of the `core/hab-sup` and `core/hab-launcher` packages are installed using `habitat_package`, and then drops off the appropriate init system definitions and manages the service." do
186
187
  habitat_install new_resource.name do
187
188
  license new_resource.license
188
189
  hab_version new_resource.sup_version if new_resource.sup_version
189
- not_if { ::File.exist?("/bin/hab") }
190
- not_if { ::File.exist?("/usr/bin/hab") }
191
- not_if { ::File.exist?("c:/habitat/hab.exe") }
192
- not_if { ::File.exist?("c:/ProgramData/Habitat/hab.exe") }
190
+ not_if { ::TargetIO::File.exist?("/bin/hab") }
191
+ not_if { ::TargetIO::File.exist?("/usr/bin/hab") }
192
+ not_if { ::TargetIO::File.exist?("c:/habitat/hab.exe") }
193
+ not_if { ::TargetIO::File.exist?("c:/ProgramData/Habitat/hab.exe") }
193
194
  end
194
195
 
195
196
  habitat_package "core/hab-sup" do
@@ -205,7 +206,7 @@ class Chef
205
206
  if windows?
206
207
  directory "C:/hab/sup/default/config" do
207
208
  recursive true
208
- only_if { ::Dir.exist?("C:/hab") }
209
+ only_if { ::TargetIO::Dir.exist?("C:/hab") }
209
210
  only_if { use_toml_config }
210
211
  action :create
211
212
  end
@@ -235,14 +236,14 @@ class Chef
235
236
  keep_latest_packages: new_resource.keep_latest
236
237
  )
237
238
  only_if { use_toml_config }
238
- only_if { ::Dir.exist?("C:/hab/sup/default/config") }
239
+ only_if { ::TargetIO::Dir.exist?("C:/hab/sup/default/config") }
239
240
  end
240
241
  else
241
242
  directory "/hab/sup/default/config" do
242
243
  mode "0755"
243
244
  recursive true
244
245
  only_if { use_toml_config }
245
- only_if { ::Dir.exist?("/hab") }
246
+ only_if { ::TargetIO::Dir.exist?("/hab") }
246
247
  action :create
247
248
  end
248
249
 
@@ -271,7 +272,7 @@ class Chef
271
272
  keep_latest_packages: new_resource.keep_latest
272
273
  )
273
274
  only_if { use_toml_config }
274
- only_if { ::Dir.exist?("/hab/sup/default/config") }
275
+ only_if { ::TargetIO::Dir.exist?("/hab/sup/default/config") }
275
276
  end
276
277
  end
277
278
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Chef Software, Inc.
2
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,8 +20,9 @@ require_relative "habitat_sup"
20
20
  class Chef
21
21
  class Resource
22
22
  class HabitatSupSystemd < HabitatSup
23
- provides :habitat_sup, os: "linux"
24
- provides :habitat_sup_systemd
23
+ provides :habitat_sup, os: "linux", target_mode: true
24
+ provides :habitat_sup_systemd, target_mode: true
25
+ target_mode support: :full
25
26
 
26
27
  action :run do
27
28
  super()
@@ -34,16 +35,16 @@ class Chef
34
35
  content(Unit: {
35
36
  Description: "The Habitat Supervisor",
36
37
  },
37
- Service: {
38
- LimitNOFILE: new_resource.limit_no_files,
39
- Environment: service_environment,
40
- ExecStart: "/bin/hab sup run #{exec_start_options}",
41
- ExecStop: "/bin/hab sup term",
42
- Restart: "on-failure",
43
- }.compact,
44
- Install: {
45
- WantedBy: "default.target",
46
- })
38
+ Service: {
39
+ LimitNOFILE: new_resource.limit_no_files,
40
+ Environment: service_environment,
41
+ ExecStart: "/bin/hab sup run #{exec_start_options}",
42
+ ExecStop: "/bin/hab sup term",
43
+ Restart: "on-failure",
44
+ }.compact,
45
+ Install: {
46
+ WantedBy: "default.target",
47
+ })
47
48
  action :create
48
49
  end
49
50
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Chef Software, Inc.
2
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,6 +23,7 @@ class Chef
23
23
  class HabitatSupWindows < HabitatSup
24
24
  provides :habitat_sup, os: "windows"
25
25
  provides :habitat_sup_windows
26
+ target_mode support: false
26
27
 
27
28
  service_file = ::File.expand_path("../support/HabService.dll.config.erb")
28
29
  win_service_config = "C:/hab/svc/windows-service/HabService.dll.config"
@@ -66,9 +67,9 @@ class Chef
66
67
  local true
67
68
  cookbook "habitat"
68
69
  variables exec_start_options: exec_start_options,
69
- bldr_url: new_resource.bldr_url,
70
- auth_token: new_resource.auth_token,
71
- gateway_auth_token: new_resource.gateway_auth_token
70
+ bldr_url: new_resource.bldr_url,
71
+ auth_token: new_resource.auth_token,
72
+ gateway_auth_token: new_resource.gateway_auth_token
72
73
  # win_launcher: win_version
73
74
  action :touch
74
75
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Chef Software Inc.
1
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,27 +17,30 @@ require_relative "../http"
17
17
  require_relative "../json_compat"
18
18
  require_relative "../resource"
19
19
 
20
+ require "tmpdir" unless defined?(Dir::Tmpname)
21
+
20
22
  class Chef
21
23
  class Resource
22
24
  class HabitatConfig < Chef::Resource
23
25
 
24
- provides :habitat_config
26
+ provides :habitat_config, target_mode: true
27
+ target_mode support: :full
25
28
 
26
29
  description "Use the **habitat_config** resource to apply a configuration to a Chef Habitat service."
27
30
  introduced "17.3"
28
31
  examples <<~DOC
29
- **Configure your nginx defaults**
30
-
31
- ```ruby
32
- habitat_config 'nginx.default' do
33
- config({
34
- worker_count: 2,
35
- http: {
36
- keepalive_timeout: 120
37
- }
38
- })
39
- end
40
- ```
32
+ **Configure your nginx defaults**
33
+
34
+ ```ruby
35
+ habitat_config 'nginx.default' do
36
+ config({
37
+ worker_count: 2,
38
+ http: {
39
+ keepalive_timeout: 120
40
+ }
41
+ })
42
+ end
43
+ ```
41
44
  DOC
42
45
 
43
46
  property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },
@@ -60,12 +63,23 @@ class Chef
60
63
  description: "Name of user key to use for encryption. Passes `--user` to `hab config apply`."
61
64
 
62
65
  load_current_value do
66
+ def census(http_uri)
67
+ headers = {}
68
+ headers["Authorization"] = "Bearer #{gateway_auth_token}" if property_is_set?(:gateway_auth_token)
69
+
70
+ if Chef::Config.target_mode?
71
+ raw = TargetIO::HTTP.new(http_uri).get("/census", headers)
72
+ response = from_json(raw)
73
+ else
74
+ response = Chef::HTTP::SimpleJSON.new(http_uri).get("/census", headers)
75
+ end
76
+
77
+ Mash.new(response)
78
+ end
79
+
63
80
  http_uri = "http://#{remote_sup_http}"
64
81
 
65
82
  begin
66
- headers = {}
67
- headers["Authorization"] = "Bearer #{gateway_auth_token}" if property_is_set?(:gateway_auth_token)
68
- census = Mash.new(Chef::HTTP::SimpleJSON.new(http_uri).get("/census", headers))
69
83
  sc = census["census_groups"][service_group]["service_config"]["value"]
70
84
  rescue
71
85
  # Default to a blank config if anything (http error, json parsing, finding
@@ -85,15 +99,15 @@ class Chef
85
99
  opts << ["--remote-sup", new_resource.remote_sup] if new_resource.remote_sup
86
100
  opts << ["--user", new_resource.user] if new_resource.user
87
101
 
88
- tempfile = Tempfile.new(["habitat_config", ".toml"])
89
- begin
102
+ tempname = Dir::Tmpname.create(["habitat_config", ".toml"]) {}
103
+ TargetIO::File.open(tempname, "w") do |tempfile|
90
104
  tempfile.write(render_toml(new_resource.config))
91
- tempfile.close
105
+ end
92
106
 
93
- hab("config", "apply", opts, new_resource.service_group, incarnation, tempfile.path)
107
+ begin
108
+ hab("config", "apply", opts, new_resource.service_group, incarnation, tempname)
94
109
  ensure
95
- tempfile.close
96
- tempfile.unlink
110
+ TargetIO::File.unlink(tempname)
97
111
  end
98
112
  end
99
113
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Chef Software, Inc.
2
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,33 +19,34 @@ require_relative "../resource"
19
19
  class Chef
20
20
  class Resource
21
21
  class HabitatInstall < Chef::Resource
22
- provides :habitat_install
22
+ provides :habitat_install, target_mode: true
23
+ target_mode support: :full
23
24
 
24
25
  description "Use the **habitat_install** resource to install Chef Habitat."
25
26
  introduced "17.3"
26
27
  examples <<~DOC
27
- **Installation Without a Resource Name**
28
+ **Installation Without a Resource Name**
28
29
 
29
- ```ruby
30
- habitat_install
31
- ```
30
+ ```ruby
31
+ habitat_install
32
+ ```
32
33
 
33
- **Installation specifying a habitat builder URL**
34
+ **Installation specifying a habitat builder URL**
34
35
 
35
- ```ruby
36
- habitat_install 'install habitat' do
37
- bldr_url 'http://localhost'
38
- end
39
- ```
36
+ ```ruby
37
+ habitat_install 'install habitat' do
38
+ bldr_url 'http://localhost'
39
+ end
40
+ ```
40
41
 
41
- **Installation specifying version and habitat builder URL**
42
+ **Installation specifying version and habitat builder URL**
42
43
 
43
- ```ruby
44
- habitat_install 'install habitat' do
45
- bldr_url 'http://localhost'
46
- hab_version '1.5.50'
47
- end
48
- ```
44
+ ```ruby
45
+ habitat_install 'install habitat' do
46
+ bldr_url 'http://localhost'
47
+ hab_version '1.5.50'
48
+ end
49
+ ```
49
50
  DOC
50
51
 
51
52
  property :name, String, default: "install habitat",
@@ -70,7 +71,7 @@ class Chef
70
71
  description: "Specify the version of `Habitat` you would like to install."
71
72
 
72
73
  action :install, description: "Installs Habitat. Does nothing if the `hab` binary is found in the default location for the system (`/bin/hab` on Linux, `/usr/local/bin/hab` on macOS, `C:/habitat/hab.exe` on Windows)" do
73
- if ::File.exist?(hab_path)
74
+ if ::TargetIO::File.exist?(hab_path)
74
75
  cmd = shell_out!([hab_path, "--version"].flatten.compact.join(" "))
75
76
  version = %r{hab (\d*\.\d*\.\d[^\/]*)}.match(cmd.stdout)[1]
76
77
  return if version == new_resource.hab_version
@@ -94,7 +95,7 @@ class Chef
94
95
  path habfile
95
96
  destination "#{Chef::Config[:file_cache_path]}/habitat"
96
97
  action :extract
97
- not_if { ::Dir.exist?("c:\\habitat") }
98
+ not_if { ::TargetIO::Dir.exist?("c:\\habitat") }
98
99
  end
99
100
 
100
101
  directory "c:\\habitat" do
@@ -238,7 +239,6 @@ class Chef
238
239
  def hab_command
239
240
  cmd = "#{Chef::Config[:file_cache_path]}/hab-install.sh"
240
241
  cmd << " -v #{new_resource.hab_version} " if new_resource.hab_version
241
- cmd << " -t x86_64-linux-kernel2" if node["kernel"]["release"].to_i < 3
242
242
  cmd
243
243
  end
244
244
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Chef Software, Inc.
1
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,7 +20,8 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
20
20
  class Chef
21
21
  class Resource
22
22
  class HabitatService < Chef::Resource
23
- provides :habitat_service
23
+ provides :habitat_service, target_mode: true
24
+ target_mode support: :full
24
25
 
25
26
  description "Use the **habitat_service** resource to manage Chef Habitat services. This requires that `core/hab-sup` be running as a service. See the `habitat_sup` resource documentation for more information. Note: Applications may run as a specific user. Often with Habitat, the default is `hab`, or `root`. If the application requires another user, then it should be created with Chef's `user` resource."
26
27
  introduced "17.3"
@@ -181,7 +182,7 @@ class Chef
181
182
  http_uri = "http://#{remote_sup_http}"
182
183
 
183
184
  begin
184
- TCPSocket.new(URI(http_uri).host, URI(http_uri).port).close
185
+ TCPSocket.new(URI(http_uri).host, URI(http_uri).port).close unless Chef::Config.target_mode?
185
186
  rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
186
187
  Chef::Log.debug("Could not connect to #{http_uri} to retrieve status for #{service_name}")
187
188
  return false
@@ -190,7 +191,7 @@ class Chef
190
191
  begin
191
192
  headers = {}
192
193
  headers["Authorization"] = "Bearer #{gateway_auth_token}" if property_is_set?(:gateway_auth_token)
193
- svcs = Chef::HTTP::SimpleJSON.new(http_uri).get("/services", headers)
194
+ svcs = TargetIO::HTTP::SimpleJSON.new(http_uri).get("/services", headers)
194
195
  rescue
195
196
  Chef::Log.debug("Could not connect to #{http_uri}/services to retrieve status for #{service_name}")
196
197
  return false
@@ -337,10 +338,13 @@ class Chef
337
338
  end
338
339
 
339
340
  unless current_resource.loaded && !modified
340
- execute "test" do
341
+ execute "load service" do
341
342
  command "hab svc load #{new_resource.service_name} #{options.join(" ")}"
342
343
  retry_delay 10
343
344
  retries 5
345
+
346
+ # compensate for lack of TCPSocket support in TM by retries
347
+ returns [0, 1] if Chef::Config.target_mode?
344
348
  end
345
349
  end
346
350
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Chef Software Inc.
1
+ # Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,18 +21,18 @@ class Chef
21
21
  description "Use the **habitat_user_toml** to template a `user.toml` for Chef Habitat services. Configurations set in the `user.toml` override the `default.toml` for a given package, which makes it an alternative to applying service group level configuration."
22
22
  introduced "17.3"
23
23
  examples <<~DOC
24
- **Configure user specific settings to nginx**
24
+ **Configure user specific settings to nginx**
25
25
 
26
- ```ruby
27
- habitat_user_toml 'nginx' do
28
- config({
29
- worker_count: 2,
30
- http: {
31
- keepalive_timeout: 120
32
- }
33
- })
34
- end
35
- ```
26
+ ```ruby
27
+ habitat_user_toml 'nginx' do
28
+ config({
29
+ worker_count: 2,
30
+ http: {
31
+ keepalive_timeout: 120
32
+ }
33
+ })
34
+ end
35
+ ```
36
36
  DOC
37
37
 
38
38
  property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },