chef 18.9.4-universal-mingw-ucrt → 19.1.164-universal-mingw-ucrt
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.
- checksums.yaml +4 -4
- data/Gemfile +24 -22
- data/README.md +6 -2
- data/Rakefile +12 -7
- data/chef-universal-mingw-ucrt.gemspec +1 -1
- data/chef.gemspec +18 -20
- data/lib/chef/action_collection.rb +3 -1
- data/lib/chef/api_client/registration.rb +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/api_client_v1.rb +1 -1
- data/lib/chef/application/apply.rb +31 -4
- data/lib/chef/application/base.rb +38 -7
- data/lib/chef/application/client.rb +15 -1
- data/lib/chef/application/exit_code.rb +4 -2
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/application.rb +6 -1
- data/lib/chef/chef_class.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/command_line.rb +8 -7
- data/lib/chef/chef_fs/config.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system/base_fs_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/base_fs_object.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +3 -4
- data/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policies_acl_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/exceptions.rb +1 -1
- data/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acl.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +7 -6
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_key.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/clients_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/container.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/containers_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/cookbook_artifacts_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bag.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/data_bags_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/environment.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/environments_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/group.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/node.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy_group.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/role.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/roles_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/user.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/users_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/versioned_cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system_cache.rb +1 -1
- data/lib/chef/chef_fs/path_utils.rb +1 -1
- data/lib/chef/client.rb +11 -2
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/fetcher/chef_server.rb +2 -2
- data/lib/chef/compliance/input.rb +1 -1
- data/lib/chef/compliance/input_collection.rb +1 -1
- data/lib/chef/compliance/profile.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +1 -1
- data/lib/chef/compliance/reporter/cli.rb +2 -2
- data/lib/chef/compliance/runner.rb +19 -1
- data/lib/chef/compliance/waiver.rb +1 -1
- data/lib/chef/compliance/waiver_collection.rb +1 -1
- data/lib/chef/config.rb +1 -1
- data/lib/chef/constants.rb +1 -1
- data/lib/chef/context.rb +53 -0
- data/lib/chef/cookbook/chefignore.rb +2 -2
- data/lib/chef/cookbook/cookbook_collection.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +2 -1
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/cookbook/file_vendor.rb +1 -1
- data/lib/chef/cookbook/gem_installer.rb +1 -1
- data/lib/chef/cookbook/manifest_v0.rb +1 -1
- data/lib/chef/cookbook/manifest_v2.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +5 -0
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_loader.rb +1 -1
- data/lib/chef/cookbook_manifest.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/daemon.rb +1 -1
- data/lib/chef/data_bag.rb +3 -3
- data/lib/chef/data_bag_item.rb +2 -2
- data/lib/chef/data_collector/config_validation.rb +1 -1
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/data_collector/message_helpers.rb +1 -1
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/data_collector/run_start_message.rb +2 -2
- data/lib/chef/data_collector.rb +2 -2
- data/lib/chef/decorator/lazy.rb +1 -1
- data/lib/chef/decorator/lazy_array.rb +1 -1
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/delayed_evaluator.rb +1 -1
- data/lib/chef/deprecated.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +1 -1
- data/lib/chef/digester.rb +1 -1
- data/lib/chef/dsl/chef_vault.rb +3 -3
- data/lib/chef/dsl/cheffish.rb +1 -1
- data/lib/chef/dsl/compliance.rb +1 -1
- data/lib/chef/dsl/data_query.rb +1 -1
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/include_attribute.rb +1 -1
- data/lib/chef/dsl/include_recipe.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +1 -1
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/dsl/reader_helpers.rb +3 -1
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/recipe.rb +1 -1
- data/lib/chef/dsl/registry_helper.rb +1 -1
- data/lib/chef/dsl/render_helpers.rb +1 -1
- data/lib/chef/dsl/resources.rb +1 -1
- data/lib/chef/dsl/rest_resource.rb +165 -5
- data/lib/chef/dsl/secret.rb +1 -1
- data/lib/chef/dsl/universal.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/decryption_failure.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +2 -6
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/unsupported_cipher.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format.rb +1 -1
- data/lib/chef/encrypted_data_bag_item.rb +1 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/event_loggers/base.rb +1 -1
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +2 -12
- data/lib/chef/file_access_control/unix.rb +10 -10
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/file_access_control.rb +1 -1
- data/lib/chef/file_cache.rb +2 -6
- data/lib/chef/file_content_management/content_base.rb +1 -1
- data/lib/chef/file_content_management/deploy/cp.rb +1 -1
- data/lib/chef/file_content_management/deploy/mv_unix.rb +1 -1
- data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
- data/lib/chef/file_content_management/deploy/target_io.rb +27 -0
- data/lib/chef/file_content_management/deploy.rb +5 -2
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- data/lib/chef/formatters/base.rb +1 -1
- data/lib/chef/formatters/error_description.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +1 -1
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +2 -2
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +2 -1
- data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +2 -1
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +1 -1
- data/lib/chef/formatters/error_mapper.rb +1 -1
- data/lib/chef/group.rb +2 -2
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +1 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +1 -1
- data/lib/chef/guard_interpreter.rb +1 -1
- data/lib/chef/handler/error_report.rb +1 -1
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/handler/slow_report.rb +2 -2
- data/lib/chef/handler.rb +1 -1
- data/lib/chef/http/api_versions.rb +1 -1
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/authenticator.rb +1 -1
- data/lib/chef/http/basic_client.rb +1 -2
- data/lib/chef/http/cookie_jar.rb +1 -1
- data/lib/chef/http/cookie_manager.rb +1 -1
- data/lib/chef/http/decompressor.rb +1 -1
- data/lib/chef/http/http_request.rb +17 -16
- data/lib/chef/http/json_input.rb +1 -1
- data/lib/chef/http/json_output.rb +1 -1
- data/lib/chef/http/json_to_model_output.rb +1 -1
- data/lib/chef/http/remote_request_id.rb +1 -1
- data/lib/chef/http/simple.rb +1 -1
- data/lib/chef/http/simple_json.rb +1 -1
- data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
- data/lib/chef/http/ssl_policies.rb +1 -1
- data/lib/chef/http/validate_content_length.rb +1 -1
- data/lib/chef/http.rb +1 -2
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/key.rb +1 -1
- data/lib/chef/licensing.rb +105 -0
- data/lib/chef/licensing_config.rb +20 -0
- data/lib/chef/local_mode.rb +1 -1
- data/lib/chef/log/syslog.rb +1 -1
- data/lib/chef/log/winevt.rb +1 -1
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/api_version_request_handling.rb +2 -2
- data/lib/chef/mixin/checksum.rb +1 -1
- data/lib/chef/mixin/chef_utils_wiring.rb +1 -1
- data/lib/chef/mixin/convert_to_class_name.rb +1 -1
- data/lib/chef/mixin/create_path.rb +1 -1
- data/lib/chef/mixin/deep_merge.rb +1 -1
- data/lib/chef/mixin/default_paths.rb +1 -1
- data/lib/chef/mixin/deprecation.rb +1 -1
- data/lib/chef/mixin/enforce_ownership_and_permissions.rb +1 -1
- data/lib/chef/mixin/file_class.rb +4 -2
- data/lib/chef/mixin/from_file.rb +1 -1
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/homebrew.rb +3 -4
- data/lib/chef/mixin/lazy_module_include.rb +1 -1
- data/lib/chef/mixin/notifying_block.rb +1 -1
- data/lib/chef/mixin/openssl_helper.rb +1 -1
- data/lib/chef/mixin/params_validate.rb +1 -1
- data/lib/chef/mixin/path_sanity.rb +1 -1
- data/lib/chef/mixin/powershell_exec.rb +1 -1
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/mixin/powershell_type_coercions.rb +3 -3
- data/lib/chef/mixin/proxified_socket.rb +1 -1
- data/lib/chef/mixin/securable.rb +3 -3
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/mixin/subclass_directive.rb +1 -1
- data/lib/chef/mixin/template.rb +2 -2
- data/lib/chef/mixin/unformatter.rb +1 -1
- data/lib/chef/mixin/uris.rb +1 -1
- data/lib/chef/mixin/user_context.rb +1 -1
- data/lib/chef/mixin/versioned_api.rb +2 -2
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/mixin/why_run.rb +1 -1
- data/lib/chef/mixin/wide_string.rb +1 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +1 -1
- data/lib/chef/mixin/windows_env_helper.rb +1 -1
- data/lib/chef/mixin/xml_escape.rb +1 -1
- data/lib/chef/monkey_patches/net-http.rb +2 -3
- data/lib/chef/monkey_patches/win32/registry.rb +1 -1
- data/lib/chef/node/attribute.rb +1 -1
- data/lib/chef/node/attribute_collections.rb +1 -1
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +1 -1
- data/lib/chef/node/mixin/deep_merge_cache.rb +1 -1
- data/lib/chef/node/mixin/immutablize_array.rb +27 -1
- data/lib/chef/node/mixin/immutablize_hash.rb +36 -1
- data/lib/chef/node/mixin/mashy_array.rb +1 -1
- data/lib/chef/node/mixin/state_tracking.rb +1 -1
- data/lib/chef/node/mixin/state_tracking_array.rb +1 -1
- data/lib/chef/node.rb +1 -1
- data/lib/chef/node_map.rb +15 -3
- data/lib/chef/null_logger.rb +1 -1
- data/lib/chef/org.rb +1 -1
- data/lib/chef/platform/priority_map.rb +1 -1
- data/lib/chef/platform/provider_handler_map.rb +1 -1
- data/lib/chef/platform/provider_mapping.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/platform/rebooter.rb +1 -1
- data/lib/chef/platform/resource_handler_map.rb +1 -1
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/platform.rb +1 -1
- data/lib/chef/policy_builder/dynamic.rb +1 -1
- data/lib/chef/policy_builder/expand_node_object.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/policy_builder.rb +1 -1
- data/lib/chef/property.rb +2 -2
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/cookbook_file/content.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +2 -2
- data/lib/chef/provider/cron/aix.rb +1 -1
- data/lib/chef/provider/cron/solaris.rb +1 -1
- data/lib/chef/provider/cron.rb +15 -5
- data/lib/chef/provider/directory.rb +27 -16
- data/lib/chef/provider/dsc_resource.rb +3 -3
- data/lib/chef/provider/dsc_script.rb +1 -1
- data/lib/chef/provider/execute.rb +3 -2
- data/lib/chef/provider/file/content.rb +1 -1
- data/lib/chef/provider/file.rb +43 -30
- data/lib/chef/provider/git.rb +9 -9
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +2 -2
- data/lib/chef/provider/group/gpasswd.rb +3 -3
- data/lib/chef/provider/group/groupadd.rb +2 -2
- data/lib/chef/provider/group/groupmod.rb +3 -3
- data/lib/chef/provider/group/pw.rb +3 -3
- data/lib/chef/provider/group/solaris.rb +3 -3
- data/lib/chef/provider/group/usermod.rb +3 -3
- data/lib/chef/provider/group.rb +2 -2
- data/lib/chef/provider/http_request.rb +3 -4
- data/lib/chef/provider/ifconfig/aix.rb +2 -2
- data/lib/chef/provider/ifconfig/debian.rb +4 -4
- data/lib/chef/provider/ifconfig/redhat.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +1 -1
- data/lib/chef/provider/link.rb +22 -11
- data/lib/chef/provider/lwrp_base.rb +1 -1
- data/lib/chef/provider/mount/aix.rb +5 -5
- data/lib/chef/provider/mount/linux.rb +5 -5
- data/lib/chef/provider/mount/mount.rb +12 -12
- data/lib/chef/provider/mount/solaris.rb +1 -1
- data/lib/chef/provider/mount/windows.rb +1 -1
- data/lib/chef/provider/mount.rb +1 -1
- data/lib/chef/provider/noop.rb +1 -1
- data/lib/chef/provider/package/apt.rb +1 -1
- data/lib/chef/provider/package/bff.rb +4 -4
- data/lib/chef/provider/package/cab.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +1 -1
- data/lib/chef/provider/package/deb.rb +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +3 -3
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/base.rb +1 -1
- data/lib/chef/provider/package/habitat.rb +6 -6
- data/lib/chef/provider/package/homebrew.rb +4 -4
- data/lib/chef/provider/package/ips.rb +3 -3
- data/lib/chef/provider/package/msu.rb +1 -1
- data/lib/chef/provider/package/openbsd.rb +3 -2
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/paludis.rb +3 -3
- data/lib/chef/provider/package/portage.rb +3 -3
- data/lib/chef/provider/package/powershell.rb +1 -1
- data/lib/chef/provider/package/rpm.rb +3 -3
- data/lib/chef/provider/package/rubygems.rb +19 -3
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/package/snap.rb +20 -8
- data/lib/chef/provider/package/snap_tm.rb +79 -0
- data/lib/chef/provider/package/solaris.rb +5 -5
- data/lib/chef/provider/package/windows/exe.rb +2 -2
- data/lib/chef/provider/package/windows/msi.rb +2 -2
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
- data/lib/chef/provider/package/windows.rb +1 -1
- data/lib/chef/provider/package/yum/python_helper.rb +1 -1
- data/lib/chef/provider/package/yum/rpm_utils.rb +3 -3
- data/lib/chef/provider/package/yum/version.rb +1 -1
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/package/yum.rb +1 -1
- data/lib/chef/provider/package/yum_tm.rb +132 -0
- data/lib/chef/provider/package/zypper/version.rb +1 -1
- data/lib/chef/provider/package/zypper.rb +5 -5
- data/lib/chef/provider/package.rb +2 -2
- data/lib/chef/provider/powershell_script.rb +1 -1
- data/lib/chef/provider/registry_key.rb +2 -1
- data/lib/chef/provider/remote_directory.rb +6 -6
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
- data/lib/chef/provider/remote_file/content.rb +1 -1
- data/lib/chef/provider/remote_file/fetcher.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +2 -3
- data/lib/chef/provider/remote_file.rb +2 -2
- data/lib/chef/provider/route.rb +10 -10
- data/lib/chef/provider/ruby_block.rb +1 -1
- data/lib/chef/provider/script.rb +8 -8
- data/lib/chef/provider/service/aix.rb +2 -2
- data/lib/chef/provider/service/aixinit.rb +6 -6
- data/lib/chef/provider/service/arch.rb +6 -6
- data/lib/chef/provider/service/debian.rb +9 -11
- data/lib/chef/provider/service/freebsd.rb +7 -7
- data/lib/chef/provider/service/gentoo.rb +6 -6
- data/lib/chef/provider/service/init.rb +3 -3
- data/lib/chef/provider/service/insserv.rb +3 -3
- data/lib/chef/provider/service/invokercd.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +1 -1
- data/lib/chef/provider/service/openbsd.rb +7 -7
- data/lib/chef/provider/service/redhat.rb +6 -6
- data/lib/chef/provider/service/solaris.rb +3 -3
- data/lib/chef/provider/service/systemd.rb +3 -3
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +1 -1
- data/lib/chef/provider/service.rb +1 -1
- data/lib/chef/provider/subversion.rb +10 -10
- data/lib/chef/provider/systemd_unit.rb +3 -3
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/template.rb +2 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user/aix.rb +4 -4
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/linux.rb +8 -3
- data/lib/chef/provider/user/mac.rb +2 -2
- data/lib/chef/provider/user/pw.rb +4 -4
- data/lib/chef/provider/user/solaris.rb +8 -8
- data/lib/chef/provider/user.rb +7 -4
- data/lib/chef/provider/windows_script.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +2 -4
- data/lib/chef/provider/zypper_repository.rb +2 -2
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/providers.rb +3 -1
- data/lib/chef/pwsh.rb +1 -1
- data/lib/chef/recipe.rb +9 -6
- data/lib/chef/request_id.rb +1 -1
- data/lib/chef/resource/_rest_resource.rb +153 -8
- data/lib/chef/resource/action_class.rb +1 -1
- data/lib/chef/resource/alternatives.rb +5 -4
- data/lib/chef/resource/apt_package.rb +7 -2
- data/lib/chef/resource/apt_preference.rb +3 -2
- data/lib/chef/resource/apt_repository.rb +18 -13
- data/lib/chef/resource/apt_update.rb +5 -4
- data/lib/chef/resource/archive_file.rb +21 -21
- data/lib/chef/resource/bash.rb +3 -2
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +3 -2
- data/lib/chef/resource/breakpoint.rb +2 -1
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/cab_package.rb +1 -1
- data/lib/chef/resource/chef_client_config.rb +5 -8
- data/lib/chef/resource/chef_client_cron.rb +5 -3
- data/lib/chef/resource/chef_client_hab_ca_cert.rb +141 -0
- data/lib/chef/resource/chef_client_launchd.rb +7 -3
- data/lib/chef/resource/chef_client_scheduled_task.rb +6 -3
- data/lib/chef/resource/chef_client_systemd_timer.rb +5 -2
- data/lib/chef/resource/chef_client_trusted_certificate.rb +1 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/chef_handler.rb +1 -1
- data/lib/chef/resource/chef_sleep.rb +3 -2
- data/lib/chef/resource/chef_vault_secret.rb +1 -1
- data/lib/chef/resource/chocolatey_config.rb +1 -1
- data/lib/chef/resource/chocolatey_feature.rb +1 -1
- data/lib/chef/resource/chocolatey_installer.rb +5 -20
- data/lib/chef/resource/chocolatey_package.rb +1 -1
- data/lib/chef/resource/chocolatey_source.rb +1 -1
- data/lib/chef/resource/conditional.rb +1 -1
- data/lib/chef/resource/cookbook_file.rb +3 -2
- data/lib/chef/resource/cron/_cron_shared.rb +1 -3
- data/lib/chef/resource/cron/cron.rb +2 -1
- data/lib/chef/resource/cron/cron_d.rb +3 -2
- data/lib/chef/resource/cron_access.rb +3 -2
- data/lib/chef/resource/csh.rb +8 -7
- data/lib/chef/resource/directory.rb +8 -7
- data/lib/chef/resource/dmg_package.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +2 -2
- data/lib/chef/resource/dpkg_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +1 -1
- data/lib/chef/resource/dsc_script.rb +1 -1
- data/lib/chef/resource/execute.rb +8 -1
- data/lib/chef/resource/file/verification/json.rb +1 -1
- data/lib/chef/resource/file/verification/systemd_unit.rb +5 -2
- data/lib/chef/resource/file/verification/yaml.rb +2 -2
- data/lib/chef/resource/file/verification.rb +4 -1
- data/lib/chef/resource/file.rb +3 -2
- data/lib/chef/resource/freebsd_package.rb +4 -3
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/group.rb +7 -4
- data/lib/chef/resource/habitat/_habitat_shared.rb +1 -1
- data/lib/chef/resource/habitat/habitat_package.rb +4 -2
- data/lib/chef/resource/habitat/habitat_sup.rb +17 -18
- data/lib/chef/resource/habitat/habitat_sup_systemd.rb +4 -3
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +2 -1
- data/lib/chef/resource/habitat_config.rb +25 -11
- data/lib/chef/resource/habitat_install.rb +5 -5
- data/lib/chef/resource/habitat_service.rb +9 -5
- data/lib/chef/resource/habitat_user_toml.rb +2 -2
- data/lib/chef/resource/helpers/cron_validations.rb +3 -3
- data/lib/chef/resource/helpers/path_helpers.rb +52 -0
- data/lib/chef/resource/homebrew_cask.rb +2 -2
- data/lib/chef/resource/homebrew_package.rb +1 -1
- data/lib/chef/resource/homebrew_tap.rb +11 -3
- data/lib/chef/resource/homebrew_update.rb +1 -1
- data/lib/chef/resource/hostname.rb +16 -13
- data/lib/chef/resource/http_request.rb +3 -2
- data/lib/chef/resource/ifconfig.rb +2 -1
- data/lib/chef/resource/inspec_input.rb +5 -2
- data/lib/chef/resource/inspec_waiver.rb +3 -2
- data/lib/chef/resource/inspec_waiver_file_entry.rb +3 -2
- data/lib/chef/resource/ips_package.rb +4 -3
- data/lib/chef/resource/kernel_module.rb +4 -3
- data/lib/chef/resource/ksh.rb +8 -7
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/link.rb +12 -11
- data/lib/chef/resource/locale.rb +5 -4
- data/lib/chef/resource/log.rb +7 -5
- data/lib/chef/resource/lwrp_base.rb +1 -1
- data/lib/chef/resource/macos_pkg.rb +1 -1
- data/lib/chef/resource/macos_userdefaults.rb +1 -1
- data/lib/chef/resource/macports_package.rb +1 -1
- data/lib/chef/resource/mdadm.rb +3 -3
- data/lib/chef/resource/mount.rb +4 -2
- data/lib/chef/resource/msu_package.rb +1 -1
- data/lib/chef/resource/notify_group.rb +3 -2
- data/lib/chef/resource/ohai.rb +5 -4
- data/lib/chef/resource/ohai_hint.rb +3 -2
- data/lib/chef/resource/openbsd_package.rb +4 -3
- data/lib/chef/resource/openssl_dhparam.rb +1 -1
- data/lib/chef/resource/openssl_ec_private_key.rb +2 -2
- data/lib/chef/resource/openssl_ec_public_key.rb +1 -1
- data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -1
- data/lib/chef/resource/openssl_x509_certificate.rb +6 -2
- data/lib/chef/resource/openssl_x509_crl.rb +1 -1
- data/lib/chef/resource/openssl_x509_request.rb +1 -1
- data/lib/chef/resource/package.rb +10 -9
- data/lib/chef/resource/pacman_package.rb +2 -1
- data/lib/chef/resource/paludis_package.rb +3 -2
- data/lib/chef/resource/perl.rb +8 -7
- data/lib/chef/resource/plist.rb +2 -2
- data/lib/chef/resource/portage_package.rb +3 -2
- data/lib/chef/resource/powershell_package.rb +1 -1
- data/lib/chef/resource/powershell_script.rb +1 -1
- data/lib/chef/resource/python.rb +7 -6
- data/lib/chef/resource/reboot.rb +8 -7
- data/lib/chef/resource/registry_key.rb +1 -6
- data/lib/chef/resource/remote_directory.rb +3 -2
- data/lib/chef/resource/remote_file.rb +4 -3
- data/lib/chef/resource/resource_notification.rb +5 -5
- data/lib/chef/resource/rhsm_errata.rb +3 -2
- data/lib/chef/resource/rhsm_errata_level.rb +4 -3
- data/lib/chef/resource/rhsm_register.rb +12 -3
- data/lib/chef/resource/rhsm_repo.rb +5 -5
- data/lib/chef/resource/rhsm_subscription.rb +10 -10
- data/lib/chef/resource/route.rb +2 -1
- data/lib/chef/resource/rpm_package.rb +3 -2
- data/lib/chef/resource/ruby.rb +4 -2
- data/lib/chef/resource/ruby_block.rb +3 -1
- data/lib/chef/resource/scm/_scm.rb +1 -1
- data/lib/chef/resource/scm/git.rb +6 -5
- data/lib/chef/resource/scm/subversion.rb +3 -2
- data/lib/chef/resource/script.rb +7 -5
- data/lib/chef/resource/selinux/common_helpers.rb +1 -1
- data/lib/chef/resource/selinux/selinux_debian.erb +1 -1
- data/lib/chef/resource/selinux/selinux_default.erb +1 -1
- data/lib/chef/resource/selinux_boolean.rb +2 -1
- data/lib/chef/resource/selinux_fcontext.rb +4 -3
- data/lib/chef/resource/selinux_install.rb +2 -1
- data/lib/chef/resource/selinux_login.rb +2 -1
- data/lib/chef/resource/selinux_module.rb +6 -5
- data/lib/chef/resource/selinux_permissive.rb +3 -2
- data/lib/chef/resource/selinux_port.rb +3 -2
- data/lib/chef/resource/selinux_state.rb +3 -2
- data/lib/chef/resource/selinux_user.rb +2 -1
- data/lib/chef/resource/service.rb +4 -1
- data/lib/chef/resource/smartos_package.rb +4 -3
- data/lib/chef/resource/snap_package.rb +16 -7
- data/lib/chef/resource/solaris_package.rb +3 -2
- data/lib/chef/resource/ssh_known_hosts_entry.rb +3 -2
- data/lib/chef/resource/sudo.rb +11 -10
- data/lib/chef/resource/swap_file.rb +8 -7
- data/lib/chef/resource/sysctl.rb +7 -6
- data/lib/chef/resource/systemd_unit.rb +4 -1
- data/lib/chef/resource/template.rb +3 -2
- data/lib/chef/resource/timezone.rb +7 -6
- data/lib/chef/resource/user/aix_user.rb +4 -3
- data/lib/chef/resource/user/linux_user.rb +4 -4
- data/lib/chef/resource/user/mac_user.rb +2 -1
- data/lib/chef/resource/user/pw_user.rb +4 -3
- data/lib/chef/resource/user/solaris_user.rb +4 -3
- data/lib/chef/resource/user/windows_user.rb +2 -1
- data/lib/chef/resource/user.rb +2 -1
- data/lib/chef/resource/user_ulimit.rb +3 -2
- data/lib/chef/resource/windows_ad_join.rb +2 -2
- data/lib/chef/resource/windows_audit_policy.rb +1 -1
- data/lib/chef/resource/windows_auto_run.rb +2 -2
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +1 -1
- data/lib/chef/resource/windows_defender_exclusion.rb +1 -1
- data/lib/chef/resource/windows_dfs_folder.rb +1 -1
- data/lib/chef/resource/windows_dfs_namespace.rb +1 -1
- data/lib/chef/resource/windows_dfs_server.rb +1 -1
- data/lib/chef/resource/windows_dns_record.rb +1 -1
- data/lib/chef/resource/windows_dns_zone.rb +1 -1
- data/lib/chef/resource/windows_feature.rb +1 -1
- data/lib/chef/resource/windows_feature_dism.rb +1 -1
- data/lib/chef/resource/windows_feature_powershell.rb +1 -1
- data/lib/chef/resource/windows_firewall_profile.rb +1 -1
- data/lib/chef/resource/windows_firewall_rule.rb +1 -1
- data/lib/chef/resource/windows_font.rb +2 -2
- data/lib/chef/resource/windows_package.rb +2 -2
- data/lib/chef/resource/windows_pagefile.rb +3 -3
- data/lib/chef/resource/windows_path.rb +1 -1
- data/lib/chef/resource/windows_printer.rb +1 -1
- data/lib/chef/resource/windows_printer_port.rb +1 -1
- data/lib/chef/resource/windows_script.rb +1 -1
- data/lib/chef/resource/windows_security_policy.rb +1 -1
- data/lib/chef/resource/windows_service.rb +2 -2
- data/lib/chef/resource/windows_share.rb +4 -4
- data/lib/chef/resource/windows_shortcut.rb +1 -1
- data/lib/chef/resource/windows_task.rb +3 -5
- data/lib/chef/resource/windows_uac.rb +1 -1
- data/lib/chef/resource/windows_update_settings.rb +3 -3
- data/lib/chef/resource/windows_user_privilege.rb +3 -3
- data/lib/chef/resource/windows_workgroup.rb +1 -1
- data/lib/chef/resource/yum_package.rb +5 -4
- data/lib/chef/resource/yum_repository.rb +3 -2
- data/lib/chef/resource/zypper_package.rb +3 -2
- data/lib/chef/resource/zypper_repository.rb +4 -3
- data/lib/chef/resource.rb +12 -4
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +1 -1
- data/lib/chef/resource_collection/resource_list.rb +1 -1
- data/lib/chef/resource_collection/resource_set.rb +12 -7
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_definition.rb +1 -1
- data/lib/chef/resource_definition_list.rb +1 -1
- data/lib/chef/resource_inspector.rb +4 -3
- data/lib/chef/resource_reporter.rb +2 -1
- data/lib/chef/resource_resolver.rb +1 -1
- data/lib/chef/resources.rb +2 -2
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/run_context.rb +2 -2
- data/lib/chef/run_list/run_list_expansion.rb +1 -1
- data/lib/chef/run_list/run_list_item.rb +5 -5
- data/lib/chef/run_list/versioned_recipe_list.rb +1 -1
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/run_lock.rb +4 -1
- data/lib/chef/run_status.rb +1 -1
- data/lib/chef/runner.rb +2 -2
- data/lib/chef/scan_access_control.rb +9 -7
- data/lib/chef/search/query.rb +1 -1
- data/lib/chef/secret_fetcher/akeyless_vault.rb +1 -2
- data/lib/chef/secret_fetcher/aws_secrets_manager.rb +1 -1
- data/lib/chef/secret_fetcher/base.rb +1 -1
- data/lib/chef/secret_fetcher/example.rb +1 -1
- data/lib/chef/secret_fetcher/hashi_vault.rb +10 -2
- data/lib/chef/secret_fetcher.rb +1 -1
- data/lib/chef/server_api.rb +1 -1
- data/lib/chef/server_api_versions.rb +1 -1
- data/lib/chef/shell/model_wrapper.rb +1 -1
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/shell.rb +30 -8
- data/lib/chef/target_io/dir.rb +12 -0
- data/lib/chef/target_io/etc.rb +16 -0
- data/lib/chef/target_io/file.rb +12 -0
- data/lib/chef/target_io/fileutils.rb +12 -0
- data/lib/chef/target_io/http.rb +35 -0
- data/lib/chef/target_io/io.rb +12 -0
- data/lib/chef/target_io/shadow.rb +44 -0
- data/lib/chef/target_io/support.rb +73 -0
- data/lib/chef/target_io/train/dir.rb +86 -0
- data/lib/chef/target_io/train/etc.rb +108 -0
- data/lib/chef/target_io/train/file.rb +219 -0
- data/lib/chef/target_io/train/fileutils.rb +201 -0
- data/lib/chef/target_io/train/http.rb +117 -0
- data/lib/chef/target_io/train/io.rb +13 -0
- data/lib/chef/target_io/train/shadow.rb +54 -0
- data/lib/chef/target_io/train_compat.rb +7 -0
- data/lib/chef/target_io.rb +11 -0
- data/lib/chef/train_transport.rb +1 -1
- data/lib/chef/user.rb +1 -1
- data/lib/chef/user_v1.rb +1 -1
- data/lib/chef/util/backup.rb +2 -2
- data/lib/chef/util/diff.rb +15 -2
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/dsc/local_configuration_manager.rb +1 -1
- data/lib/chef/util/dsc/resource_store.rb +1 -1
- data/lib/chef/util/editor.rb +1 -1
- data/lib/chef/util/file_edit.rb +5 -5
- data/lib/chef/util/path_helper.rb +1 -1
- data/lib/chef/util/powershell/ps_credential.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/threaded_job_queue.rb +1 -1
- data/lib/chef/util/windows/logon_session.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/command_line_helper.rb +1 -1
- data/lib/chef/win32/api/crypto.rb +1 -1
- data/lib/chef/win32/api/error.rb +1 -1
- data/lib/chef/win32/api/file.rb +3 -2
- data/lib/chef/win32/api/installer.rb +1 -1
- data/lib/chef/win32/api/memory.rb +1 -1
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/api/process.rb +1 -1
- data/lib/chef/win32/api/psapi.rb +1 -1
- data/lib/chef/win32/api/registry.rb +1 -1
- data/lib/chef/win32/api/security.rb +1 -1
- data/lib/chef/win32/api/synchronization.rb +1 -1
- data/lib/chef/win32/api/system.rb +1 -1
- data/lib/chef/win32/api/unicode.rb +1 -1
- data/lib/chef/win32/api.rb +1 -1
- data/lib/chef/win32/crypto.rb +1 -1
- data/lib/chef/win32/error.rb +3 -2
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/file/info.rb +1 -1
- data/lib/chef/win32/file/version_info.rb +2 -2
- data/lib/chef/win32/file.rb +1 -1
- data/lib/chef/win32/handle.rb +1 -1
- data/lib/chef/win32/memory.rb +1 -1
- data/lib/chef/win32/mutex.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/process.rb +1 -1
- data/lib/chef/win32/registry.rb +4 -2
- data/lib/chef/win32/security/ace.rb +1 -1
- data/lib/chef/win32/security/acl.rb +1 -1
- data/lib/chef/win32/security/securable_object.rb +1 -1
- data/lib/chef/win32/security/security_descriptor.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/lib/chef/win32/security/token.rb +1 -1
- data/lib/chef/win32/security.rb +1 -1
- data/lib/chef/win32/system.rb +1 -1
- data/lib/chef/win32/unicode.rb +1 -1
- data/lib/chef/win32/version.rb +2 -3
- data/lib/chef/workstation_config_loader.rb +1 -1
- data/lib/chef.rb +3 -1
- metadata +127 -87
- data/distro/powershell/chef/chef.psm1 +0 -459
- data/lib/chef/resource/osx_profile.rb +0 -334
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright
|
|
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");
|
|
@@ -15,6 +15,101 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
+
unified_mode true
|
|
19
|
+
|
|
20
|
+
provides :rest_resource
|
|
21
|
+
|
|
22
|
+
description "Base resource for interacting with REST APIs. Extend this resource to create custom resources that manage REST API endpoints."
|
|
23
|
+
|
|
24
|
+
introduced "18.0"
|
|
25
|
+
|
|
26
|
+
examples <<~'DOC'
|
|
27
|
+
**Create a custom REST resource for managing users in an API**
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
class Chef::Resource::ApiUser < Chef::Resource::RestResource
|
|
31
|
+
resource_name :api_user
|
|
32
|
+
provides :api_user
|
|
33
|
+
|
|
34
|
+
rest_api_endpoint "https://api.example.com"
|
|
35
|
+
rest_api_collection "/api/v1/users"
|
|
36
|
+
rest_identity_property :username
|
|
37
|
+
|
|
38
|
+
property :username, String, name_property: true
|
|
39
|
+
property :email, String
|
|
40
|
+
property :full_name, String
|
|
41
|
+
property :active, [true, false], default: true
|
|
42
|
+
|
|
43
|
+
rest_property_map({
|
|
44
|
+
username: "username",
|
|
45
|
+
email: "email",
|
|
46
|
+
full_name: "profile.fullName",
|
|
47
|
+
active: "status.active"
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
rest_post_only_properties [:username]
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Use the custom resource to create a user**
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
api_user "testuser" do
|
|
58
|
+
email "testuser@example.com"
|
|
59
|
+
full_name "Test User"
|
|
60
|
+
active true
|
|
61
|
+
action :configure
|
|
62
|
+
end
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Delete a user via the API**
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
api_user "testuser" do
|
|
69
|
+
action :delete
|
|
70
|
+
end
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Use JMESPath for complex JSON mapping**
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
class Chef::Resource::ApiProject < Chef::Resource::RestResource
|
|
77
|
+
resource_name :api_project
|
|
78
|
+
|
|
79
|
+
rest_api_endpoint "https://api.example.com"
|
|
80
|
+
rest_api_collection "/projects"
|
|
81
|
+
rest_identity_property :project_id
|
|
82
|
+
|
|
83
|
+
property :project_id, String, name_property: true
|
|
84
|
+
property :member_emails, Array
|
|
85
|
+
|
|
86
|
+
# Extract email addresses from nested members array
|
|
87
|
+
rest_property_map({
|
|
88
|
+
project_id: "id",
|
|
89
|
+
member_emails: "members[*].email"
|
|
90
|
+
})
|
|
91
|
+
end
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Configure authentication with custom headers**
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
class Chef::Resource::ApiResource < Chef::Resource::RestResource
|
|
98
|
+
rest_api_endpoint "https://api.example.com"
|
|
99
|
+
rest_api_collection "/resources"
|
|
100
|
+
|
|
101
|
+
action_class do
|
|
102
|
+
def rest_headers
|
|
103
|
+
{
|
|
104
|
+
"Authorization" => "Bearer #{node['api_token']}",
|
|
105
|
+
"X-API-Version" => "2024-01-01"
|
|
106
|
+
}
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
```
|
|
111
|
+
DOC
|
|
112
|
+
|
|
18
113
|
require "addressable/template" unless defined?(Addressable::Template)
|
|
19
114
|
require "rest-client" unless defined?(RestClient)
|
|
20
115
|
require "jmespath" unless defined?(JMESPath)
|
|
@@ -48,7 +143,7 @@ action_class do
|
|
|
48
143
|
end
|
|
49
144
|
end
|
|
50
145
|
|
|
51
|
-
action :configure do
|
|
146
|
+
action :configure, description: "Create or update the resource via the REST API. If the resource doesn't exist, this performs a POST to create it. If the resource exists and properties changed, this performs a PATCH to update it." do
|
|
52
147
|
if resource_exists?
|
|
53
148
|
converge_if_changed do
|
|
54
149
|
data = {}
|
|
@@ -79,7 +174,7 @@ action :configure do
|
|
|
79
174
|
end
|
|
80
175
|
end
|
|
81
176
|
|
|
82
|
-
action :delete do
|
|
177
|
+
action :delete, description: "Delete the resource via the REST API. If the resource doesn't exist, this action takes no action." do
|
|
83
178
|
if resource_exists?
|
|
84
179
|
converge_by "deleting resource" do
|
|
85
180
|
rest_delete
|
|
@@ -91,12 +186,24 @@ action :delete do
|
|
|
91
186
|
end
|
|
92
187
|
|
|
93
188
|
action_class do
|
|
94
|
-
#
|
|
189
|
+
#
|
|
190
|
+
# Postprocess API responses. Override in custom resources to transform
|
|
191
|
+
# or extract data from responses, handle pagination, etc.
|
|
192
|
+
#
|
|
193
|
+
# @param response [RestClient::Response] The API response object
|
|
194
|
+
# @return [RestClient::Response] The processed response
|
|
195
|
+
#
|
|
95
196
|
def rest_postprocess(response)
|
|
96
197
|
response
|
|
97
198
|
end
|
|
98
199
|
|
|
99
|
-
#
|
|
200
|
+
#
|
|
201
|
+
# Handle REST API errors. Override in custom resources to provide
|
|
202
|
+
# user-friendly error messages or handle specific error codes.
|
|
203
|
+
#
|
|
204
|
+
# @param error_obj [RestClient::Exception] The exception object
|
|
205
|
+
# @return [RestClient::Exception] The processed error
|
|
206
|
+
#
|
|
100
207
|
def rest_errorhandler(error_obj)
|
|
101
208
|
error_obj
|
|
102
209
|
end
|
|
@@ -111,7 +218,9 @@ action_class do
|
|
|
111
218
|
current_resource.class.properties.select { |_, v| v.required? }.except(:name).keys
|
|
112
219
|
end
|
|
113
220
|
|
|
221
|
+
#
|
|
114
222
|
# Return changed value or nil for delta current->new
|
|
223
|
+
#
|
|
115
224
|
def changed_value(property)
|
|
116
225
|
new_value = new_resource.send(property)
|
|
117
226
|
return new_value if current_resource.nil?
|
|
@@ -127,7 +236,9 @@ action_class do
|
|
|
127
236
|
current_resource.class.identity_attr
|
|
128
237
|
end
|
|
129
238
|
|
|
239
|
+
#
|
|
130
240
|
# Map properties to their current values
|
|
241
|
+
#
|
|
131
242
|
def property_map
|
|
132
243
|
map = {}
|
|
133
244
|
|
|
@@ -142,7 +253,15 @@ action_class do
|
|
|
142
253
|
map
|
|
143
254
|
end
|
|
144
255
|
|
|
145
|
-
#
|
|
256
|
+
#
|
|
257
|
+
# Convert JSON API response to a resource property value.
|
|
258
|
+
# Supports JMESPath expressions (String) or custom functions (Symbol).
|
|
259
|
+
#
|
|
260
|
+
# @param match_instruction [String, Symbol] How to extract the value
|
|
261
|
+
# @param property [Symbol] The property name
|
|
262
|
+
# @param resource_data [Hash] The JSON response data
|
|
263
|
+
# @return [Object] The extracted property value
|
|
264
|
+
#
|
|
146
265
|
def json_to_property(match_instruction, property, resource_data)
|
|
147
266
|
case match_instruction
|
|
148
267
|
when String
|
|
@@ -157,7 +276,14 @@ action_class do
|
|
|
157
276
|
end
|
|
158
277
|
end
|
|
159
278
|
|
|
160
|
-
#
|
|
279
|
+
#
|
|
280
|
+
# Convert a resource property value to JSON for API request.
|
|
281
|
+
# Supports JMESPath-like notation (String) or custom functions (Symbol).
|
|
282
|
+
#
|
|
283
|
+
# @param property [Symbol] The property name
|
|
284
|
+
# @param match_instruction [String, Symbol] How to structure the value
|
|
285
|
+
# @return [Hash] A hash representing the JSON structure
|
|
286
|
+
#
|
|
161
287
|
def property_to_json(property, match_instruction)
|
|
162
288
|
case match_instruction
|
|
163
289
|
when String
|
|
@@ -177,13 +303,17 @@ action_class do
|
|
|
177
303
|
current_resource.class.rest_api_collection
|
|
178
304
|
end
|
|
179
305
|
|
|
306
|
+
#
|
|
180
307
|
# Resource document URL after RFC 6570 template evaluation via properties substitution
|
|
308
|
+
#
|
|
181
309
|
def rest_url_document
|
|
182
310
|
template = ::Addressable::Template.new(current_resource.class.rest_api_document)
|
|
183
311
|
template.expand(property_map).to_s
|
|
184
312
|
end
|
|
185
313
|
|
|
314
|
+
#
|
|
186
315
|
# Convenience method for conditional requires
|
|
316
|
+
#
|
|
187
317
|
def conditionally_require_on_setting(property, dependent_properties)
|
|
188
318
|
dependent_properties = Array(dependent_properties)
|
|
189
319
|
|
|
@@ -267,12 +397,16 @@ action_class do
|
|
|
267
397
|
|
|
268
398
|
# REST parameter mapping
|
|
269
399
|
|
|
400
|
+
#
|
|
270
401
|
# Return number of parameters needed to identify a resource (pre- and post-creation)
|
|
402
|
+
#
|
|
271
403
|
def rest_arity
|
|
272
404
|
rest_identity_map.keys.count
|
|
273
405
|
end
|
|
274
406
|
|
|
407
|
+
#
|
|
275
408
|
# Return mapping of template placeholders to property value of identity parameters
|
|
409
|
+
#
|
|
276
410
|
def rest_identity_values
|
|
277
411
|
data = {}
|
|
278
412
|
|
|
@@ -288,11 +422,14 @@ action_class do
|
|
|
288
422
|
rest_identity_explicit || rest_identity_implicit
|
|
289
423
|
end
|
|
290
424
|
|
|
425
|
+
#
|
|
291
426
|
# Accept direct mapping like { "svm.name" => :name } for specifying the x-ary identity of a resource
|
|
427
|
+
#
|
|
292
428
|
def rest_identity_explicit
|
|
293
429
|
current_resource.class.rest_identity_map
|
|
294
430
|
end
|
|
295
431
|
|
|
432
|
+
#
|
|
296
433
|
# Parse document URL for RFC 6570 templates and map them to resource properties.
|
|
297
434
|
#
|
|
298
435
|
# Examples:
|
|
@@ -351,8 +488,11 @@ action_class do
|
|
|
351
488
|
Chef.run_context.transport.connection
|
|
352
489
|
end
|
|
353
490
|
|
|
491
|
+
#
|
|
354
492
|
# Remove all empty keys (recursively) from Hash.
|
|
493
|
+
#
|
|
355
494
|
# @see https://stackoverflow.com/questions/56457020/#answer-56458673
|
|
495
|
+
#
|
|
356
496
|
def deep_compact!(hsh)
|
|
357
497
|
raise TypeError unless hsh.is_a? Hash
|
|
358
498
|
|
|
@@ -361,22 +501,27 @@ action_class do
|
|
|
361
501
|
end.reject! { |_, v| v.nil? || (v.respond_to?(:empty?) && v.empty?) }
|
|
362
502
|
end
|
|
363
503
|
|
|
504
|
+
#
|
|
364
505
|
# Deep merge two hashes
|
|
506
|
+
#
|
|
365
507
|
# @see https://stackoverflow.com/questions/41109599#answer-41109737
|
|
508
|
+
#
|
|
366
509
|
def deep_merge!(hsh1, hsh2)
|
|
367
510
|
raise TypeError unless hsh1.is_a?(Hash) && hsh2.is_a?(Hash)
|
|
368
511
|
|
|
369
512
|
hsh1.merge!(hsh2) { |_, v1, v2| deep_merge!(v1, v2) }
|
|
370
513
|
end
|
|
371
514
|
|
|
515
|
+
#
|
|
372
516
|
# Create nested hashes from JMESPath syntax.
|
|
517
|
+
#
|
|
373
518
|
def bury(path, value)
|
|
374
519
|
raise TypeError unless path.is_a?(String)
|
|
375
520
|
|
|
376
521
|
arr = path.split(".")
|
|
377
522
|
ret = {}
|
|
378
523
|
|
|
379
|
-
if arr.
|
|
524
|
+
if arr.one?
|
|
380
525
|
ret[arr.first] = value
|
|
381
526
|
|
|
382
527
|
ret
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: John Keiser (<jkeiser@chef.io)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
# Copyright:: 2016-2020, Virender Khatri
|
|
4
4
|
#
|
|
5
5
|
# License:: Apache License, Version 2.0
|
|
@@ -23,7 +23,8 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class Alternatives < Chef::Resource
|
|
25
25
|
|
|
26
|
-
provides(:alternatives) { true }
|
|
26
|
+
provides(:alternatives, target_mode: true) { true }
|
|
27
|
+
target_mode support: :full
|
|
27
28
|
|
|
28
29
|
description "Use the **alternatives** resource to configure command alternatives in Linux using the alternatives or update-alternatives packages."
|
|
29
30
|
introduced "16.0"
|
|
@@ -91,7 +92,7 @@ class Chef
|
|
|
91
92
|
description: "The absolute path to the original application binary such as `/usr/bin/ruby27`."
|
|
92
93
|
|
|
93
94
|
property :priority, [String, Integer],
|
|
94
|
-
coerce: proc
|
|
95
|
+
coerce: proc(&:to_i),
|
|
95
96
|
description: "The priority of the alternative."
|
|
96
97
|
|
|
97
98
|
def define_resource_requirements
|
|
@@ -113,7 +114,7 @@ class Chef
|
|
|
113
114
|
|
|
114
115
|
requirements.assert(:install, :set, :remove) do |a|
|
|
115
116
|
a.assertion do
|
|
116
|
-
::File.exist?(new_resource.path)
|
|
117
|
+
::TargetIO::File.exist?(new_resource.path)
|
|
117
118
|
end
|
|
118
119
|
|
|
119
120
|
a.whyrun("Assuming file #{new_resource.path} already exists or was created already")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -24,6 +24,11 @@ class Chef
|
|
|
24
24
|
|
|
25
25
|
provides :apt_package, target_mode: true
|
|
26
26
|
provides :package, platform_family: "debian", target_mode: true
|
|
27
|
+
target_mode support: :full,
|
|
28
|
+
introduced: "15.1",
|
|
29
|
+
updated: "19.0",
|
|
30
|
+
description: "Does not support the `response_file` property in Target Mode."
|
|
31
|
+
|
|
27
32
|
examples <<~DOC
|
|
28
33
|
**Install a package using package manager**:
|
|
29
34
|
|
|
@@ -96,7 +101,7 @@ class Chef
|
|
|
96
101
|
default: false
|
|
97
102
|
|
|
98
103
|
property :environment, Hash,
|
|
99
|
-
introduced: "
|
|
104
|
+
introduced: "19.0",
|
|
100
105
|
description: "A Hash of environment variables in the form of {'ENV_VARIABLE' => 'VALUE'} to be set before running the command.",
|
|
101
106
|
default: {}, desired_state: false
|
|
102
107
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -22,7 +22,8 @@ class Chef
|
|
|
22
22
|
class Resource
|
|
23
23
|
class AptPreference < Chef::Resource
|
|
24
24
|
|
|
25
|
-
provides(:apt_preference) { true }
|
|
25
|
+
provides(:apt_preference, target_mode: true) { true }
|
|
26
|
+
target_mode support: :full
|
|
26
27
|
|
|
27
28
|
description "Use the **apt_preference** resource to create APT [preference files](https://wiki.debian.org/AptPreferences). Preference files are used to control which package versions and sources are prioritized during installation."
|
|
28
29
|
introduced "13.3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Thom May (<thom@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#
|
|
18
18
|
|
|
19
19
|
require_relative "../resource"
|
|
20
|
-
require_relative "../http/simple"
|
|
21
20
|
require "tmpdir" unless defined?(Dir.mktmpdir)
|
|
22
21
|
module Addressable
|
|
23
22
|
autoload :URI, "addressable/uri"
|
|
@@ -27,7 +26,8 @@ class Chef
|
|
|
27
26
|
class Resource
|
|
28
27
|
class AptRepository < Chef::Resource
|
|
29
28
|
|
|
30
|
-
provides(:apt_repository) { true }
|
|
29
|
+
provides(:apt_repository, target_mode: true) { true }
|
|
30
|
+
target_mode support: :full
|
|
31
31
|
|
|
32
32
|
description "Use the **apt_repository** resource to specify additional APT repositories. Adding a new repository will update the APT package cache immediately."
|
|
33
33
|
introduced "12.9"
|
|
@@ -99,7 +99,6 @@ class Chef
|
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
**Add repository that needs custom options**:
|
|
102
|
-
|
|
103
102
|
```ruby
|
|
104
103
|
apt_repository 'corretto' do
|
|
105
104
|
uri 'https://apt.corretto.aws'
|
|
@@ -127,6 +126,7 @@ class Chef
|
|
|
127
126
|
# to allow that so don't refactor this however tempting it is
|
|
128
127
|
property :repo_name, String,
|
|
129
128
|
regex: [%r{^[^/]+$}],
|
|
129
|
+
coerce: proc { |x| x.gsub(" ", "-") },
|
|
130
130
|
description: "An optional property to set the repository name if it differs from the resource block's name. The value of this setting must not contain spaces.",
|
|
131
131
|
validation_message: "repo_name property cannot contain a forward slash '/'",
|
|
132
132
|
introduced: "14.1", name_property: true
|
|
@@ -177,7 +177,7 @@ class Chef
|
|
|
177
177
|
default: true, desired_state: false
|
|
178
178
|
|
|
179
179
|
property :options, [String, Array],
|
|
180
|
-
description: "Additional options to set for the repository
|
|
180
|
+
description: "Additional options to set for the repository",
|
|
181
181
|
default: [], coerce: proc { |x| Array(x) }
|
|
182
182
|
|
|
183
183
|
default_action :add
|
|
@@ -201,7 +201,7 @@ class Chef
|
|
|
201
201
|
# @return [Array] an array of fingerprints
|
|
202
202
|
def extract_fingerprints_from_cmd(*cmd)
|
|
203
203
|
so = shell_out(*cmd)
|
|
204
|
-
so.stdout.split(
|
|
204
|
+
so.stdout.split("\n").map do |t|
|
|
205
205
|
if z = t.match(/^fpr:+([0-9A-F]+):/)
|
|
206
206
|
z[1].split.join
|
|
207
207
|
end
|
|
@@ -218,7 +218,7 @@ class Chef
|
|
|
218
218
|
so = shell_out(*cmd)
|
|
219
219
|
# Sample output
|
|
220
220
|
# pub:-:4096:1:D94AA3F0EFE21092:1336774248:::-:::scSC::::::23::0:
|
|
221
|
-
so.stdout.split(
|
|
221
|
+
so.stdout.split("\n").map do |t|
|
|
222
222
|
if t.match(/^pub:/)
|
|
223
223
|
f = t.split(":")
|
|
224
224
|
f.slice(0, 6).join(":")
|
|
@@ -330,8 +330,8 @@ class Chef
|
|
|
330
330
|
keyfile_tmp_path = ::File.join(Chef::Config[:file_cache_path], key_name)
|
|
331
331
|
keyfile_path = keyring_path
|
|
332
332
|
gpg_keyring_prefix = apt_version > 2 ? "gnupg-ring:" : ""
|
|
333
|
-
tmp_dir = Dir.mktmpdir(".gpg")
|
|
334
|
-
at_exit { FileUtils.remove_entry(tmp_dir) }
|
|
333
|
+
tmp_dir = TargetIO::Dir.mktmpdir(".gpg")
|
|
334
|
+
at_exit { TargetIO::FileUtils.remove_entry(tmp_dir) }
|
|
335
335
|
|
|
336
336
|
if new_resource.signed_by
|
|
337
337
|
directory "/etc/apt/keyrings" do
|
|
@@ -456,7 +456,7 @@ class Chef
|
|
|
456
456
|
# @return [void]
|
|
457
457
|
def install_ppa_key(owner, repo)
|
|
458
458
|
url = "https://launchpad.net/api/1.0/~#{owner}/+archive/#{repo}"
|
|
459
|
-
key_id =
|
|
459
|
+
key_id = TargetIO::HTTP.new(url).get("signing_key_fingerprint").delete('"')
|
|
460
460
|
install_key_from_keyserver(key_id, "keyserver.ubuntu.com")
|
|
461
461
|
rescue Net::HTTPClientException => e
|
|
462
462
|
raise "Could not access Launchpad ppa API: #{e.message}"
|
|
@@ -532,7 +532,7 @@ class Chef
|
|
|
532
532
|
# @return [void]
|
|
533
533
|
def cleanup_legacy_file!
|
|
534
534
|
legacy_path = "/etc/apt/sources.list.d/#{new_resource.name}.list"
|
|
535
|
-
if new_resource.name != new_resource.repo_name && ::File.exist?(legacy_path)
|
|
535
|
+
if new_resource.name != new_resource.repo_name && ::TargetIO::File.exist?(legacy_path)
|
|
536
536
|
converge_by "Cleaning up legacy #{legacy_path} repo file" do
|
|
537
537
|
file legacy_path do
|
|
538
538
|
action :delete
|
|
@@ -574,7 +574,12 @@ class Chef
|
|
|
574
574
|
|
|
575
575
|
signed_by = new_resource.signed_by
|
|
576
576
|
if signed_by == true
|
|
577
|
-
|
|
577
|
+
if new_resource.key || ::File.exist?(keyring_path)
|
|
578
|
+
signed_by = keyring_path
|
|
579
|
+
else
|
|
580
|
+
# There isn't a key to use, so don't set the signed-by attribute
|
|
581
|
+
signed_by = false
|
|
582
|
+
end
|
|
578
583
|
end
|
|
579
584
|
|
|
580
585
|
repo = build_repo(
|
|
@@ -604,7 +609,7 @@ class Chef
|
|
|
604
609
|
return unless debian?
|
|
605
610
|
|
|
606
611
|
cleanup_legacy_file!
|
|
607
|
-
if ::File.exist?("/etc/apt/sources.list.d/#{new_resource.repo_name}.list")
|
|
612
|
+
if ::TargetIO::File.exist?("/etc/apt/sources.list.d/#{new_resource.repo_name}.list")
|
|
608
613
|
converge_by "Removing #{new_resource.repo_name} repository from /etc/apt/sources.list.d/" do
|
|
609
614
|
apt_update new_resource.name do
|
|
610
615
|
ignore_failure true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Thom May (<thom@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -23,7 +23,8 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class AptUpdate < Chef::Resource
|
|
25
25
|
|
|
26
|
-
provides(:apt_update) { true }
|
|
26
|
+
provides(:apt_update, target_mode: true) { true }
|
|
27
|
+
target_mode support: :full
|
|
27
28
|
|
|
28
29
|
description "Use the **apt_update** resource to manage APT repository updates on Debian and Ubuntu platforms."
|
|
29
30
|
introduced "12.7"
|
|
@@ -62,8 +63,8 @@ class Chef
|
|
|
62
63
|
#
|
|
63
64
|
# @return [Boolean]
|
|
64
65
|
def apt_up_to_date?
|
|
65
|
-
::File.exist?("#{STAMP_DIR}/update-success-stamp") &&
|
|
66
|
-
::File.mtime("#{STAMP_DIR}/update-success-stamp") > Time.now - new_resource.frequency
|
|
66
|
+
::TargetIO::File.exist?("#{STAMP_DIR}/update-success-stamp") &&
|
|
67
|
+
::TargetIO::File.mtime("#{STAMP_DIR}/update-success-stamp") > Time.now - new_resource.frequency
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def do_update
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
|
4
4
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
|
5
5
|
#
|
|
@@ -70,8 +70,7 @@ begin
|
|
|
70
70
|
# ffi-libarchive must be eager loaded see: https://github.com/chef/chef/issues/12228
|
|
71
71
|
require "ffi-libarchive" unless defined?(Archive::Reader)
|
|
72
72
|
rescue LoadError => e
|
|
73
|
-
STDERR.puts "ffi-libarchive could not be loaded
|
|
74
|
-
STDERR.puts "libarchive is probably not installed on system, archive_file will not be available"
|
|
73
|
+
STDERR.puts "ffi-libarchive could not be loaded. libarchive is probably not installed on system, archive_file will not be available"
|
|
75
74
|
end
|
|
76
75
|
|
|
77
76
|
class Chef
|
|
@@ -172,9 +171,10 @@ class Chef
|
|
|
172
171
|
|
|
173
172
|
if new_resource.owner || new_resource.group
|
|
174
173
|
converge_by("set owner of files extracted in #{new_resource.destination} to #{new_resource.owner}:#{new_resource.group}") do
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
Archive::Reader.open_filename(new_resource.path, nil, strip_components: new_resource.strip_components) do |archive|
|
|
175
|
+
archive.each_entry do |e|
|
|
176
|
+
FileUtils.chown(new_resource.owner, new_resource.group, "#{new_resource.destination}/#{e.pathname}")
|
|
177
|
+
end
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
end
|
|
@@ -211,16 +211,17 @@ class Chef
|
|
|
211
211
|
# @return [Boolean]
|
|
212
212
|
def archive_differs_from_disk?(src, dest)
|
|
213
213
|
modified = false
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
214
|
+
Archive::Reader.open_filename(src, nil, strip_components: new_resource.strip_components) do |archive|
|
|
215
|
+
Chef::Log.trace("Beginning the comparison of file mtime between contents of #{src} and #{dest}")
|
|
216
|
+
archive.each_entry do |e|
|
|
217
|
+
pathname = ::File.expand_path(e.pathname, dest)
|
|
218
|
+
if ::File.exist?(pathname)
|
|
219
|
+
Chef::Log.trace("#{pathname} mtime is #{::File.mtime(pathname)} and archive is #{e.mtime}")
|
|
220
|
+
modified = true unless ::File.mtime(pathname) == e.mtime
|
|
221
|
+
else
|
|
222
|
+
Chef::Log.trace("#{pathname} doesn't exist on disk, but exists in the archive")
|
|
223
|
+
modified = true
|
|
224
|
+
end
|
|
224
225
|
end
|
|
225
226
|
end
|
|
226
227
|
modified
|
|
@@ -238,12 +239,11 @@ class Chef
|
|
|
238
239
|
flags = [options].flatten.map { |option| extract_option_map[option] }.compact.reduce(:|)
|
|
239
240
|
|
|
240
241
|
Dir.chdir(dest) do
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
Archive::Reader.open_filename(src, nil, strip_components: new_resource.strip_components) do |archive|
|
|
243
|
+
archive.each_entry do |e|
|
|
244
|
+
archive.extract(e, flags.to_i)
|
|
245
|
+
end
|
|
245
246
|
end
|
|
246
|
-
archive.close
|
|
247
247
|
end
|
|
248
248
|
end
|
|
249
249
|
end
|
data/lib/chef/resource/bash.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -22,7 +22,8 @@ class Chef
|
|
|
22
22
|
class Resource
|
|
23
23
|
class Bash < Chef::Resource::Script
|
|
24
24
|
|
|
25
|
-
provides :bash
|
|
25
|
+
provides :bash, target_mode: true
|
|
26
|
+
target_mode support: :full
|
|
26
27
|
|
|
27
28
|
description "Use the **bash** resource to execute scripts using the Bash interpreter. This resource may also use any of the actions and properties that are available to the **execute** resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
|
|
28
29
|
examples <<~'DOC'
|
data/lib/chef/resource/batch.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Edwards (<adamed@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Deepali Jagtap (<deepali.jagtap@clogeny.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -23,7 +23,8 @@ class Chef
|
|
|
23
23
|
class Resource
|
|
24
24
|
class BffPackage < Chef::Resource::Package
|
|
25
25
|
|
|
26
|
-
provides :bff_package
|
|
26
|
+
provides :bff_package, target_mode: true
|
|
27
|
+
target_mode support: :full
|
|
27
28
|
|
|
28
29
|
description "Use the **bff_package** resource to manage packages for the AIX platform using the installp utility. When a package is installed from a local file, it must be added to the node using the **remote_file** or **cookbook_file** resources."
|
|
29
30
|
introduced "12.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Daniel DeLeo (<dan@kallistec.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -24,6 +24,7 @@ class Chef
|
|
|
24
24
|
class Breakpoint < Chef::Resource
|
|
25
25
|
|
|
26
26
|
provides :breakpoint, target_mode: true
|
|
27
|
+
target_mode support: :full, introduced: "15.1"
|
|
27
28
|
|
|
28
29
|
description "Use the **breakpoint** resource to add breakpoints to recipes. Run the #{ChefUtils::Dist::Infra::SHELL} in #{ChefUtils::Dist::Infra::PRODUCT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{ChefUtils::Dist::Infra::CLIENT} during an actual #{ChefUtils::Dist::Infra::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
|
|
29
30
|
introduced "12.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|