chef 17.10.163 → 18.7.10
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 +25 -21
- data/README.md +7 -7
- data/Rakefile +3 -22
- data/{chef-universal-mingw32.gemspec → chef-universal-mingw-ucrt.gemspec} +7 -6
- data/chef.gemspec +33 -27
- data/lib/chef/api_client_v1.rb +9 -1
- data/lib/chef/application/base.rb +20 -2
- data/lib/chef/application/exit_code.rb +3 -3
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +21 -7
- data/lib/chef/chef_fs/path_utils.rb +7 -9
- data/lib/chef/client.rb +186 -2
- data/lib/chef/compliance/default_attributes.rb +2 -2
- data/lib/chef/compliance/input.rb +1 -1
- data/lib/chef/compliance/profile.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +0 -1
- data/lib/chef/compliance/runner.rb +6 -1
- data/lib/chef/compliance/waiver.rb +1 -1
- data/lib/chef/cookbook/chefignore.rb +4 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -3
- data/lib/chef/cookbook/synchronizer.rb +21 -3
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +2 -2
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/data_collector.rb +14 -0
- data/lib/chef/delayed_evaluator.rb +4 -0
- data/lib/chef/dsl/reader_helpers.rb +1 -1
- data/lib/chef/dsl/rest_resource.rb +77 -0
- data/lib/chef/event_dispatch/base.rb +3 -0
- data/lib/chef/event_dispatch/dispatcher.rb +0 -1
- data/lib/chef/exceptions.rb +9 -1
- data/lib/chef/file_access_control/windows.rb +4 -1
- data/lib/chef/file_cache.rb +17 -2
- data/lib/chef/formatters/doc.rb +1 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +2 -0
- data/lib/chef/http/authenticator.rb +253 -3
- data/lib/chef/http/ssl_policies.rb +2 -2
- data/lib/chef/mixin/{homebrew_user.rb → homebrew.rb} +13 -16
- data/lib/chef/mixin/openssl_helper.rb +1 -16
- data/lib/chef/mixin/powershell_exec.rb +5 -28
- data/lib/chef/monkey_patches/net-http.rb +127 -0
- data/lib/chef/node/attribute.rb +3 -11
- data/lib/chef/node/attribute_collections.rb +10 -1
- data/lib/chef/node/immutable_collections.rb +17 -6
- data/lib/chef/node/mixin/immutablize_array.rb +1 -0
- data/lib/chef/node/mixin/state_tracking.rb +7 -4
- data/lib/chef/node/mixin/state_tracking_array.rb +41 -0
- data/lib/chef/node.rb +23 -1
- data/lib/chef/platform/query_helpers.rb +4 -2
- data/lib/chef/policy_builder/policyfile.rb +8 -0
- data/lib/chef/property.rb +13 -6
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/http_request.rb +11 -9
- data/lib/chef/provider/launchd.rb +2 -1
- data/lib/chef/provider/mount/linux.rb +6 -1
- data/lib/chef/provider/mount/mount.rb +13 -5
- data/lib/chef/provider/mount/windows.rb +1 -1
- data/lib/chef/provider/package/apt.rb +11 -2
- data/lib/chef/provider/package/chocolatey.rb +260 -22
- data/lib/chef/provider/package/dnf/dnf_helper.py +7 -0
- data/lib/chef/provider/package/homebrew.rb +6 -9
- data/lib/chef/provider/package/powershell.rb +1 -0
- data/lib/chef/provider/package/rubygems.rb +5 -1
- data/lib/chef/provider/package/snap.rb +3 -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/yum/yum_helper.py +3 -3
- data/lib/chef/provider/package/zypper/version.rb +60 -0
- data/lib/chef/provider/package/zypper.rb +47 -3
- data/lib/chef/provider/powershell_script.rb +96 -6
- data/lib/chef/provider/registry_key.rb +2 -0
- data/lib/chef/provider/remote_file/http.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +23 -8
- data/lib/chef/provider/service/windows.rb +1 -1
- data/lib/chef/provider/service.rb +14 -0
- data/lib/chef/provider/user/aix.rb +5 -0
- data/lib/chef/provider/user/linux.rb +29 -0
- data/lib/chef/provider/user/mac.rb +1 -1
- data/lib/chef/provider/user/windows.rb +5 -0
- data/lib/chef/provider/user.rb +45 -9
- data/lib/chef/provider/yum_repository.rb +13 -1
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/recipe.rb +4 -12
- data/lib/chef/resource/_rest_resource.rb +389 -0
- data/lib/chef/resource/alternatives.rb +0 -1
- data/lib/chef/resource/apt_package.rb +21 -1
- data/lib/chef/resource/apt_preference.rb +0 -1
- data/lib/chef/resource/apt_repository.rb +138 -18
- data/lib/chef/resource/apt_update.rb +0 -1
- data/lib/chef/resource/archive_file.rb +0 -1
- data/lib/chef/resource/bash.rb +13 -1
- data/lib/chef/resource/batch.rb +0 -1
- data/lib/chef/resource/bff_package.rb +0 -1
- data/lib/chef/resource/breakpoint.rb +0 -1
- data/lib/chef/resource/build_essential.rb +0 -1
- data/lib/chef/resource/cab_package.rb +0 -1
- data/lib/chef/resource/chef_client_config.rb +12 -14
- data/lib/chef/resource/chef_client_cron.rb +1 -2
- data/lib/chef/resource/chef_client_launchd.rb +2 -2
- data/lib/chef/resource/chef_client_scheduled_task.rb +3 -3
- data/lib/chef/resource/chef_client_systemd_timer.rb +5 -1
- data/lib/chef/resource/chef_client_trusted_certificate.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -2
- data/lib/chef/resource/chef_handler.rb +0 -1
- data/lib/chef/resource/chef_sleep.rb +1 -3
- data/lib/chef/resource/chef_vault_secret.rb +0 -1
- data/lib/chef/resource/chocolatey_config.rb +0 -1
- data/lib/chef/resource/chocolatey_feature.rb +0 -1
- data/lib/chef/resource/chocolatey_installer.rb +207 -0
- data/lib/chef/resource/chocolatey_package.rb +8 -1
- data/lib/chef/resource/chocolatey_source.rb +0 -1
- data/lib/chef/resource/cookbook_file.rb +0 -1
- data/lib/chef/resource/cron/_cron_shared.rb +0 -1
- data/lib/chef/resource/cron/cron.rb +0 -1
- data/lib/chef/resource/cron/cron_d.rb +15 -1
- data/lib/chef/resource/cron_access.rb +0 -1
- data/lib/chef/resource/csh.rb +0 -1
- data/lib/chef/resource/directory.rb +0 -1
- data/lib/chef/resource/dmg_package.rb +2 -1
- data/lib/chef/resource/dnf_package.rb +0 -1
- data/lib/chef/resource/dpkg_package.rb +0 -1
- data/lib/chef/resource/dsc_resource.rb +0 -1
- data/lib/chef/resource/dsc_script.rb +1 -2
- data/lib/chef/resource/execute.rb +8 -7
- data/lib/chef/resource/file.rb +0 -1
- data/lib/chef/resource/freebsd_package.rb +2 -1
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/group.rb +25 -2
- data/lib/chef/resource/habitat/habitat_package.rb +0 -1
- data/lib/chef/resource/habitat/habitat_sup.rb +6 -7
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +1 -1
- data/lib/chef/resource/habitat_config.rb +0 -1
- data/lib/chef/resource/habitat_install.rb +2 -2
- data/lib/chef/resource/habitat_service.rb +0 -1
- data/lib/chef/resource/habitat_user_toml.rb +0 -1
- data/lib/chef/resource/homebrew_cask.rb +21 -33
- data/lib/chef/resource/homebrew_package.rb +3 -2
- data/lib/chef/resource/homebrew_tap.rb +32 -18
- data/lib/chef/resource/homebrew_update.rb +4 -6
- data/lib/chef/resource/hostname.rb +0 -1
- data/lib/chef/resource/http_request.rb +0 -1
- data/lib/chef/resource/ifconfig.rb +0 -1
- data/lib/chef/resource/inspec_input.rb +0 -1
- data/lib/chef/resource/inspec_waiver.rb +0 -1
- data/lib/chef/resource/inspec_waiver_file_entry.rb +2 -3
- data/lib/chef/resource/ips_package.rb +0 -1
- data/lib/chef/resource/kernel_module.rb +0 -1
- data/lib/chef/resource/ksh.rb +0 -1
- data/lib/chef/resource/launchd.rb +9 -3
- data/lib/chef/resource/link.rb +0 -1
- data/lib/chef/resource/locale.rb +0 -1
- data/lib/chef/resource/log.rb +0 -1
- data/lib/chef/resource/lwrp_base.rb +0 -4
- data/lib/chef/resource/macos_pkg.rb +111 -0
- data/lib/chef/resource/macos_userdefaults.rb +3 -4
- data/lib/chef/resource/macosx_service.rb +0 -1
- data/lib/chef/resource/macports_package.rb +2 -1
- data/lib/chef/resource/mdadm.rb +0 -1
- data/lib/chef/resource/mount.rb +0 -1
- data/lib/chef/resource/msu_package.rb +0 -1
- data/lib/chef/resource/notify_group.rb +0 -2
- data/lib/chef/resource/ohai.rb +0 -1
- data/lib/chef/resource/ohai_hint.rb +0 -1
- data/lib/chef/resource/openbsd_package.rb +2 -1
- data/lib/chef/resource/openssl_dhparam.rb +0 -2
- data/lib/chef/resource/openssl_ec_private_key.rb +0 -2
- data/lib/chef/resource/openssl_ec_public_key.rb +0 -2
- data/lib/chef/resource/openssl_rsa_private_key.rb +0 -2
- data/lib/chef/resource/openssl_rsa_public_key.rb +0 -2
- data/lib/chef/resource/openssl_x509_certificate.rb +0 -2
- data/lib/chef/resource/openssl_x509_crl.rb +0 -2
- data/lib/chef/resource/openssl_x509_request.rb +0 -2
- data/lib/chef/resource/osx_profile.rb +0 -1
- data/lib/chef/resource/package.rb +0 -1
- data/lib/chef/resource/pacman_package.rb +2 -1
- data/lib/chef/resource/paludis_package.rb +0 -1
- data/lib/chef/resource/perl.rb +0 -1
- data/lib/chef/resource/plist.rb +7 -3
- data/lib/chef/resource/portage_package.rb +2 -1
- data/lib/chef/resource/powershell_package.rb +4 -1
- data/lib/chef/resource/powershell_package_source.rb +0 -1
- data/lib/chef/resource/powershell_script.rb +5 -2
- data/lib/chef/resource/python.rb +0 -1
- data/lib/chef/resource/reboot.rb +0 -1
- data/lib/chef/resource/registry_key.rb +6 -1
- data/lib/chef/resource/remote_directory.rb +0 -1
- data/lib/chef/resource/remote_file.rb +0 -1
- data/lib/chef/resource/rhsm_errata.rb +0 -1
- data/lib/chef/resource/rhsm_errata_level.rb +0 -1
- data/lib/chef/resource/rhsm_register.rb +2 -4
- data/lib/chef/resource/rhsm_repo.rb +0 -1
- data/lib/chef/resource/rhsm_subscription.rb +0 -1
- data/lib/chef/resource/route.rb +0 -1
- data/lib/chef/resource/rpm_package.rb +2 -1
- data/lib/chef/resource/ruby.rb +0 -1
- data/lib/chef/resource/ruby_block.rb +0 -1
- data/lib/chef/resource/scm/_scm.rb +0 -2
- data/lib/chef/resource/scm/git.rb +0 -2
- data/lib/chef/resource/scm/subversion.rb +0 -2
- data/lib/chef/resource/script.rb +0 -1
- data/lib/chef/resource/selinux/common_helpers.rb +47 -0
- data/lib/chef/resource/selinux/selinux_debian.erb +18 -0
- data/lib/chef/resource/selinux/selinux_default.erb +15 -0
- data/lib/chef/resource/selinux_boolean.rb +101 -0
- data/lib/chef/resource/selinux_fcontext.rb +160 -0
- data/lib/chef/resource/selinux_install.rb +107 -0
- data/lib/chef/resource/selinux_login.rb +129 -0
- data/lib/chef/resource/selinux_module.rb +143 -0
- data/lib/chef/resource/selinux_permissive.rb +64 -0
- data/lib/chef/resource/selinux_port.rb +118 -0
- data/lib/chef/resource/selinux_state.rb +166 -0
- data/lib/chef/resource/selinux_user.rb +137 -0
- data/lib/chef/resource/service.rb +4 -2
- data/lib/chef/resource/smartos_package.rb +2 -1
- data/lib/chef/resource/snap_package.rb +25 -1
- data/lib/chef/resource/solaris_package.rb +2 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +0 -1
- data/lib/chef/resource/sudo.rb +37 -3
- data/lib/chef/resource/support/client.erb +2 -2
- data/lib/chef/resource/support/ulimit.erb +40 -0
- data/lib/chef/resource/swap_file.rb +0 -1
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +0 -1
- data/lib/chef/resource/template.rb +0 -1
- data/lib/chef/resource/timezone.rb +0 -1
- data/lib/chef/resource/user/aix_user.rb +0 -1
- data/lib/chef/resource/user/linux_user.rb +0 -1
- data/lib/chef/resource/user/mac_user.rb +0 -1
- data/lib/chef/resource/user/pw_user.rb +0 -1
- data/lib/chef/resource/user/solaris_user.rb +0 -1
- data/lib/chef/resource/user/windows_user.rb +0 -1
- data/lib/chef/resource/user.rb +10 -1
- data/lib/chef/resource/user_ulimit.rb +38 -1
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -1
- data/lib/chef/resource/windows_ad_join.rb +0 -2
- data/lib/chef/resource/windows_audit_policy.rb +0 -2
- data/lib/chef/resource/windows_auto_run.rb +0 -1
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +0 -1
- data/lib/chef/resource/windows_defender_exclusion.rb +0 -1
- data/lib/chef/resource/windows_dfs_folder.rb +0 -1
- data/lib/chef/resource/windows_dfs_namespace.rb +0 -1
- data/lib/chef/resource/windows_dfs_server.rb +0 -1
- data/lib/chef/resource/windows_dns_record.rb +0 -1
- data/lib/chef/resource/windows_dns_zone.rb +0 -1
- data/lib/chef/resource/windows_env.rb +0 -1
- data/lib/chef/resource/windows_feature.rb +0 -1
- data/lib/chef/resource/windows_feature_dism.rb +0 -1
- data/lib/chef/resource/windows_feature_powershell.rb +0 -1
- data/lib/chef/resource/windows_firewall_profile.rb +0 -2
- data/lib/chef/resource/windows_firewall_rule.rb +0 -1
- data/lib/chef/resource/windows_font.rb +2 -3
- data/lib/chef/resource/windows_package.rb +3 -4
- data/lib/chef/resource/windows_pagefile.rb +0 -2
- data/lib/chef/resource/windows_path.rb +0 -1
- data/lib/chef/resource/windows_printer.rb +0 -1
- data/lib/chef/resource/windows_printer_port.rb +0 -1
- data/lib/chef/resource/windows_script.rb +0 -2
- data/lib/chef/resource/windows_security_policy.rb +2 -3
- data/lib/chef/resource/windows_service.rb +0 -1
- data/lib/chef/resource/windows_share.rb +0 -1
- data/lib/chef/resource/windows_shortcut.rb +1 -2
- data/lib/chef/resource/windows_task.rb +0 -1
- data/lib/chef/resource/windows_uac.rb +0 -1
- data/lib/chef/resource/windows_update_settings.rb +0 -1
- data/lib/chef/resource/windows_user_privilege.rb +14 -11
- data/lib/chef/resource/windows_workgroup.rb +0 -1
- data/lib/chef/resource/yum_package.rb +2 -1
- data/lib/chef/resource/yum_repository.rb +4 -1
- data/lib/chef/resource/zypper_package.rb +2 -1
- data/lib/chef/resource/zypper_repository.rb +0 -1
- data/lib/chef/resource.rb +23 -5
- data/lib/chef/resource_inspector.rb +25 -7
- data/lib/chef/resource_reporter.rb +4 -0
- data/lib/chef/resources.rb +11 -0
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/secret_fetcher/azure_key_vault.rb +1 -1
- data/lib/chef/util/powershell/ps_credential.rb +10 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/handle.rb +6 -7
- data/lib/chef/win32/registry.rb +12 -4
- data/lib/chef/win32/security.rb +16 -1
- data/spec/data/rubygems.org/sexp_processor-info +2 -1
- data/spec/data/trusted_certs/intermediate.pem +38 -27
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +1 -1
- data/spec/functional/resource/execute_spec.rb +1 -1
- data/spec/functional/resource/group_spec.rb +26 -42
- data/spec/functional/resource/link_spec.rb +8 -8
- data/spec/functional/resource/plist_spec.rb +25 -0
- data/spec/functional/resource/registry_spec.rb +233 -609
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/user/linux_user_spec.rb +127 -0
- data/spec/functional/resource/windows_certificate_spec.rb +1 -1
- data/spec/functional/resource/windows_font_spec.rb +12 -9
- data/spec/functional/resource/yum_package_spec.rb +1 -1
- data/spec/functional/resource/zypper_package_spec.rb +12 -0
- data/spec/functional/shell_spec.rb +1 -2
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/registry_spec.rb +0 -3
- data/spec/integration/client/client_spec.rb +88 -3
- data/spec/integration/client/exit_code_spec.rb +1 -1
- data/spec/integration/client/fips_spec.rb +5 -5
- data/spec/integration/client/ipv6_spec.rb +1 -1
- data/spec/integration/client/open_ssl_spec.rb +3 -3
- data/spec/integration/compliance/compliance_spec.rb +1 -1
- data/spec/integration/recipes/accumulator_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_spec.rb +1 -1
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/notifying_block_spec.rb +1 -1
- data/spec/integration/recipes/remote_directory.rb +1 -1
- data/spec/integration/recipes/unified_mode_spec.rb +1 -1
- data/spec/integration/recipes/use_partial_spec.rb +2 -1
- data/spec/integration/solo/solo_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -4
- data/spec/support/chef_helpers.rb +2 -2
- data/spec/support/platform_helpers.rb +28 -7
- data/spec/support/ruby_installer.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +3 -3
- data/spec/support/shared/functional/windows_script.rb +2 -2
- data/spec/tiny_server.rb +5 -2
- data/spec/unit/application/client_spec.rb +0 -10
- data/spec/unit/chef_fs/file_system_spec.rb +2 -0
- data/spec/unit/client_spec.rb +80 -4
- data/spec/unit/compliance/runner_spec.rb +8 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/data_collector_spec.rb +106 -2
- data/spec/unit/delayed_evaluator_spec.rb +35 -0
- data/spec/unit/file_cache_spec.rb +64 -0
- data/spec/unit/http/authenticator_spec.rb +121 -0
- data/spec/unit/mixin/homebrew_spec.rb +118 -0
- data/spec/unit/mixin/openssl_helper_spec.rb +5 -0
- data/spec/unit/mixin/powershell_exec_spec.rb +5 -5
- data/spec/unit/node/vivid_mash_spec.rb +42 -0
- data/spec/unit/node_spec.rb +6 -0
- data/spec/unit/platform/query_helpers_spec.rb +2 -17
- data/spec/unit/property/validation_spec.rb +30 -0
- data/spec/unit/provider/apt_repository_spec.rb +48 -12
- data/spec/unit/provider/cron_spec.rb +2 -0
- data/spec/unit/provider/http_request_spec.rb +60 -72
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/mount/aix_spec.rb +2 -2
- data/spec/unit/provider/mount/linux_spec.rb +15 -4
- data/spec/unit/provider/mount/mount_spec.rb +8 -8
- data/spec/unit/provider/package/apt_spec.rb +18 -13
- data/spec/unit/provider/package/chocolatey_spec.rb +41 -9
- data/spec/unit/provider/package/homebrew_spec.rb +4 -1
- data/spec/unit/provider/package/rpm_spec.rb +2 -2
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/package/windows_spec.rb +5 -5
- data/spec/unit/provider/package/zypper_spec.rb +32 -0
- data/spec/unit/provider/powershell_script_spec.rb +100 -4
- data/spec/unit/provider/registry_key_spec.rb +17 -17
- data/spec/unit/provider/remote_file/http_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +1 -0
- data/spec/unit/provider/user/linux_spec.rb +51 -1
- data/spec/unit/provider/user/windows_spec.rb +1 -0
- data/spec/unit/provider/user_spec.rb +24 -6
- data/spec/unit/resource/apt_repository_spec.rb +5 -0
- data/spec/unit/resource/archive_file_spec.rb +1 -1
- data/spec/unit/resource/chef_client_cron_spec.rb +5 -0
- data/spec/unit/resource/chef_client_launchd_spec.rb +5 -0
- data/spec/unit/resource/chef_client_scheduled_task_spec.rb +5 -0
- data/spec/unit/resource/chef_client_systemd_timer_spec.rb +1 -1
- data/spec/unit/resource/chocolatey_installer_spec.rb +151 -0
- data/spec/unit/resource/cron_d_spec.rb +37 -1
- data/spec/unit/resource/macos_pkg_spec.rb +38 -0
- data/spec/unit/resource/powershell_script_spec.rb +2 -2
- data/spec/unit/resource/rest_resource_spec.rb +381 -0
- data/spec/unit/resource/selinux_boolean_spec.rb +92 -0
- data/spec/unit/resource/selinux_fcontext_spec.rb +65 -0
- data/spec/unit/resource/selinux_install_spec.rb +60 -0
- data/spec/unit/resource/selinux_login_spec.rb +73 -0
- data/spec/unit/resource/selinux_module_spec.rb +55 -0
- data/spec/unit/resource/selinux_permissive_spec.rb +39 -0
- data/spec/unit/resource/selinux_port_spec.rb +42 -0
- data/spec/unit/resource/selinux_state_spec.rb +46 -0
- data/spec/unit/resource/selinux_user_spec.rb +92 -0
- data/spec/unit/resource/sysctl_spec.rb +2 -2
- data/spec/unit/resource/user/linux_user_spec.rb +42 -0
- data/spec/unit/resource/yum_repository_spec.rb +4 -0
- data/spec/unit/resource_inspector_spec.rb +36 -0
- data/spec/unit/resource_reporter_spec.rb +57 -3
- data/spec/unit/resource_spec.rb +94 -2
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +1 -1
- data/spec/unit/util/powershell/ps_credential_spec.rb +6 -0
- data/tasks/rspec.rb +1 -1
- metadata +126 -44
- data/lib/chef/powershell.rb +0 -81
- data/spec/unit/mixin/homebrew_user_spec.rb +0 -119
- /data/spec/functional/assets/yumrepo/repodata/{01a3b-filelists.sqlite.bz2 → 4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{6bf96-other.xml.gz → 74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{5dc1e-primary.sqlite.bz2 → a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{7c365-other.sqlite.bz2 → af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{401dc-filelists.xml.gz → bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{dabe2-primary.xml.gz → c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fabe2b150e8e4c5d896ff16118a5d7c7b93a4cbb61b1eb322e42b02bb0e2df1a
|
|
4
|
+
data.tar.gz: 422fbcf9e1baf1be9836c9ac068cfeae656aa30f7dc14752713d5d1a2d1b2b0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2159cd19d094c057d47b326beba0b596948c32b8ea5be5dca61633a283c26d485e3aaa71ae154e31b997468c524796dc4ff7b2108bb300e1d13ff7981c4b6656
|
|
7
|
+
data.tar.gz: 1ec8346ff872c8b27077216e53461a680c26e8cef5aef0cf431b1ebab1749e58e1430885299854c3ad06c271f4b00b7f085d5cf6604b3fb37fb5692554899e0c
|
data/Gemfile
CHANGED
|
@@ -2,11 +2,20 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gem "chef", path: "."
|
|
4
4
|
|
|
5
|
-
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "
|
|
5
|
+
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "18-stable"
|
|
6
6
|
|
|
7
|
+
# Nwed to file a bug with rest-client. In the meantime, we can use this until they accept the update.
|
|
8
|
+
gem "rest-client", git: "https://github.com/chef/rest-client", branch: "jfm/ucrt_update1"
|
|
9
|
+
|
|
10
|
+
gem "ffi", ">= 1.15.5", "<= 1.17.0"
|
|
7
11
|
gem "chef-utils", path: File.expand_path("chef-utils", __dir__) if File.exist?(File.expand_path("chef-utils", __dir__))
|
|
8
12
|
gem "chef-config", path: File.expand_path("chef-config", __dir__) if File.exist?(File.expand_path("chef-config", __dir__))
|
|
9
13
|
|
|
14
|
+
# required for FIPS or bundler will pick up default openssl
|
|
15
|
+
install_if -> { RUBY_PLATFORM !~ /darwin/ } do
|
|
16
|
+
gem "openssl", "= 3.2.0"
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
if File.exist?(File.expand_path("chef-bin", __dir__))
|
|
11
20
|
# bundling in a git checkout
|
|
12
21
|
gem "chef-bin", path: File.expand_path("chef-bin", __dir__)
|
|
@@ -15,27 +24,19 @@ else
|
|
|
15
24
|
gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
|
|
16
25
|
end
|
|
17
26
|
|
|
18
|
-
gem "cheffish", "
|
|
19
|
-
|
|
20
|
-
gem "ast", "~> 2.4.2"
|
|
21
|
-
gem "rubocop-ast", ">= 1.31.0"
|
|
22
|
-
|
|
23
|
-
gem "rdoc", "~> 6.3.4" # 6.3.4.1 required for CVE-2024-27281, allow patch upgrades
|
|
24
|
-
|
|
25
|
-
# Verify and macOS bring their own ruby setups are inconsistent with our OpenSSL configurations
|
|
26
|
-
install_if -> { RUBY_PLATFORM !~ /darwin/ && ENV["BUILDKITE_PIPELINE_SLUG"] !~ /verify/ } do
|
|
27
|
-
gem "openssl", "= 3.2.0"
|
|
28
|
-
end
|
|
27
|
+
gem "cheffish", ">= 17"
|
|
29
28
|
|
|
30
29
|
group(:omnibus_package) do
|
|
31
30
|
gem "appbundler"
|
|
32
31
|
gem "rb-readline"
|
|
33
|
-
gem "inspec-core-bin", "
|
|
32
|
+
gem "inspec-core-bin", ">= 5", "< 6" # need to provide the binaries for inspec
|
|
34
33
|
gem "chef-vault"
|
|
35
34
|
end
|
|
36
35
|
|
|
37
36
|
group(:omnibus_package, :pry) do
|
|
38
|
-
|
|
37
|
+
# Locked because pry-byebug is broken with 13+.
|
|
38
|
+
# some work is ongoing? https://github.com/deivid-rodriguez/pry-byebug/issues/343
|
|
39
|
+
gem "pry", "= 0.13.0"
|
|
39
40
|
# byebug does not install on freebsd on ruby 3.0
|
|
40
41
|
gem "pry-byebug" unless RUBY_PLATFORM.match?(/freebsd/i)
|
|
41
42
|
gem "pry-stack_explorer"
|
|
@@ -43,8 +44,10 @@ end
|
|
|
43
44
|
|
|
44
45
|
# Everything except AIX and Windows
|
|
45
46
|
group(:ruby_shadow) do
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
install_if -> { !RUBY_PLATFORM.match?(/mingw/) } do
|
|
48
|
+
# if ruby-shadow does a release that supports ruby-3.0 this can be removed
|
|
49
|
+
gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby
|
|
50
|
+
end
|
|
48
51
|
end
|
|
49
52
|
|
|
50
53
|
# deps that cannot be put in the knife gem because they require a compiler and fail on windows nodes
|
|
@@ -53,17 +56,18 @@ group(:knife_windows_deps) do
|
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
group(:development, :test) do
|
|
56
|
-
gem "rake"
|
|
59
|
+
gem "rake", ">= 12.3.3"
|
|
57
60
|
gem "rspec"
|
|
58
61
|
gem "webmock"
|
|
59
62
|
gem "crack", "< 0.4.6" # due to https://github.com/jnunemaker/crack/pull/75
|
|
60
63
|
gem "fauxhai-ng" # for chef-utils gem
|
|
61
64
|
end
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
gem "chefstyle"
|
|
67
|
+
# group(:chefstyle) do
|
|
68
|
+
# # for testing new chefstyle rules
|
|
69
|
+
# gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "main"
|
|
70
|
+
# end
|
|
67
71
|
|
|
68
72
|
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
|
69
73
|
|
data/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Chef Infra
|
|
2
2
|
[](https://codeclimate.com/github/chef/chef)
|
|
3
|
-
[](https://buildkite.com/chef-oss/chef-chef-main-verify)
|
|
4
4
|
[](https://badge.fury.io/rb/chef)
|
|
5
|
-
[](https://github.com/chef/chef/blob/
|
|
5
|
+
[](https://github.com/chef/chef/blob/main/docs/dev/design_documents/client_release_cadence.md)
|
|
6
6
|
|
|
7
|
-
**Umbrella Project**: [Chef Infra](https://github.com/chef/chef-oss-practices/blob/
|
|
7
|
+
**Umbrella Project**: [Chef Infra](https://github.com/chef/chef-oss-practices/blob/main/projects/chef-infra.md)
|
|
8
8
|
|
|
9
|
-
**Project State**: [Active](https://github.com/chef/chef-oss-practices/blob/
|
|
9
|
+
**Project State**: [Active](https://github.com/chef/chef-oss-practices/blob/main/repo-management/repo-states.md#active)
|
|
10
10
|
|
|
11
|
-
**Issues [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/
|
|
11
|
+
**Issues [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/main/repo-management/repo-states.md)**: 14 days
|
|
12
12
|
|
|
13
|
-
**Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/
|
|
13
|
+
**Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/main/repo-management/repo-states.md)**: 14 days
|
|
14
14
|
|
|
15
15
|
## Getting Started
|
|
16
16
|
|
|
@@ -23,7 +23,7 @@ For Chef Infra usage, please refer to [Learn Chef](https://learn.chef.io/), our
|
|
|
23
23
|
Other useful resources for Chef Infra users:
|
|
24
24
|
|
|
25
25
|
- Documentation: <https://docs.chef.io/>
|
|
26
|
-
- Source: <https://github.com/chef/chef/tree/
|
|
26
|
+
- Source: <https://github.com/chef/chef/tree/main>
|
|
27
27
|
- Tickets/Issues: <https://github.com/chef/chef/issues>
|
|
28
28
|
- Slack: [Chef Community Slack](https://community-slack.chef.io/)
|
|
29
29
|
- Mailing list/Forum: <https://discourse.chef.io>
|
data/Rakefile
CHANGED
|
@@ -40,7 +40,7 @@ namespace :pre_install do
|
|
|
40
40
|
%w{chef-utils chef-config}.each do |gem|
|
|
41
41
|
path = ::File.join(::File.dirname(__FILE__), gem)
|
|
42
42
|
Dir.chdir(path) do
|
|
43
|
-
|
|
43
|
+
system "rake install"
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -61,9 +61,9 @@ end
|
|
|
61
61
|
|
|
62
62
|
# hack in all the preinstall tasks to occur before the traditional install task
|
|
63
63
|
task install: "pre_install:all"
|
|
64
|
-
|
|
65
64
|
# make sure we build the correct gemspec on windows
|
|
66
|
-
gemspec = Gem.win_platform? ? "chef-universal-
|
|
65
|
+
gemspec = Gem.win_platform? ? "chef-universal-mingw-ucrt" : "chef"
|
|
66
|
+
|
|
67
67
|
Bundler::GemHelper.install_tasks name: gemspec
|
|
68
68
|
|
|
69
69
|
# this gets appended to the normal bundler install helper
|
|
@@ -99,25 +99,6 @@ task :register_eventlog do
|
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
desc "Copies powershell_exec related binaries from the latest built Habitat Packages"
|
|
103
|
-
task :update_chef_exec_dll do
|
|
104
|
-
raise "This task must be run on Windows since we are installing a Windows targeted package!" unless Gem.win_platform?
|
|
105
|
-
|
|
106
|
-
require "mkmf"
|
|
107
|
-
raise "Unable to locate Habitat cli. Please install Habitat cli before invoking this task!" unless find_executable "hab"
|
|
108
|
-
|
|
109
|
-
sh("hab pkg install chef/chef-powershell-shim")
|
|
110
|
-
sh("hab pkg install chef/chef-powershell-shim-x86")
|
|
111
|
-
x64 = `hab pkg path chef/chef-powershell-shim`.chomp.tr("\\", "/")
|
|
112
|
-
x86 = `hab pkg path chef/chef-powershell-shim-x86`.chomp.tr("\\", "/")
|
|
113
|
-
FileUtils.rm_rf(Dir["distro/ruby_bin_folder/AMD64/*"])
|
|
114
|
-
FileUtils.rm_rf(Dir["distro/ruby_bin_folder/x86/*"])
|
|
115
|
-
puts "Copying #{x64}/bin/* to distro/ruby_bin_folder/AMD64"
|
|
116
|
-
FileUtils.cp_r(Dir["#{x64}/bin/*"], "distro/ruby_bin_folder/AMD64")
|
|
117
|
-
puts "Copying #{x86}/bin/* to distro/ruby_bin_folder/x86"
|
|
118
|
-
FileUtils.cp_r(Dir["#{x86}/bin/*"], "distro/ruby_bin_folder/x86")
|
|
119
|
-
end
|
|
120
|
-
|
|
121
102
|
begin
|
|
122
103
|
require "chefstyle"
|
|
123
104
|
require "rubocop/rake_task"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
gemspec =
|
|
1
|
+
gemspec = instance_eval(File.read(File.expand_path("chef.gemspec", __dir__)))
|
|
2
2
|
|
|
3
|
-
gemspec.platform = Gem::Platform.new(%w{universal
|
|
3
|
+
gemspec.platform = Gem::Platform.new(%w{universal mingw-ucrt})
|
|
4
4
|
|
|
5
|
-
gemspec.add_dependency "win32-api", "~> 1.
|
|
5
|
+
gemspec.add_dependency "win32-api", "~> 1.10.0"
|
|
6
6
|
gemspec.add_dependency "win32-event", "~> 0.6.1"
|
|
7
7
|
# TODO: Relax this pin and make the necessary updaets. The issue originally
|
|
8
8
|
# leading to this pin has been fixed in 0.6.5.
|
|
@@ -11,11 +11,12 @@ gemspec.add_dependency "win32-mmap", "~> 0.4.1"
|
|
|
11
11
|
gemspec.add_dependency "win32-mutex", "~> 0.4.2"
|
|
12
12
|
gemspec.add_dependency "win32-process", "~> 0.9"
|
|
13
13
|
gemspec.add_dependency "win32-service", ">= 2.1.5", "< 3.0"
|
|
14
|
-
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
|
|
15
|
-
gemspec.add_dependency "win32-certstore", "~> 0.6.15"
|
|
16
14
|
gemspec.add_dependency "wmi-lite", "~> 1.0"
|
|
15
|
+
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
|
|
17
16
|
gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
|
|
18
|
-
gemspec.add_dependency "
|
|
17
|
+
gemspec.add_dependency "win32-certstore", "~> 0.6.15" # 0.5+ required for specifying user vs. system store
|
|
18
|
+
gemspec.add_dependency "chef-powershell", "~> 18.1.0" # The guts of the powershell_exec code have been moved to its own gem, chef-powershell. It's part of the chef-powershell-shim repo.
|
|
19
|
+
|
|
19
20
|
gemspec.extensions << "ext/win32-eventlog/Rakefile"
|
|
20
21
|
gemspec.files += Dir.glob("{distro,ext}/**/*")
|
|
21
22
|
|
data/chef.gemspec
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
# on Windows, the directory location starts with "(eval at " because it's
|
|
2
|
+
# being evaled in
|
|
3
|
+
file_directory = File.dirname(__FILE__).gsub(/\(eval at /, "")
|
|
4
|
+
$:.unshift(File.join(file_directory, "lib"))
|
|
2
5
|
vs_path = File.expand_path("chef-utils/lib/chef-utils/version_string.rb", __dir__)
|
|
3
6
|
|
|
4
7
|
if File.exist?(vs_path)
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# if the path doesn't exist then we're just in the wild gem and not in the git repo
|
|
9
|
-
require "chef-utils/version_string"
|
|
8
|
+
# include chef-utils/lib in the path if we're inside of chef vs. chef-utils gem
|
|
9
|
+
# but add it to the end of the search path
|
|
10
|
+
$: << File.join(file_directory, "chef-utils", "lib")
|
|
10
11
|
end
|
|
12
|
+
# if the path doesn't exist then we're just in the wild gem and not in the git repo
|
|
13
|
+
require "chef-utils/version_string"
|
|
11
14
|
require "chef/version"
|
|
12
15
|
|
|
13
16
|
Gem::Specification.new do |s|
|
|
14
17
|
s.name = "chef"
|
|
15
18
|
s.version = Chef::VERSION
|
|
16
19
|
s.platform = Gem::Platform::RUBY
|
|
17
|
-
s.extra_rdoc_files = ["README.md", "LICENSE"
|
|
20
|
+
s.extra_rdoc_files = ["README.md", "LICENSE"]
|
|
18
21
|
s.summary = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure."
|
|
19
22
|
s.description = s.summary
|
|
20
23
|
s.license = "Apache-2.0"
|
|
@@ -22,29 +25,35 @@ Gem::Specification.new do |s|
|
|
|
22
25
|
s.email = "adam@chef.io"
|
|
23
26
|
s.homepage = "https://www.chef.io"
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
if RUBY_PLATFORM =~ /aix/
|
|
29
|
+
s.required_ruby_version = ">= 3.0.3"
|
|
30
|
+
else
|
|
31
|
+
s.required_ruby_version = ">= 3.1.0"
|
|
32
|
+
end
|
|
26
33
|
|
|
27
34
|
s.add_dependency "chef-config", "= #{Chef::VERSION}"
|
|
28
35
|
s.add_dependency "chef-utils", "= #{Chef::VERSION}"
|
|
29
|
-
s.add_dependency "train-core", "~> 3.10", "
|
|
30
|
-
s.add_dependency "train-winrm", "
|
|
36
|
+
s.add_dependency "train-core", "~> 3.10", "<= 3.12.13"
|
|
37
|
+
s.add_dependency "train-winrm", "~> 0.2.17"
|
|
38
|
+
s.add_dependency "train-rest", ">= 0.4.1" # target mode with rest APIs
|
|
31
39
|
|
|
32
40
|
s.add_dependency "license-acceptance", ">= 1.0.5", "< 3"
|
|
33
41
|
s.add_dependency "mixlib-cli", ">= 2.1.1", "< 3.0"
|
|
34
|
-
s.add_dependency "mixlib-log", ">= 2.0.3", "<
|
|
42
|
+
s.add_dependency "mixlib-log", ">= 2.0.3", "< 3.2"
|
|
35
43
|
s.add_dependency "mixlib-authentication", ">= 2.1", "< 4"
|
|
36
44
|
s.add_dependency "mixlib-shellout", ">= 3.1.1", "< 4.0"
|
|
37
45
|
s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
|
|
38
|
-
s.add_dependency "ohai", "~>
|
|
39
|
-
s.add_dependency "inspec-core", "
|
|
46
|
+
s.add_dependency "ohai", "~> 18.0"
|
|
47
|
+
s.add_dependency "inspec-core", ">= 5", "< 6"
|
|
40
48
|
|
|
41
|
-
s.add_dependency "ffi", "
|
|
42
|
-
s.add_dependency "ffi-yajl", "
|
|
49
|
+
s.add_dependency "ffi", ">= 1.15.5", "<= 1.16.3"
|
|
50
|
+
s.add_dependency "ffi-yajl", "~> 2.2"
|
|
43
51
|
s.add_dependency "net-sftp", ">= 2.1.2", "< 5.0" # remote_file resource
|
|
52
|
+
s.add_dependency "net-ftp" # remote_file resource
|
|
44
53
|
s.add_dependency "erubis", "~> 2.7" # template resource / cookbook syntax check
|
|
45
54
|
s.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
|
|
46
55
|
s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3" # archive_file resource
|
|
47
|
-
s.add_dependency "chef-zero", ">=
|
|
56
|
+
s.add_dependency "chef-zero", ">= 15.0.17"
|
|
48
57
|
s.add_dependency "chef-vault" # chef-vault resources and helpers
|
|
49
58
|
|
|
50
59
|
s.add_dependency "plist", "~> 3.2" # launchd, dscl/mac user, macos_userdefaults, osx_profile and plist resources
|
|
@@ -52,6 +61,7 @@ Gem::Specification.new do |s|
|
|
|
52
61
|
s.add_dependency "addressable"
|
|
53
62
|
s.add_dependency "syslog-logger", "~> 1.6"
|
|
54
63
|
s.add_dependency "uuidtools", ">= 2.1.5", "< 3.0" # osx_profile resource
|
|
64
|
+
s.add_dependency "unf_ext", "~> 0.0.8.2" # older platforms
|
|
55
65
|
s.add_dependency "corefoundation", "~> 0.3.4" # macos_userdefaults resource
|
|
56
66
|
|
|
57
67
|
s.add_dependency "proxifier2", "~> 1.1"
|
|
@@ -59,13 +69,9 @@ Gem::Specification.new do |s|
|
|
|
59
69
|
s.add_dependency "aws-sdk-s3", "~> 1.91" # s3 recipe-url support
|
|
60
70
|
s.add_dependency "aws-sdk-secretsmanager", "~> 1.46"
|
|
61
71
|
s.add_dependency "vault", "~> 0.18.2" # hashi vault official client gem
|
|
62
|
-
s.bindir = "bin"
|
|
63
|
-
s.executables = %w{ }
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
s.add_dependency "uri", "= 0.10.1"
|
|
68
|
-
end
|
|
73
|
+
s.bindir = "bin"
|
|
74
|
+
s.executables = %w{ }
|
|
69
75
|
|
|
70
76
|
s.require_paths = %w{ lib }
|
|
71
77
|
s.files = %w{Gemfile Rakefile LICENSE README.md} +
|
|
@@ -74,11 +80,11 @@ Gem::Specification.new do |s|
|
|
|
74
80
|
Dir.glob("tasks/rspec.rb")
|
|
75
81
|
|
|
76
82
|
s.metadata = {
|
|
77
|
-
"bug_tracker_uri"
|
|
78
|
-
"changelog_uri"
|
|
83
|
+
"bug_tracker_uri" => "https://github.com/chef/chef/issues",
|
|
84
|
+
"changelog_uri" => "https://github.com/chef/chef/blob/main/CHANGELOG.md",
|
|
79
85
|
"documentation_uri" => "https://docs.chef.io/",
|
|
80
|
-
"homepage_uri"
|
|
81
|
-
"mailing_list_uri"
|
|
82
|
-
"source_code_uri"
|
|
86
|
+
"homepage_uri" => "https://www.chef.io",
|
|
87
|
+
"mailing_list_uri" => "https://discourse.chef.io/",
|
|
88
|
+
"source_code_uri" => "https://github.com/chef/chef/",
|
|
83
89
|
}
|
|
84
90
|
end
|
data/lib/chef/api_client_v1.rb
CHANGED
|
@@ -64,6 +64,10 @@ class Chef
|
|
|
64
64
|
@chef_rest_v1 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "1", inflate_json_class: false })
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
def chef_rest_v1_with_validator
|
|
68
|
+
@chef_rest_v1_with_validator ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { client_name: Chef::Config[:validation_client_name], signing_key_filename: Chef::Config[:validation_key], api_version: "1", inflate_json_class: false })
|
|
69
|
+
end
|
|
70
|
+
|
|
67
71
|
def self.http_api
|
|
68
72
|
Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "1", inflate_json_class: false })
|
|
69
73
|
end
|
|
@@ -293,7 +297,11 @@ class Chef
|
|
|
293
297
|
payload[:public_key] = public_key unless public_key.nil?
|
|
294
298
|
payload[:create_key] = create_key unless create_key.nil?
|
|
295
299
|
|
|
296
|
-
new_client =
|
|
300
|
+
new_client = if Chef::Config[:migrate_key_to_keystore] == true
|
|
301
|
+
chef_rest_v1_with_validator.post("clients", payload)
|
|
302
|
+
else
|
|
303
|
+
chef_rest_v1.post("clients", payload)
|
|
304
|
+
end
|
|
297
305
|
|
|
298
306
|
# get the private_key out of the chef_key hash if it exists
|
|
299
307
|
if new_client["chef_key"]
|
|
@@ -24,6 +24,8 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
24
24
|
require_relative "../daemon"
|
|
25
25
|
require "chef-config/mixin/dot_d"
|
|
26
26
|
require "license_acceptance/cli_flags/mixlib_cli"
|
|
27
|
+
require "chef/monkey_patches/net-http"
|
|
28
|
+
|
|
27
29
|
module Mixlib
|
|
28
30
|
autoload :Archive, "mixlib/archive"
|
|
29
31
|
end
|
|
@@ -386,8 +388,10 @@ class Chef::Application::Base < Chef::Application
|
|
|
386
388
|
elsif uri.scheme == "s3"
|
|
387
389
|
require "aws-sdk-s3" unless defined?(Aws::S3)
|
|
388
390
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
+
bucket_name = uri.hostname
|
|
392
|
+
s3 = Aws::S3::Client.new(region: s3_bucket_location(bucket_name))
|
|
393
|
+
|
|
394
|
+
object = s3.get_object(bucket: bucket_name, key: uri.path[1..-1])
|
|
391
395
|
File.open(path, "wb") do |f|
|
|
392
396
|
f.write(object.body.read)
|
|
393
397
|
end
|
|
@@ -403,6 +407,20 @@ class Chef::Application::Base < Chef::Application
|
|
|
403
407
|
end
|
|
404
408
|
end
|
|
405
409
|
|
|
410
|
+
def s3_bucket_location(bucket_name)
|
|
411
|
+
s3 = Aws::S3::Client.new(region: aws_api_region)
|
|
412
|
+
|
|
413
|
+
resp = s3.get_bucket_location(bucket: bucket_name)
|
|
414
|
+
resp.location_constraint
|
|
415
|
+
rescue Aws::S3::Errors::AccessDenied => _e
|
|
416
|
+
Chef::Log.warn("Missing s3:GetBucketLocation privilege, trying currently configured region #{aws_api_region}")
|
|
417
|
+
aws_api_region
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def aws_api_region
|
|
421
|
+
ENV["AWS_REGION"] || Aws.shared_config.region || Aws::EC2Metadata.new.get("/latest/meta-data/placement/region")
|
|
422
|
+
end
|
|
423
|
+
|
|
406
424
|
def interval_run_chef_client
|
|
407
425
|
if Chef::Config[:daemonize]
|
|
408
426
|
Chef::Daemon.daemonize(ChefUtils::Dist::Infra::PRODUCT)
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
class Chef
|
|
20
20
|
class Application
|
|
21
21
|
|
|
22
|
-
# These are the exit codes defined in
|
|
23
|
-
# https://github.com/chef/chef
|
|
22
|
+
# These are the exit codes defined in the exit codes design document
|
|
23
|
+
# https://github.com/chef/chef/blob/main/docs/dev/design_documents/client_exit_codes.md
|
|
24
24
|
class ExitCode
|
|
25
25
|
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
26
26
|
|
|
@@ -140,7 +140,7 @@ class Chef
|
|
|
140
140
|
|
|
141
141
|
def non_standard_exit_code_warning(exit_code)
|
|
142
142
|
"#{ChefUtils::Dist::Infra::CLIENT} attempted to exit with a non-standard exit code of #{exit_code}." \
|
|
143
|
-
" The #{ChefUtils::Dist::Infra::PRODUCT} Exit Codes design document (https://github.com/chef/chef
|
|
143
|
+
" The #{ChefUtils::Dist::Infra::PRODUCT} Exit Codes design document (https://github.com/chef/chef/blob/main/docs/dev/design_documents/client_exit_codes.md)" \
|
|
144
144
|
" defines the exit codes that should be used with #{ChefUtils::Dist::Infra::CLIENT}. Chef::Application::ExitCode defines" \
|
|
145
145
|
" valid exit codes Non-standard exit codes are redefined as GENERIC_FAILURE."
|
|
146
146
|
end
|
|
@@ -238,7 +238,7 @@ class Chef
|
|
|
238
238
|
end
|
|
239
239
|
end
|
|
240
240
|
|
|
241
|
-
@regexp = Regexp.new("^#{full_regexp_parts.join(Chef::ChefFS::PathUtils
|
|
241
|
+
@regexp = Regexp.new("^#{full_regexp_parts.join(Chef::ChefFS::PathUtils::REGEXP_PATH_SEPARATOR)}$")
|
|
242
242
|
@normalized_pattern = Chef::ChefFS::PathUtils.join(*normalized_parts)
|
|
243
243
|
@normalized_pattern = Chef::ChefFS::PathUtils.join("", @normalized_pattern) if @is_absolute
|
|
244
244
|
end
|
|
@@ -140,17 +140,18 @@ class Chef
|
|
|
140
140
|
def self.copy_to(pattern, src_root, dest_root, recurse_depth, options, ui = nil, format_path = nil)
|
|
141
141
|
found_result = false
|
|
142
142
|
error = false
|
|
143
|
+
result = {}
|
|
143
144
|
list_pairs(pattern, src_root, dest_root).parallel_each do |src, dest|
|
|
144
145
|
found_result = true
|
|
145
146
|
new_dest_parent = get_or_create_parent(dest, options, ui, format_path)
|
|
146
|
-
child_error = copy_entries(src, dest, new_dest_parent, recurse_depth, options, ui, format_path)
|
|
147
|
+
child_error, result = copy_entries(src, dest, new_dest_parent, recurse_depth, options, ui, format_path)
|
|
147
148
|
error ||= child_error
|
|
148
149
|
end
|
|
149
150
|
if !found_result && pattern.exact_path
|
|
150
151
|
ui.error "#{pattern}: No such file or directory on remote or local" if ui
|
|
151
152
|
error = true
|
|
152
153
|
end
|
|
153
|
-
error
|
|
154
|
+
[error, result]
|
|
154
155
|
end
|
|
155
156
|
|
|
156
157
|
# Yield entries for children that are in either +a_root+ or +b_root+, with
|
|
@@ -275,6 +276,7 @@ class Chef
|
|
|
275
276
|
# case we shouldn't waste time trying PUT if we know the file doesn't
|
|
276
277
|
# exist.
|
|
277
278
|
# Will need to decide how that works with checksums, though.
|
|
279
|
+
result = { "total" => 0, "success_count" => 0, "failed" => [] }
|
|
278
280
|
error = false
|
|
279
281
|
begin
|
|
280
282
|
dest_path = format_path.call(dest_entry) if ui
|
|
@@ -290,6 +292,8 @@ class Chef
|
|
|
290
292
|
dest_entry.delete(true)
|
|
291
293
|
ui.output "Deleted extra entry #{dest_path} (purge is on)" if ui
|
|
292
294
|
rescue Chef::ChefFS::FileSystem::NotFoundError
|
|
295
|
+
failure = { "src_path" => src_path, "reason" => "Entry #{dest_path} does not exist" }
|
|
296
|
+
result["failed"].append(failure)
|
|
293
297
|
ui.output "Entry #{dest_path} does not exist. Nothing to do. (purge is on)" if ui
|
|
294
298
|
end
|
|
295
299
|
end
|
|
@@ -323,7 +327,7 @@ class Chef
|
|
|
323
327
|
if recurse_depth != 0
|
|
324
328
|
src_entry.children.parallel_each do |src_child|
|
|
325
329
|
new_dest_child = new_dest_dir.child(src_child.name)
|
|
326
|
-
child_error = copy_entries(src_child, new_dest_child, new_dest_dir, recurse_depth ? recurse_depth - 1 : recurse_depth, options, ui, format_path)
|
|
330
|
+
child_error, result = copy_entries(src_child, new_dest_child, new_dest_dir, recurse_depth ? recurse_depth - 1 : recurse_depth, options, ui, format_path)
|
|
327
331
|
error ||= child_error
|
|
328
332
|
end
|
|
329
333
|
end
|
|
@@ -339,14 +343,15 @@ class Chef
|
|
|
339
343
|
|
|
340
344
|
else
|
|
341
345
|
# Both exist.
|
|
342
|
-
|
|
343
346
|
# If the entry can do a copy directly, do that.
|
|
344
347
|
if dest_entry.respond_to?(:copy_from)
|
|
345
348
|
if options[:force] || compare(src_entry, dest_entry)[0] == false
|
|
346
349
|
if options[:dry_run]
|
|
347
350
|
ui.output "Would update #{dest_path}" if ui
|
|
348
351
|
else
|
|
352
|
+
result["total"] += 1
|
|
349
353
|
dest_entry.copy_from(src_entry, options)
|
|
354
|
+
result["success_count"] += 1
|
|
350
355
|
ui.output "Updated #{dest_path}" if ui
|
|
351
356
|
end
|
|
352
357
|
end
|
|
@@ -359,7 +364,7 @@ class Chef
|
|
|
359
364
|
# If both are directories, recurse into their children
|
|
360
365
|
if recurse_depth != 0
|
|
361
366
|
child_pairs(src_entry, dest_entry).parallel_each do |src_child, dest_child|
|
|
362
|
-
child_error = copy_entries(src_child, dest_child, dest_entry, recurse_depth ? recurse_depth - 1 : recurse_depth, options, ui, format_path)
|
|
367
|
+
child_error, result = copy_entries(src_child, dest_child, dest_entry, recurse_depth ? recurse_depth - 1 : recurse_depth, options, ui, format_path)
|
|
363
368
|
error ||= child_error
|
|
364
369
|
end
|
|
365
370
|
end
|
|
@@ -373,7 +378,6 @@ class Chef
|
|
|
373
378
|
ui.error("File #{src_path} is a regular file while file #{dest_path} is a directory\n") if ui
|
|
374
379
|
return
|
|
375
380
|
else
|
|
376
|
-
|
|
377
381
|
# Both are files! Copy them unless we're sure they are the same.'
|
|
378
382
|
if options[:diff] == false
|
|
379
383
|
should_copy = false
|
|
@@ -389,7 +393,9 @@ class Chef
|
|
|
389
393
|
ui.output "Would update #{dest_path}" if ui
|
|
390
394
|
else
|
|
391
395
|
src_value = src_entry.read if src_value.nil?
|
|
396
|
+
result["total"] += 1
|
|
392
397
|
dest_entry.write(src_value)
|
|
398
|
+
result["success_count"] += 1
|
|
393
399
|
ui.output "Updated #{dest_path}" if ui
|
|
394
400
|
end
|
|
395
401
|
end
|
|
@@ -397,17 +403,25 @@ class Chef
|
|
|
397
403
|
end
|
|
398
404
|
end
|
|
399
405
|
rescue RubyFileError => e
|
|
406
|
+
failure = { "src_path" => src_path, "reason" => e.reason }
|
|
407
|
+
result["failed"].append(failure)
|
|
400
408
|
ui.warn "#{format_path.call(e.entry)} #{e.reason}." if ui
|
|
401
409
|
rescue DefaultEnvironmentCannotBeModifiedError => e
|
|
410
|
+
failure = { "src_path" => src_path, "reason" => e.reason }
|
|
411
|
+
result["failed"].append(failure)
|
|
402
412
|
ui.warn "#{format_path.call(e.entry)} #{e.reason}." if ui
|
|
403
413
|
rescue OperationFailedError => e
|
|
414
|
+
failure = { "src_path" => src_path, "reason" => e.reason }
|
|
415
|
+
result["failed"].append(failure)
|
|
404
416
|
ui.error "#{format_path.call(e.entry)} failed to #{e.operation}: #{e.message}" if ui
|
|
405
417
|
error = true
|
|
406
418
|
rescue OperationNotAllowedError => e
|
|
419
|
+
failure = { "src_path" => src_path, "reason" => e.reason }
|
|
420
|
+
result["failed"].append(failure)
|
|
407
421
|
ui.error "#{format_path.call(e.entry)} #{e.reason}." if ui
|
|
408
422
|
error = true
|
|
409
423
|
end
|
|
410
|
-
error
|
|
424
|
+
[error, result]
|
|
411
425
|
end
|
|
412
426
|
|
|
413
427
|
def get_or_create_parent(entry, options, ui, format_path)
|
|
@@ -40,13 +40,15 @@ class Chef
|
|
|
40
40
|
# path to discover the Chef-FS root path) are handled in accordance to the rules
|
|
41
41
|
# of the local file-system and OS.
|
|
42
42
|
|
|
43
|
+
REGEXP_PATH_SEPARATOR = ChefUtils.windows? ? "[\\/\\\\]" : "/"
|
|
44
|
+
|
|
43
45
|
def self.join(*parts)
|
|
44
46
|
return "" if parts.length == 0
|
|
45
47
|
|
|
46
48
|
# Determine if it started with a slash
|
|
47
|
-
absolute = parts[0].length == 0 || parts[0].length > 0 && parts[0] =~ /^#{
|
|
49
|
+
absolute = parts[0].length == 0 || parts[0].length > 0 && parts[0] =~ /^#{REGEXP_PATH_SEPARATOR}/
|
|
48
50
|
# Remove leading and trailing slashes from each part so that the join will work (and the slash at the end will go away)
|
|
49
|
-
parts = parts.map { |part| part.gsub(/^#{
|
|
51
|
+
parts = parts.map { |part| part.gsub(/^#{REGEXP_PATH_SEPARATOR}+|#{REGEXP_PATH_SEPARATOR}+$/, "") }
|
|
50
52
|
# Don't join empty bits
|
|
51
53
|
result = parts.select { |part| part != "" }.join("/")
|
|
52
54
|
# Put the / back on
|
|
@@ -54,16 +56,12 @@ class Chef
|
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
def self.split(path)
|
|
57
|
-
path.split(Regexp.new(
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def self.regexp_path_separator
|
|
61
|
-
ChefUtils.windows? ? "[\\/\\\\]" : "/"
|
|
59
|
+
path.split(Regexp.new(REGEXP_PATH_SEPARATOR))
|
|
62
60
|
end
|
|
63
61
|
|
|
64
62
|
# Given a server path, determines if it is absolute.
|
|
65
63
|
def self.is_absolute?(path)
|
|
66
|
-
!!(path =~ /^#{
|
|
64
|
+
!!(path =~ /^#{REGEXP_PATH_SEPARATOR}/)
|
|
67
65
|
end
|
|
68
66
|
|
|
69
67
|
# Given a path which may only be partly real (i.e. /x/y/z when only /x exists,
|
|
@@ -118,7 +116,7 @@ class Chef
|
|
|
118
116
|
|
|
119
117
|
if ancestor.length == path.length
|
|
120
118
|
""
|
|
121
|
-
elsif /#{PathUtils
|
|
119
|
+
elsif /#{PathUtils::REGEXP_PATH_SEPARATOR}/.match?(path[ancestor.length, 1])
|
|
122
120
|
path[ancestor.length + 1..-1]
|
|
123
121
|
else
|
|
124
122
|
nil
|