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
data/lib/chef/resource/sysctl.rb
CHANGED
|
@@ -20,7 +20,6 @@ require_relative "../resource"
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class Sysctl < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
|
|
25
24
|
provides(:sysctl) { true }
|
|
26
25
|
provides(:sysctl_param) { true }
|
|
@@ -104,6 +103,7 @@ class Chef
|
|
|
104
103
|
property :comment, [Array, String],
|
|
105
104
|
description: "Comments, placed above the resource setting in the generated file. For multi-line comments, use an array of strings, one per line.",
|
|
106
105
|
default: [],
|
|
106
|
+
desired_state: false,
|
|
107
107
|
introduced: "15.8"
|
|
108
108
|
|
|
109
109
|
property :conf_dir, String,
|
|
@@ -188,7 +188,7 @@ class Chef
|
|
|
188
188
|
|
|
189
189
|
sysctl_lines << "#{new_resource.key} = #{new_resource.value}"
|
|
190
190
|
|
|
191
|
-
sysctl_lines.join("\n")
|
|
191
|
+
sysctl_lines.join("\n") + "\n"
|
|
192
192
|
end
|
|
193
193
|
end
|
|
194
194
|
|
|
@@ -34,7 +34,6 @@ class Chef
|
|
|
34
34
|
# chef-client. This resource includes actions and properties from the file resource. Template files managed by the
|
|
35
35
|
# template resource follow the same file specificity rules as the remote_file and file resources.
|
|
36
36
|
class Template < Chef::Resource::File
|
|
37
|
-
unified_mode true
|
|
38
37
|
|
|
39
38
|
provides :template
|
|
40
39
|
|
|
@@ -58,7 +58,6 @@ class Chef
|
|
|
58
58
|
# the 'password' property corresponds to a plaintext password and will
|
|
59
59
|
# attempt to use it in place of secure_token_password if it not set.
|
|
60
60
|
class MacUser < Chef::Resource::User
|
|
61
|
-
unified_mode true
|
|
62
61
|
|
|
63
62
|
provides :mac_user
|
|
64
63
|
provides :user, platform: "mac_os_x"
|
data/lib/chef/resource/user.rb
CHANGED
|
@@ -21,7 +21,6 @@ require_relative "../resource"
|
|
|
21
21
|
class Chef
|
|
22
22
|
class Resource
|
|
23
23
|
class User < Chef::Resource
|
|
24
|
-
unified_mode true
|
|
25
24
|
|
|
26
25
|
description "Use the **user** resource to add users, update existing users, remove users, and to lock/unlock user passwords."
|
|
27
26
|
|
|
@@ -73,6 +72,16 @@ class Chef
|
|
|
73
72
|
description: "The numeric group identifier."
|
|
74
73
|
|
|
75
74
|
alias_method :group, :gid
|
|
75
|
+
|
|
76
|
+
property :expire_date, [ String, NilClass ],
|
|
77
|
+
description: "(Linux) The date on which the user account will be disabled. The date is specified in YYYY-MM-DD format.",
|
|
78
|
+
introduced: "18.0",
|
|
79
|
+
desired_state: false
|
|
80
|
+
|
|
81
|
+
property :inactive, [ String, Integer, NilClass ],
|
|
82
|
+
description: "(Linux) The number of days after a password expires until the account is permanently disabled. A value of `0` disables the account as soon as the password has expired, and a value of `-1` disables the feature.",
|
|
83
|
+
introduced: "18.0",
|
|
84
|
+
desired_state: false
|
|
76
85
|
end
|
|
77
86
|
end
|
|
78
87
|
end
|
|
@@ -22,7 +22,6 @@ require_relative "../resource"
|
|
|
22
22
|
class Chef
|
|
23
23
|
class Resource
|
|
24
24
|
class UserUlimit < Chef::Resource
|
|
25
|
-
unified_mode true
|
|
26
25
|
|
|
27
26
|
provides :user_ulimit
|
|
28
27
|
|
|
@@ -57,19 +56,38 @@ class Chef
|
|
|
57
56
|
DOC
|
|
58
57
|
|
|
59
58
|
property :username, String, name_property: true
|
|
59
|
+
property :as_limit, [String, Integer]
|
|
60
|
+
property :as_soft_limit, [String, Integer]
|
|
61
|
+
property :as_hard_limit, [String, Integer]
|
|
60
62
|
property :filehandle_limit, [String, Integer]
|
|
61
63
|
property :filehandle_soft_limit, [String, Integer]
|
|
62
64
|
property :filehandle_hard_limit, [String, Integer]
|
|
63
65
|
property :process_limit, [String, Integer]
|
|
64
66
|
property :process_soft_limit, [String, Integer]
|
|
65
67
|
property :process_hard_limit, [String, Integer]
|
|
68
|
+
property :locks_limit, [String, Integer]
|
|
66
69
|
property :memory_limit, [String, Integer]
|
|
70
|
+
property :maxlogins_limit, [String, Integer]
|
|
71
|
+
property :maxlogins_soft_limit, [String, Integer]
|
|
72
|
+
property :maxlogins_hard_limit, [String, Integer]
|
|
73
|
+
property :msgqueue_limit, [String, Integer]
|
|
74
|
+
property :msgqueue_soft_limit, [String, Integer]
|
|
75
|
+
property :msgqueue_hard_limit, [String, Integer]
|
|
67
76
|
property :core_limit, [String, Integer]
|
|
68
77
|
property :core_soft_limit, [String, Integer]
|
|
69
78
|
property :core_hard_limit, [String, Integer]
|
|
79
|
+
property :cpu_limit, [String, Integer]
|
|
80
|
+
property :cpu_soft_limit, [String, Integer]
|
|
81
|
+
property :cpu_hard_limit, [String, Integer]
|
|
82
|
+
property :sigpending_limit, [String, Integer]
|
|
83
|
+
property :sigpending_soft_limit, [String, Integer]
|
|
84
|
+
property :sigpending_hard_limit, [String, Integer]
|
|
70
85
|
property :stack_limit, [String, Integer]
|
|
71
86
|
property :stack_soft_limit, [String, Integer]
|
|
72
87
|
property :stack_hard_limit, [String, Integer]
|
|
88
|
+
property :rss_limit, [String, Integer]
|
|
89
|
+
property :rss_soft_limit, [String, Integer]
|
|
90
|
+
property :rss_hard_limit, [String, Integer]
|
|
73
91
|
property :rtprio_limit, [String, Integer]
|
|
74
92
|
property :rtprio_soft_limit, [String, Integer]
|
|
75
93
|
property :rtprio_hard_limit, [String, Integer]
|
|
@@ -86,19 +104,38 @@ class Chef
|
|
|
86
104
|
sensitive new_resource.sensitive
|
|
87
105
|
variables(
|
|
88
106
|
ulimit_user: new_resource.username,
|
|
107
|
+
as_limit: new_resource.as_limit,
|
|
108
|
+
as_soft_limit: new_resource.as_soft_limit,
|
|
109
|
+
as_hard_limit: new_resource.as_hard_limit,
|
|
89
110
|
filehandle_limit: new_resource.filehandle_limit,
|
|
90
111
|
filehandle_soft_limit: new_resource.filehandle_soft_limit,
|
|
91
112
|
filehandle_hard_limit: new_resource.filehandle_hard_limit,
|
|
92
113
|
process_limit: new_resource.process_limit,
|
|
93
114
|
process_soft_limit: new_resource.process_soft_limit,
|
|
94
115
|
process_hard_limit: new_resource.process_hard_limit,
|
|
116
|
+
locks_limit: new_resource.locks_limit,
|
|
95
117
|
memory_limit: new_resource.memory_limit,
|
|
118
|
+
maxlogins_limit: new_resource.maxlogins_limit,
|
|
119
|
+
maxlogins_soft_limit: new_resource.maxlogins_soft_limit,
|
|
120
|
+
maxlogins_hard_limit: new_resource.maxlogins_hard_limit,
|
|
121
|
+
msgqueue_limit: new_resource.msgqueue_limit,
|
|
122
|
+
msgqueue_soft_limit: new_resource.msgqueue_soft_limit,
|
|
123
|
+
msgqueue_hard_limit: new_resource.msgqueue_hard_limit,
|
|
96
124
|
core_limit: new_resource.core_limit,
|
|
97
125
|
core_soft_limit: new_resource.core_soft_limit,
|
|
98
126
|
core_hard_limit: new_resource.core_hard_limit,
|
|
127
|
+
cpu_limit: new_resource.cpu_limit,
|
|
128
|
+
cpu_soft_limit: new_resource.cpu_soft_limit,
|
|
129
|
+
cpu_hard_limit: new_resource.cpu_hard_limit,
|
|
130
|
+
sigpending_limit: new_resource.sigpending_limit,
|
|
131
|
+
sigpending_soft_limit: new_resource.sigpending_soft_limit,
|
|
132
|
+
sigpending_hard_limit: new_resource.sigpending_hard_limit,
|
|
99
133
|
stack_limit: new_resource.stack_limit,
|
|
100
134
|
stack_soft_limit: new_resource.stack_soft_limit,
|
|
101
135
|
stack_hard_limit: new_resource.stack_hard_limit,
|
|
136
|
+
rss_limit: new_resource.rss_limit,
|
|
137
|
+
rss_soft_limit: new_resource.rss_soft_limit,
|
|
138
|
+
rss_hard_limit: new_resource.rss_hard_limit,
|
|
102
139
|
rtprio_limit: new_resource.rtprio_limit,
|
|
103
140
|
rtprio_soft_limit: new_resource.rtprio_soft_limit,
|
|
104
141
|
rtprio_hard_limit: new_resource.rtprio_hard_limit,
|
|
@@ -440,7 +440,7 @@ class Chef
|
|
|
440
440
|
def export_cert(cert_obj, output_path:, store_name:, store_location:, pfx_password:)
|
|
441
441
|
# Delete the cert if it exists on disk already.
|
|
442
442
|
# We want to ensure we're not randomly loading an old stinky cert.
|
|
443
|
-
if ::File.
|
|
443
|
+
if ::File.exist?(output_path)
|
|
444
444
|
::File.delete(output_path)
|
|
445
445
|
end
|
|
446
446
|
|
|
@@ -19,7 +19,6 @@ require_relative "../resource"
|
|
|
19
19
|
class Chef
|
|
20
20
|
class Resource
|
|
21
21
|
class WindowsDefender < Chef::Resource
|
|
22
|
-
unified_mode true
|
|
23
22
|
provides :windows_defender
|
|
24
23
|
|
|
25
24
|
description "Use the **windows_defender** resource to enable or disable the Microsoft Windows Defender service."
|
|
@@ -21,7 +21,6 @@ class Chef
|
|
|
21
21
|
class Resource
|
|
22
22
|
class WindowsFont < Chef::Resource
|
|
23
23
|
require_relative "../util/path_helper"
|
|
24
|
-
unified_mode true
|
|
25
24
|
|
|
26
25
|
provides(:windows_font) { true }
|
|
27
26
|
|
|
@@ -83,7 +82,7 @@ class Chef
|
|
|
83
82
|
|
|
84
83
|
# install the font into the appropriate fonts directory
|
|
85
84
|
def install_font
|
|
86
|
-
require "win32ole" if RUBY_PLATFORM.match?(/mswin|
|
|
85
|
+
require "win32ole" if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
|
87
86
|
fonts_dir = Chef::Util::PathHelper.join(ENV["windir"], "fonts")
|
|
88
87
|
folder = WIN32OLE.new("Shell.Application").Namespace(fonts_dir)
|
|
89
88
|
converge_by("install font #{new_resource.font_name} to #{fonts_dir}") do
|
|
@@ -95,7 +94,7 @@ class Chef
|
|
|
95
94
|
#
|
|
96
95
|
# @return [Boolean] Is the font is installed?
|
|
97
96
|
def font_exists?
|
|
98
|
-
require "win32ole" if RUBY_PLATFORM.match?(/mswin|
|
|
97
|
+
require "win32ole" if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
|
99
98
|
fonts_dir = WIN32OLE.new("WScript.Shell").SpecialFolders("Fonts")
|
|
100
99
|
fonts_dir_local = Chef::Util::PathHelper.join(ENV["home"], "AppData/Local/Microsoft/Windows/fonts")
|
|
101
100
|
logger.trace("Seeing if the font at #{Chef::Util::PathHelper.join(fonts_dir, new_resource.font_name)} exists")
|
|
@@ -26,7 +26,6 @@ class Chef
|
|
|
26
26
|
class Resource
|
|
27
27
|
class WindowsPackage < Chef::Resource::Package
|
|
28
28
|
include Chef::Mixin::Uris
|
|
29
|
-
unified_mode true
|
|
30
29
|
|
|
31
30
|
provides(:windows_package) { true }
|
|
32
31
|
provides :package, os: "windows"
|
|
@@ -79,7 +78,7 @@ class Chef
|
|
|
79
78
|
```ruby
|
|
80
79
|
windows_package '7zip' do
|
|
81
80
|
source 'http://www.7-zip.org/a/7z938-x64.msi'
|
|
82
|
-
checksum '
|
|
81
|
+
checksum '7c8e873991c82ad9cfcdbdf45254ea6101e9a645e12977dcd518979e50fdedf3'
|
|
83
82
|
end
|
|
84
83
|
```
|
|
85
84
|
|
|
@@ -92,7 +91,7 @@ class Chef
|
|
|
92
91
|
source 'http://www.7-zip.org/a/7z938-x64.msi'
|
|
93
92
|
remote_file_attributes ({
|
|
94
93
|
:path => 'C:\\7zip.msi',
|
|
95
|
-
:checksum => '
|
|
94
|
+
:checksum => '7c8e873991c82ad9cfcdbdf45254ea6101e9a645e12977dcd518979e50fdedf3'
|
|
96
95
|
})
|
|
97
96
|
end
|
|
98
97
|
```
|
|
@@ -101,7 +100,7 @@ class Chef
|
|
|
101
100
|
|
|
102
101
|
```ruby
|
|
103
102
|
windows_package 'Mercurial 3.6.1 (64-bit)' do
|
|
104
|
-
source '
|
|
103
|
+
source 'https://www.mercurial-scm.org/release/windows/Mercurial-3.6.1-x64.exe'
|
|
105
104
|
checksum 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d'
|
|
106
105
|
end
|
|
107
106
|
```
|
|
@@ -20,7 +20,6 @@ require_relative "../resource"
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class WindowsPagefile < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
|
|
25
24
|
provides(:windows_pagefile) { true }
|
|
26
25
|
|
|
@@ -166,7 +165,6 @@ class Chef
|
|
|
166
165
|
# @return [Boolean]
|
|
167
166
|
def max_and_min_set?(pagefile, min, max)
|
|
168
167
|
logger.trace("Checking if #{pagefile} has max and initial disk size values set")
|
|
169
|
-
|
|
170
168
|
powershell_code = <<-CODE
|
|
171
169
|
$page_file = '#{pagefile}';
|
|
172
170
|
$driveLetter = $page_file.split(':')[0];
|
|
@@ -27,7 +27,6 @@ class Chef
|
|
|
27
27
|
# 2. Fail with a warning if the port can't be found and create_port is false
|
|
28
28
|
# 3. Fail with helpful messaging if the printer driver can't be installed
|
|
29
29
|
class WindowsPrinter < Chef::Resource
|
|
30
|
-
unified_mode true
|
|
31
30
|
|
|
32
31
|
autoload :Resolv, "resolv"
|
|
33
32
|
|
|
@@ -24,8 +24,6 @@ class Chef
|
|
|
24
24
|
class WindowsScript < Chef::Resource::Script
|
|
25
25
|
include Chef::Mixin::WindowsArchitectureHelper
|
|
26
26
|
|
|
27
|
-
unified_mode true
|
|
28
|
-
|
|
29
27
|
# This is an abstract resource meant to be subclasses; thus no 'provides'
|
|
30
28
|
|
|
31
29
|
set_guard_inherited_attributes(:architecture)
|
|
@@ -22,7 +22,6 @@ require "tempfile" unless defined?(Tempfile)
|
|
|
22
22
|
class Chef
|
|
23
23
|
class Resource
|
|
24
24
|
class WindowsSecurityPolicy < Chef::Resource
|
|
25
|
-
unified_mode true
|
|
26
25
|
|
|
27
26
|
provides :windows_security_policy
|
|
28
27
|
|
|
@@ -119,13 +118,13 @@ class Chef
|
|
|
119
118
|
file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
|
|
120
119
|
file.close
|
|
121
120
|
file_path = file.path.tr("/", "\\")
|
|
122
|
-
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
|
|
121
|
+
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
|
|
123
122
|
else
|
|
124
123
|
policy_line = "#{security_option} = #{security_value}"
|
|
125
124
|
file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
|
|
126
125
|
file.close
|
|
127
126
|
file_path = file.path.tr("/", "\\")
|
|
128
|
-
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
|
|
127
|
+
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
|
|
129
128
|
end
|
|
130
129
|
shell_out!(cmd)
|
|
131
130
|
file.unlink
|
|
@@ -21,7 +21,6 @@ require_relative "../resource"
|
|
|
21
21
|
class Chef
|
|
22
22
|
class Resource
|
|
23
23
|
class WindowsShortcut < Chef::Resource
|
|
24
|
-
unified_mode true
|
|
25
24
|
|
|
26
25
|
provides(:windows_shortcut) { true }
|
|
27
26
|
|
|
@@ -58,7 +57,7 @@ class Chef
|
|
|
58
57
|
description: "Icon to use for the shortcut. Accepts the format of `path, index`, where index is the icon file to use. See Microsoft's [documentation](https://msdn.microsoft.com/en-us/library/3s9bx7at.aspx) for details"
|
|
59
58
|
|
|
60
59
|
load_current_value do |new_resource|
|
|
61
|
-
require "win32ole" if RUBY_PLATFORM.match?(/mswin|
|
|
60
|
+
require "win32ole" if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
|
62
61
|
|
|
63
62
|
link = WIN32OLE.new("WScript.Shell").CreateShortcut(new_resource.shortcut_name)
|
|
64
63
|
name new_resource.shortcut_name
|