chef 17.10.114 → 18.0.169
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +19 -12
- data/README.md +7 -7
- data/Rakefile +3 -22
- data/{chef-universal-mingw32.gemspec → chef-universal-mingw-ucrt.gemspec} +8 -7
- data/chef.gemspec +15 -8
- data/lib/chef/api_client_v1.rb +9 -1
- data/lib/chef/application/exit_code.rb +3 -3
- data/lib/chef/client.rb +171 -20
- 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/waiver.rb +1 -1
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- 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/exceptions.rb +8 -0
- data/lib/chef/http/authenticator.rb +170 -3
- data/lib/chef/http/ssl_policies.rb +3 -3
- data/lib/chef/mixin/checksum.rb +0 -6
- data/lib/chef/mixin/homebrew_user.rb +5 -15
- data/lib/chef/mixin/powershell_exec.rb +5 -28
- data/lib/chef/node/mixin/immutablize_array.rb +1 -0
- data/lib/chef/property.rb +5 -3
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/http_request.rb +11 -9
- data/lib/chef/provider/mount/linux.rb +5 -0
- data/lib/chef/provider/mount/mount.rb +8 -0
- data/lib/chef/provider/mount/windows.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +1 -18
- data/lib/chef/provider/package/rubygems.rb +1 -1
- 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/zypper/version.rb +60 -0
- data/lib/chef/provider/package/zypper.rb +47 -8
- data/lib/chef/provider/service/windows.rb +1 -2
- 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.rb +46 -14
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/recipe.rb +1 -1
- data/lib/chef/resource/_rest_resource.rb +389 -0
- data/lib/chef/resource/alternatives.rb +0 -1
- data/lib/chef/resource/apt_package.rb +0 -1
- data/lib/chef/resource/apt_preference.rb +0 -1
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/apt_update.rb +0 -1
- data/lib/chef/resource/archive_file.rb +0 -1
- data/lib/chef/resource/bash.rb +0 -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 +1 -2
- data/lib/chef/resource/chef_client_trusted_certificate.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +0 -1
- 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_package.rb +0 -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 +0 -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 +0 -1
- data/lib/chef/resource/execute.rb +0 -1
- data/lib/chef/resource/file.rb +0 -1
- data/lib/chef/resource/freebsd_package.rb +0 -1
- data/lib/chef/resource/gem_package.rb +0 -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 +0 -1
- 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 +8 -8
- data/lib/chef/resource/homebrew_package.rb +1 -2
- data/lib/chef/resource/homebrew_tap.rb +5 -6
- data/lib/chef/resource/homebrew_update.rb +0 -2
- 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 +0 -1
- data/lib/chef/resource/link.rb +0 -1
- data/lib/chef/resource/locale.rb +2 -6
- data/lib/chef/resource/log.rb +0 -1
- data/lib/chef/resource/lwrp_base.rb +0 -4
- data/lib/chef/resource/macos_userdefaults.rb +5 -10
- data/lib/chef/resource/macosx_service.rb +0 -1
- data/lib/chef/resource/macports_package.rb +0 -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 +0 -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 +0 -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 +0 -1
- data/lib/chef/resource/powershell_package.rb +0 -1
- data/lib/chef/resource/powershell_package_source.rb +0 -1
- data/lib/chef/resource/powershell_script.rb +0 -1
- data/lib/chef/resource/python.rb +0 -1
- data/lib/chef/resource/reboot.rb +0 -1
- data/lib/chef/resource/registry_key.rb +0 -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 +0 -3
- 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 +0 -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_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/service.rb +0 -1
- data/lib/chef/resource/smartos_package.rb +0 -1
- data/lib/chef/resource/snap_package.rb +0 -1
- data/lib/chef/resource/solaris_package.rb +0 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +0 -1
- data/lib/chef/resource/sudo.rb +0 -1
- data/lib/chef/resource/support/client.erb +2 -2
- data/lib/chef/resource/swap_file.rb +0 -1
- data/lib/chef/resource/sysctl.rb +1 -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 +0 -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_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 +0 -1
- 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 +0 -1
- 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 +0 -1
- data/lib/chef/resource/windows_workgroup.rb +0 -1
- data/lib/chef/resource/yum_package.rb +0 -1
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource/zypper_package.rb +0 -1
- data/lib/chef/resource/zypper_repository.rb +0 -1
- data/lib/chef/resource.rb +12 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/secret_fetcher/azure_key_vault.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/handle.rb +6 -7
- data/lib/chef/win32/registry.rb +7 -3
- data/spec/data/rubygems.org/sexp_processor-info +2 -1
- data/spec/data/trusted_certs/example.crt +20 -29
- data/spec/data/trusted_certs/example_no_cn.crt +34 -30
- data/spec/data/trusted_certs/opscode.pem +54 -33
- data/spec/functional/resource/chocolatey_package_spec.rb +20 -32
- data/spec/functional/resource/dsc_script_spec.rb +1 -1
- data/spec/functional/resource/group_spec.rb +10 -6
- data/spec/functional/resource/link_spec.rb +8 -8
- data/spec/functional/resource/macos_userdefaults_spec.rb +4 -4
- data/spec/functional/resource/plist_spec.rb +25 -0
- data/spec/functional/resource/user/linux_user_spec.rb +127 -0
- data/spec/functional/resource/windows_certificate_spec.rb +1 -26
- 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 -10
- data/spec/functional/shell_spec.rb +1 -2
- data/spec/functional/version_spec.rb +1 -1
- data/spec/integration/client/client_spec.rb +82 -3
- data/spec/integration/client/exit_code_spec.rb +1 -1
- data/spec/integration/client/ipv6_spec.rb +1 -1
- 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 +1 -0
- data/spec/support/platform_helpers.rb +4 -0
- data/spec/support/ruby_installer.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +2 -2
- data/spec/unit/application/client_spec.rb +0 -10
- data/spec/unit/client_spec.rb +57 -8
- data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +1 -1
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/http/authenticator_spec.rb +68 -0
- data/spec/unit/mixin/checksum_spec.rb +0 -28
- data/spec/unit/mixin/homebrew_user_spec.rb +7 -30
- data/spec/unit/mixin/powershell_exec_spec.rb +5 -5
- data/spec/unit/platform/query_helpers_spec.rb +2 -17
- data/spec/unit/provider/http_request_spec.rb +60 -72
- data/spec/unit/provider/mount/linux_spec.rb +10 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +3 -19
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/package/zypper_spec.rb +32 -0
- data/spec/unit/provider/user/linux_spec.rb +51 -11
- data/spec/unit/provider/user_spec.rb +24 -6
- 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 +2 -2
- data/spec/unit/resource/cron_d_spec.rb +37 -1
- data/spec/unit/resource/macos_user_defaults_spec.rb +4 -4
- 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_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/sysctl_spec.rb +2 -2
- data/spec/unit/resource/user/linux_user_spec.rb +42 -0
- data/spec/unit/resource_spec.rb +0 -1
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +1 -1
- data/tasks/rspec.rb +1 -1
- metadata +103 -37
- /data/spec/functional/assets/chocolatey_feed/{test-A.1.0.0.nupkg → test-A.1.0.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-A.1.5.0.nupkg → test-A.1.5.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-A.2.0.0.nupkg → test-A.2.0.nupkg} +0 -0
- /data/spec/functional/assets/chocolatey_feed/{test-B.1.0.0.nupkg → test-B.1.0.nupkg} +0 -0
- /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
@@ -16,7 +16,6 @@ require_relative "../resource"
|
|
16
16
|
class Chef
|
17
17
|
class Resource
|
18
18
|
class HabitatUserToml < Chef::Resource
|
19
|
-
unified_mode true
|
20
19
|
provides :habitat_user_toml
|
21
20
|
|
22
21
|
description "Use the **habitat_user_toml** to template a `user.toml` for Chef Habitat services. Configurations set in the `user.toml` override the `default.toml` for a given package, which makes it an alternative to applying service group level configuration."
|
@@ -23,7 +23,6 @@ require_relative "../mixin/homebrew_user"
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class HomebrewCask < Chef::Resource
|
26
|
-
unified_mode true
|
27
26
|
|
28
27
|
provides(:homebrew_cask) { true }
|
29
28
|
|
@@ -46,24 +45,25 @@ class Chef
|
|
46
45
|
default: true
|
47
46
|
|
48
47
|
property :homebrew_path, String,
|
49
|
-
description: "The path to the homebrew binary."
|
48
|
+
description: "The path to the homebrew binary.",
|
49
|
+
default: "/usr/local/bin/brew"
|
50
50
|
|
51
51
|
property :owner, [String, Integer],
|
52
52
|
description: "The owner of the Homebrew installation.",
|
53
53
|
default: lazy { find_homebrew_username },
|
54
|
-
default_description: "Calculated default username"
|
54
|
+
default_description: "Calculated default username"\
|
55
55
|
|
56
56
|
action :install, description: "Install an application that is packaged as a Homebrew cask." do
|
57
57
|
if new_resource.install_cask
|
58
58
|
homebrew_tap "homebrew/cask" do
|
59
|
-
homebrew_path
|
59
|
+
homebrew_path new_resource.homebrew_path
|
60
60
|
owner new_resource.owner
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
unless casked?
|
65
65
|
converge_by("install cask #{new_resource.cask_name} #{new_resource.options}") do
|
66
|
-
shell_out!("#{
|
66
|
+
shell_out!("#{new_resource.homebrew_path} install --cask #{new_resource.cask_name} #{new_resource.options}",
|
67
67
|
user: new_resource.owner,
|
68
68
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
69
69
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -74,14 +74,14 @@ class Chef
|
|
74
74
|
action :remove, description: "Remove an application that is packaged as a Homebrew cask." do
|
75
75
|
if new_resource.install_cask
|
76
76
|
homebrew_tap "homebrew/cask" do
|
77
|
-
homebrew_path
|
77
|
+
homebrew_path new_resource.homebrew_path
|
78
78
|
owner new_resource.owner
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
if casked?
|
83
83
|
converge_by("uninstall cask #{new_resource.cask_name}") do
|
84
|
-
shell_out!("#{
|
84
|
+
shell_out!("#{new_resource.homebrew_path} uninstall --cask #{new_resource.cask_name}",
|
85
85
|
user: new_resource.owner,
|
86
86
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
87
87
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -99,7 +99,7 @@ class Chef
|
|
99
99
|
# @return [Boolean]
|
100
100
|
def casked?
|
101
101
|
unscoped_name = new_resource.cask_name.split("/").last
|
102
|
-
shell_out!("#{
|
102
|
+
shell_out!("#{new_resource.homebrew_path} list --cask 2>/dev/null",
|
103
103
|
user: new_resource.owner,
|
104
104
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
105
105
|
cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name)
|
@@ -24,7 +24,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
26
26
|
class HomebrewPackage < Chef::Resource::Package
|
27
|
-
unified_mode true
|
28
27
|
|
29
28
|
provides :homebrew_package
|
30
29
|
provides :package, os: "darwin"
|
@@ -62,7 +61,7 @@ class Chef
|
|
62
61
|
DOC
|
63
62
|
|
64
63
|
property :homebrew_user, [ String, Integer ],
|
65
|
-
description: "The name or uid of the Homebrew owner to be used by #{ChefUtils::Dist::Infra::PRODUCT} when executing a command.\n\n#{ChefUtils::Dist::Infra::PRODUCT}, by default, will attempt to execute a Homebrew command as the owner of the `/usr/local/bin/brew` executable
|
64
|
+
description: "The name or uid of the Homebrew owner to be used by #{ChefUtils::Dist::Infra::PRODUCT} when executing a command.\n\n#{ChefUtils::Dist::Infra::PRODUCT}, by default, will attempt to execute a Homebrew command as the owner of the `/usr/local/bin/brew` executable. If that executable does not exist, #{ChefUtils::Dist::Infra::PRODUCT} will attempt to find the user by executing `which brew`. If that executable cannot be found, #{ChefUtils::Dist::Infra::PRODUCT} will print an error message: `Could not find the 'brew' executable in /usr/local/bin or anywhere on the path.`.\n\nSet this property to specify the Homebrew owner for situations where Chef Infra Client cannot automatically detect the correct owner.'"
|
66
65
|
|
67
66
|
end
|
68
67
|
end
|
@@ -23,7 +23,6 @@ require_relative "../mixin/homebrew_user"
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class HomebrewTap < Chef::Resource
|
26
|
-
unified_mode true
|
27
26
|
|
28
27
|
provides(:homebrew_tap) { true }
|
29
28
|
|
@@ -42,7 +41,8 @@ class Chef
|
|
42
41
|
description: "The URL of the tap."
|
43
42
|
|
44
43
|
property :homebrew_path, String,
|
45
|
-
description: "The path to the Homebrew binary."
|
44
|
+
description: "The path to the Homebrew binary.",
|
45
|
+
default: "/usr/local/bin/brew"
|
46
46
|
|
47
47
|
property :owner, String,
|
48
48
|
description: "The owner of the Homebrew installation.",
|
@@ -52,7 +52,7 @@ class Chef
|
|
52
52
|
action :tap, description: "Add a Homebrew tap." do
|
53
53
|
unless tapped?(new_resource.tap_name)
|
54
54
|
converge_by("tap #{new_resource.tap_name}") do
|
55
|
-
shell_out!("#{
|
55
|
+
shell_out!("#{new_resource.homebrew_path} tap #{new_resource.tap_name} #{new_resource.url || ""}",
|
56
56
|
user: new_resource.owner,
|
57
57
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
58
58
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -63,7 +63,7 @@ class Chef
|
|
63
63
|
action :untap, description: "Remove a Homebrew tap." do
|
64
64
|
if tapped?(new_resource.tap_name)
|
65
65
|
converge_by("untap #{new_resource.tap_name}") do
|
66
|
-
shell_out!("#{
|
66
|
+
shell_out!("#{new_resource.homebrew_path} untap #{new_resource.tap_name}",
|
67
67
|
user: new_resource.owner,
|
68
68
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
69
69
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -75,9 +75,8 @@ class Chef
|
|
75
75
|
#
|
76
76
|
# @return [Boolean]
|
77
77
|
def tapped?(name)
|
78
|
-
base_path = ["#{::File.dirname(which("brew"))}/../homebrew", "#{::File.dirname(which("brew"))}/../Homebrew", "/opt/homebrew", "/usr/local/Homebrew", "/home/linuxbrew/.linuxbrew"].uniq.select { |x| Dir.exist?(x) }.first
|
79
78
|
tap_dir = name.gsub("/", "/homebrew-")
|
80
|
-
::File.directory?("
|
79
|
+
::File.directory?("/usr/local/Homebrew/Library/Taps/#{tap_dir}")
|
81
80
|
end
|
82
81
|
end
|
83
82
|
end
|
@@ -24,7 +24,6 @@ class Chef
|
|
24
24
|
class Resource
|
25
25
|
class InspecWaiverFileEntry < Chef::Resource
|
26
26
|
provides :inspec_waiver_file_entry
|
27
|
-
unified_mode true
|
28
27
|
|
29
28
|
description "Use the **inspec_waiver_file_entry** resource to add or remove entries from an InSpec waiver file. This can be used in conjunction with the Compliance Phase."
|
30
29
|
introduced "17.1"
|
@@ -137,11 +136,11 @@ class Chef
|
|
137
136
|
def load_waiver_file_to_hash(file_name)
|
138
137
|
if %r{(/|C:\\).*(.yaml|.yml)}i.match?(file_name)
|
139
138
|
if ::File.exist?(file_name)
|
140
|
-
hash = ::YAML.
|
139
|
+
hash = ::YAML.safe_load_file(file_name, permitted_classes: [Date])
|
141
140
|
if hash == false || hash.nil? || hash == ""
|
142
141
|
{}
|
143
142
|
else
|
144
|
-
::YAML.
|
143
|
+
::YAML.safe_load_file(file_name, permitted_classes: [Date])
|
145
144
|
end
|
146
145
|
else
|
147
146
|
{}
|
data/lib/chef/resource/ksh.rb
CHANGED
@@ -21,7 +21,6 @@ require_relative "../resource"
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class Launchd < Chef::Resource
|
24
|
-
unified_mode true
|
25
24
|
provides :launchd
|
26
25
|
|
27
26
|
description "Use the **launchd** resource to manage system-wide services (daemons) and per-user services (agents) on the macOS platform."
|
data/lib/chef/resource/link.rb
CHANGED
data/lib/chef/resource/locale.rb
CHANGED
@@ -21,7 +21,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class Locale < Chef::Resource
|
24
|
-
unified_mode true
|
25
24
|
provides :locale
|
26
25
|
|
27
26
|
description "Use the **locale** resource to set the system's locale on Debian and Windows systems. Windows support was added in Chef Infra Client 16.0"
|
@@ -113,11 +112,8 @@ class Chef
|
|
113
112
|
end
|
114
113
|
|
115
114
|
requirements.assert(:all_actions) do |a|
|
116
|
-
|
117
|
-
|
118
|
-
# Windows has locale-gen as part of the install, but not in the path
|
119
|
-
which("locale-gen") || windows?
|
120
|
-
end
|
115
|
+
# RHEL/CentOS type platforms don't have locale-gen
|
116
|
+
a.assertion { which("locale-gen") }
|
121
117
|
a.failure_message(Chef::Exceptions::ProviderNotFound, "The locale resource requires the locale-gen tool")
|
122
118
|
end
|
123
119
|
end
|
data/lib/chef/resource/log.rb
CHANGED
@@ -54,10 +54,6 @@ class Chef
|
|
54
54
|
resource_class.run_context = run_context
|
55
55
|
resource_class.class_from_file(filename)
|
56
56
|
|
57
|
-
if !resource_class.unified_mode && !deprecated_class(resource_class) && cookbook_name.to_s != "chef_client_updater"
|
58
|
-
Chef.deprecated :unified_mode, "The #{resource_class.resource_name} resource in the #{cookbook_name} cookbook should declare `unified_mode true`", filename
|
59
|
-
end
|
60
|
-
|
61
57
|
# Make a useful string for the class (rather than <Class:312894723894>)
|
62
58
|
resource_class.instance_eval do
|
63
59
|
define_singleton_method(:to_s) do
|
@@ -23,7 +23,6 @@ autoload :Plist, "plist"
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class MacosUserDefaults < Chef::Resource
|
26
|
-
unified_mode true
|
27
26
|
|
28
27
|
# align with apple's marketing department
|
29
28
|
provides(:macos_userdefaults) { true }
|
@@ -51,17 +50,15 @@ class Chef
|
|
51
50
|
end
|
52
51
|
```
|
53
52
|
|
54
|
-
**
|
53
|
+
**Specifying the type of a key to skip automatic type detection**
|
55
54
|
|
56
55
|
```ruby
|
57
|
-
macos_userdefaults '
|
58
|
-
key '
|
59
|
-
value
|
60
|
-
|
61
|
-
host :current
|
56
|
+
macos_userdefaults 'Finder expanded save dialogs' do
|
57
|
+
key 'NSNavPanelExpandedStateForSaveMode'
|
58
|
+
value 'TRUE'
|
59
|
+
type 'bool'
|
62
60
|
end
|
63
61
|
```
|
64
|
-
|
65
62
|
DOC
|
66
63
|
|
67
64
|
property :domain, String,
|
@@ -82,7 +79,6 @@ class Chef
|
|
82
79
|
|
83
80
|
property :host, [String, Symbol],
|
84
81
|
description: "Set either :current, :all or a hostname to set the user default at the host level.",
|
85
|
-
default: :all,
|
86
82
|
desired_state: false,
|
87
83
|
introduced: "16.3"
|
88
84
|
|
@@ -98,7 +94,6 @@ class Chef
|
|
98
94
|
|
99
95
|
property :user, [String, Symbol],
|
100
96
|
description: "The system user that the default will be applied to. Set :current for current user, :all for all users or pass a valid username",
|
101
|
-
default: :current,
|
102
97
|
desired_state: false
|
103
98
|
|
104
99
|
property :sudo, [TrueClass, FalseClass],
|
@@ -21,7 +21,6 @@ require_relative "package"
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class MacportsPackage < Chef::Resource::Package
|
24
|
-
unified_mode true
|
25
24
|
provides :macports_package
|
26
25
|
|
27
26
|
description "Use the **macports_package** resource to manage packages for the macOS platform using the MacPorts package management system."
|
data/lib/chef/resource/mdadm.rb
CHANGED
data/lib/chef/resource/mount.rb
CHANGED
@@ -21,8 +21,6 @@ class Chef
|
|
21
21
|
class NotifyGroup < Chef::Resource
|
22
22
|
provides :notify_group
|
23
23
|
|
24
|
-
unified_mode true
|
25
|
-
|
26
24
|
description "The notify_group resource does nothing, and always fires notifications which are set on it. Use it to DRY blocks of notifications that are common to multiple resources, and provide a single target for other resources to notify. Unlike most resources, its default action is :nothing."
|
27
25
|
introduced "15.8"
|
28
26
|
examples <<~DOC
|
data/lib/chef/resource/ohai.rb
CHANGED
@@ -23,8 +23,6 @@ class Chef
|
|
23
23
|
require_relative "../mixin/openssl_helper"
|
24
24
|
include Chef::Mixin::OpenSSLHelper
|
25
25
|
|
26
|
-
unified_mode true
|
27
|
-
|
28
26
|
provides(:openssl_dhparam) { true }
|
29
27
|
|
30
28
|
description "Use the **openssl_dhparam** resource to generate `dhparam.pem` files. If a valid `dhparam.pem` file is found at the specified location, no new file will be created. If a file is found at the specified location but it is not a valid `dhparam.pem` file, it will be overwritten."
|
@@ -24,8 +24,6 @@ class Chef
|
|
24
24
|
require_relative "../mixin/openssl_helper"
|
25
25
|
include Chef::Mixin::OpenSSLHelper
|
26
26
|
|
27
|
-
unified_mode true
|
28
|
-
|
29
27
|
provides :openssl_ec_private_key
|
30
28
|
|
31
29
|
description "Use the **openssl_ec_private_key** resource to generate an elliptic curve (EC) private key file. If a valid EC key file can be opened at the specified location, no new file will be created. If the EC key file cannot be opened, either because it does not exist or because the password to the EC key file does not match the password in the recipe, then it will be overwritten."
|
@@ -24,8 +24,6 @@ class Chef
|
|
24
24
|
require_relative "../mixin/openssl_helper"
|
25
25
|
include Chef::Mixin::OpenSSLHelper
|
26
26
|
|
27
|
-
unified_mode true
|
28
|
-
|
29
27
|
provides :openssl_ec_public_key
|
30
28
|
|
31
29
|
description "Use the **openssl_ec_public_key** resource to generate elliptic curve (EC) public key files from a given EC private key."
|
@@ -24,8 +24,6 @@ class Chef
|
|
24
24
|
require_relative "../mixin/openssl_helper"
|
25
25
|
include Chef::Mixin::OpenSSLHelper
|
26
26
|
|
27
|
-
unified_mode true
|
28
|
-
|
29
27
|
provides :openssl_x509_crl
|
30
28
|
|
31
29
|
description "Use the **openssl_x509_crl** resource to generate PEM-formatted x509 certificate revocation list (CRL) files."
|
@@ -24,8 +24,6 @@ class Chef
|
|
24
24
|
require_relative "../mixin/openssl_helper"
|
25
25
|
include Chef::Mixin::OpenSSLHelper
|
26
26
|
|
27
|
-
unified_mode true
|
28
|
-
|
29
27
|
provides :openssl_x509_request
|
30
28
|
|
31
29
|
description "Use the **openssl_x509_request** resource to generate PEM-formatted x509 certificates requests. If no existing key is specified, the resource will automatically generate a passwordless key with the certificate."
|
data/lib/chef/resource/perl.rb
CHANGED
data/lib/chef/resource/plist.rb
CHANGED
@@ -22,7 +22,6 @@ class Chef
|
|
22
22
|
class Resource
|
23
23
|
|
24
24
|
class PlistResource < Chef::Resource # we name this PlistResource to avoid confusion with Plist from the plist gem
|
25
|
-
unified_mode true
|
26
25
|
|
27
26
|
provides :plist
|
28
27
|
|
@@ -85,7 +84,7 @@ class Chef
|
|
85
84
|
converge_if_changed :path do
|
86
85
|
converge_by "create new plist: '#{new_resource.path}'" do
|
87
86
|
file new_resource.path do
|
88
|
-
content
|
87
|
+
content({}.to_plist)
|
89
88
|
owner new_resource.owner
|
90
89
|
group new_resource.group
|
91
90
|
mode new_resource.mode if property_is_set?(:mode)
|
@@ -189,7 +188,12 @@ class Chef
|
|
189
188
|
sep = " "
|
190
189
|
arg = case subcommand.to_s
|
191
190
|
when "add"
|
192
|
-
|
191
|
+
if value.is_a?(Hash)
|
192
|
+
sep = ":"
|
193
|
+
value.map { |k, v| "#{k} #{type_to_commandline_string(v)}" }
|
194
|
+
else
|
195
|
+
type_to_commandline_string(value)
|
196
|
+
end
|
193
197
|
when "set"
|
194
198
|
if value.is_a?(Hash)
|
195
199
|
sep = ":"
|