chef 17.9.52 → 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 +16 -8
- data/README.md +7 -7
- data/Rakefile +5 -24
- data/{chef-universal-mingw32.gemspec → chef-universal-mingw-ucrt.gemspec} +7 -5
- data/chef.gemspec +14 -7
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/api_client_v1.rb +9 -1
- data/lib/chef/application/exit_code.rb +3 -3
- data/lib/chef/client.rb +167 -0
- data/lib/chef/compliance/input.rb +1 -1
- data/lib/chef/compliance/input_collection.rb +1 -1
- data/lib/chef/compliance/profile.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +1 -2
- data/lib/chef/compliance/waiver.rb +1 -1
- data/lib/chef/compliance/waiver_collection.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/dsl/secret.rb +113 -5
- 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/powershell_exec.rb +5 -28
- data/lib/chef/mixin/properties.rb +6 -0
- data/lib/chef/node/attribute.rb +20 -3
- data/lib/chef/node/mixin/deep_merge_cache.rb +4 -4
- data/lib/chef/node/mixin/immutablize_array.rb +1 -0
- data/lib/chef/policy_builder/expand_node_object.rb +1 -2
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/property.rb +5 -3
- 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/powershell.rb +1 -1
- data/lib/chef/provider/package/rubygems.rb +7 -7
- 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/python_helper.rb +14 -1
- data/lib/chef/provider/package/zypper/version.rb +60 -0
- data/lib/chef/provider/package/zypper.rb +47 -3
- data/lib/chef/provider/service/windows.rb +5 -5
- 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 +2 -2
- data/lib/chef/provider/user.rb +45 -9
- 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 +17 -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 +0 -1
- 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 +0 -1
- data/lib/chef/resource/homebrew_package.rb +0 -1
- data/lib/chef/resource/homebrew_tap.rb +0 -1
- 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 +1 -2
- data/lib/chef/resource/log.rb +0 -1
- data/lib/chef/resource/lwrp_base.rb +0 -4
- data/lib/chef/resource/macos_userdefaults.rb +0 -1
- 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 +17 -1
- 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 +3 -4
- 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_certificate.rb +54 -43
- 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 +27 -22
- 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 +36 -27
- 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 +13 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +19 -3
- data/lib/chef/secret_fetcher/azure_key_vault.rb +3 -3
- data/lib/chef/secret_fetcher/hashi_vault.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/handle.rb +6 -7
- data/lib/chef/win32/registry.rb +7 -3
- data/lib/chef/win32/version.rb +2 -1
- data/spec/data/rubygems.org/sexp_processor-info +2 -1
- data/spec/functional/resource/dnf_package_spec.rb +15 -0
- 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/plist_spec.rb +25 -0
- data/spec/functional/resource/user/linux_user_spec.rb +127 -0
- data/spec/functional/resource/windows_certificate_spec.rb +15 -12
- data/spec/functional/resource/windows_font_spec.rb +11 -8
- data/spec/functional/resource/windows_pagefile_spec.rb +31 -4
- data/spec/functional/resource/yum_package_spec.rb +15 -0
- data/spec/functional/resource/zypper_package_spec.rb +12 -0
- data/spec/functional/shell_spec.rb +7 -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 +54 -2
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/daemon_spec.rb +1 -5
- data/spec/unit/dsl/secret_spec.rb +127 -23
- data/spec/unit/http/authenticator_spec.rb +68 -0
- 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/rubygems_spec.rb +2 -2
- data/spec/unit/provider/package/zypper_spec.rb +32 -0
- data/spec/unit/provider/user/linux_spec.rb +96 -1
- 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_config_spec.rb +8 -0
- 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/cron_d_spec.rb +37 -1
- 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 +21 -1
- data/spec/unit/run_context_spec.rb +16 -0
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +1 -1
- data/tasks/rspec.rb +1 -1
- metadata +93 -21
@@ -112,7 +112,7 @@ class Chef
|
|
112
112
|
raise Chef::Exceptions::Secret::ConfigurationInvalid.new("You must provide the authenticating Vault role name in the configuration as :role_name")
|
113
113
|
end
|
114
114
|
|
115
|
-
Vault.auth.aws_iam(config[:role_name], Aws::InstanceProfileCredentials.new)
|
115
|
+
Vault.auth.aws_iam(config[:role_name], Aws::InstanceProfileCredentials.new, Vault.address)
|
116
116
|
else
|
117
117
|
raise Chef::Exceptions::Secret::ConfigurationInvalid.new("Invalid :auth_method provided. You gave #{config[:auth_method]}, expected one of :#{SUPPORTED_AUTH_TYPES.join(", :")} ")
|
118
118
|
end
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/handle.rb
CHANGED
@@ -26,10 +26,6 @@ class Chef
|
|
26
26
|
class Handle
|
27
27
|
extend Chef::ReservedNames::Win32::API::Process
|
28
28
|
|
29
|
-
# See http://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx
|
30
|
-
# The handle value returned by the GetCurrentProcess function is the pseudo handle (HANDLE)-1 (which is 0xFFFFFFFF)
|
31
|
-
CURRENT_PROCESS_HANDLE = 4294967295
|
32
|
-
|
33
29
|
def initialize(handle)
|
34
30
|
@handle = handle
|
35
31
|
ObjectSpace.define_finalizer(self, Handle.close_handle_finalizer(handle))
|
@@ -38,13 +34,16 @@ class Chef
|
|
38
34
|
attr_reader :handle
|
39
35
|
|
40
36
|
def self.close_handle_finalizer(handle)
|
37
|
+
proc { close_handle(handle) }
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.close_handle(handle)
|
41
41
|
# According to http://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx, it is not necessary
|
42
42
|
# to close the pseudo handle returned by the GetCurrentProcess function. The docs also say that it doesn't hurt to call
|
43
43
|
# CloseHandle on it. However, doing so from inside of Ruby always seems to produce an invalid handle error.
|
44
|
-
|
45
|
-
|
44
|
+
# The recommendation is to use GetCurrentProcess instead of the const (HANDLE)-1, to ensure we're making the correct comparison.
|
45
|
+
return if handle == GetCurrentProcess()
|
46
46
|
|
47
|
-
def self.close_handle(handle)
|
48
47
|
unless CloseHandle(handle)
|
49
48
|
Chef::ReservedNames::Win32::Error.raise!
|
50
49
|
end
|
data/lib/chef/win32/registry.rb
CHANGED
@@ -20,7 +20,7 @@ require_relative "../reserved_names"
|
|
20
20
|
require_relative "api"
|
21
21
|
require_relative "../mixin/wide_string"
|
22
22
|
|
23
|
-
if RUBY_PLATFORM.match?(/mswin|
|
23
|
+
if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
24
24
|
require "win32/api"
|
25
25
|
module Win32
|
26
26
|
autoload :Registry, File.expand_path("../monkey_patches/win32/registry", __dir__)
|
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
class Win32
|
33
33
|
class Registry
|
34
34
|
|
35
|
-
if RUBY_PLATFORM.match?(/mswin|
|
35
|
+
if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
36
36
|
include Chef::ReservedNames::Win32::API::Registry
|
37
37
|
extend Chef::ReservedNames::Win32::API::Registry
|
38
38
|
end
|
@@ -293,7 +293,11 @@ class Chef
|
|
293
293
|
end
|
294
294
|
|
295
295
|
def machine_architecture
|
296
|
-
node
|
296
|
+
if node.nil?
|
297
|
+
::RbConfig::CONFIG["target_cpu"] == "x64" ? :x86_64 : :i386
|
298
|
+
else
|
299
|
+
node[:kernel][:machine].to_sym
|
300
|
+
end
|
297
301
|
end
|
298
302
|
|
299
303
|
def assert_architecture!
|
data/lib/chef/win32/version.rb
CHANGED
@@ -51,7 +51,8 @@ class Chef
|
|
51
51
|
WIN_VERSIONS = {
|
52
52
|
"Windows Server 2022" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 20348 } },
|
53
53
|
"Windows Server 2019" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 17763 && build_number < 20348 } },
|
54
|
-
"Windows
|
54
|
+
"Windows 11" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION && build_number >= 22000 } },
|
55
|
+
"Windows 10" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION && build_number >= 19044 && build_number < 22000 } },
|
55
56
|
"Windows Server 2016" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number <= 14393 } },
|
56
57
|
"Windows 8.1" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } },
|
57
58
|
"Windows Server 2012 R2" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION } },
|
@@ -46,4 +46,5 @@
|
|
46
46
|
4.14.0 |checksum:99a20cc5e7b901f6b493a8ca5e13439b73b19671eaaca68a00216c4f66765edc
|
47
47
|
4.14.1 |checksum:0fa8731445cf4a0c01570ec29aac4b50a0451ce66b1b31ad768f5035e3af7b90,ruby:~> 2.2
|
48
48
|
4.15.0 |checksum:a5ec27d8055ad47444cfb7ce860bad8af2365772a82892f4a8a0d97e8e9e3b34,ruby:~> 2.2
|
49
|
-
4.15.1 |checksum:9291a0f2247f50d15068ee6965b67cd7b678b0d273e18adf3c0b2ea4a890125c,ruby
|
49
|
+
4.15.1 |checksum:9291a0f2247f50d15068ee6965b67cd7b678b0d273e18adf3c0b2ea4a890125c,ruby:>= 2.1
|
50
|
+
4.16.1 |checksum:5caadbf4bbe5ab539cb892a5bcf74ca33a2f2a897cecafdee4a63be79b4819dc,ruby:>= 2.1
|
@@ -709,6 +709,21 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
709
709
|
action :install
|
710
710
|
end.should_not_be_updated
|
711
711
|
end
|
712
|
+
|
713
|
+
it "works with constraints in the version property" do
|
714
|
+
flush_cache
|
715
|
+
dnf_package "chef_rpm" do
|
716
|
+
version ">= 1.10"
|
717
|
+
options default_options
|
718
|
+
action :install
|
719
|
+
end.should_be_updated
|
720
|
+
expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
|
721
|
+
dnf_package "chef_rpm" do
|
722
|
+
version ">= 1.10"
|
723
|
+
options default_options
|
724
|
+
action :install
|
725
|
+
end.should_not_be_updated
|
726
|
+
end
|
712
727
|
end
|
713
728
|
|
714
729
|
context "with source arguments" do
|
@@ -263,7 +263,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d
|
|
263
263
|
dsc_test_resource.cwd(dsc_environment_fail_etc_directory)
|
264
264
|
expect {
|
265
265
|
dsc_test_resource.run_action(:run)
|
266
|
-
}.to raise_error(
|
266
|
+
}.to raise_error(ChefPowerShell::PowerShellExceptions::PowerShellCommandFailed, /#{exception_message_signature}/)
|
267
267
|
end
|
268
268
|
end
|
269
269
|
end
|
@@ -44,10 +44,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
44
44
|
members.shift # Get rid of GroupMembership: string
|
45
45
|
members.include?(user)
|
46
46
|
else
|
47
|
-
#
|
48
|
-
# Adding a
|
49
|
-
#
|
50
|
-
sleep
|
47
|
+
# NOTE: For some reason our temporary AIX 7.x systems do not correctly report group membership immediately after changes have been made.
|
48
|
+
# Adding a delay for this platform is enough to get correct results.
|
49
|
+
# reference: https://github.com/chef/release-engineering/issues/1617
|
50
|
+
sleep 3 if aix?
|
51
51
|
Etc.getgrnam(group_name).mem.include?(user)
|
52
52
|
end
|
53
53
|
end
|
@@ -133,6 +133,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
133
133
|
temp_resource.append(true)
|
134
134
|
temp_resource.run_action(:modify)
|
135
135
|
members.each do |member|
|
136
|
+
# NOTE For some reason our temporary AIX 7.x systems do not correctly report group membership immediately after changes have been made.
|
137
|
+
# Adding a delay for this platform is enough to get correct results.
|
138
|
+
# reference: https://github.com/chef/release-engineering/issues/1617
|
139
|
+
sleep 3 if aix?
|
136
140
|
expect(user_exist_in_group?(member)).to eq(true)
|
137
141
|
end
|
138
142
|
end
|
@@ -425,7 +429,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
425
429
|
end
|
426
430
|
end
|
427
431
|
|
428
|
-
describe "when there is a group" do
|
432
|
+
describe "when there is a group", :not_supported_on_freebsd_gte_12_3 do
|
429
433
|
it_behaves_like "correct group management"
|
430
434
|
end
|
431
435
|
|
@@ -463,7 +467,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
463
467
|
end
|
464
468
|
end
|
465
469
|
|
466
|
-
describe "when there is a group" do
|
470
|
+
describe "when there is a group", :not_supported_on_freebsd_gte_12_3 do
|
467
471
|
it_behaves_like "correct group management"
|
468
472
|
end
|
469
473
|
|
@@ -345,17 +345,17 @@ describe Chef::Resource::Link do
|
|
345
345
|
let(:test_user) { "test-link-user" }
|
346
346
|
before do
|
347
347
|
user(test_user).run_action(:create)
|
348
|
-
#
|
349
|
-
# Adding a
|
350
|
-
#
|
351
|
-
sleep
|
348
|
+
# NOTE: For some reason our temporary AIX 7.x systems do not correctly report user existence immediately after changes have been made.
|
349
|
+
# Adding a delay for this platform is enough to get correct results.
|
350
|
+
# reference: https://github.com/chef/release-engineering/issues/1617
|
351
|
+
sleep 3 if aix?
|
352
352
|
end
|
353
353
|
after do
|
354
354
|
user(test_user).run_action(:remove)
|
355
|
-
# TODO For some reason our temporary AIX 7.
|
356
|
-
# Adding a
|
357
|
-
#
|
358
|
-
sleep
|
355
|
+
# TODO For some reason our temporary AIX 7.x systems do not correctly report user existence immediately after changes have been made.
|
356
|
+
# Adding a delay for this platform is enough to get correct results.
|
357
|
+
# reference: https://github.com/chef/release-engineering/issues/1617
|
358
|
+
sleep 3 if aix?
|
359
359
|
end
|
360
360
|
before(:each) do
|
361
361
|
resource.owner(test_user)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "plist"
|
3
|
+
|
4
|
+
describe Chef::Resource::PlistResource, :macos_only, requires_root: true do
|
5
|
+
include RecipeDSLHelper
|
6
|
+
|
7
|
+
let(:global_prefs) do
|
8
|
+
File.join(Dir.mktmpdir, ".GlobalPreferences.plist")
|
9
|
+
end
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
FileUtils.rm_f global_prefs
|
13
|
+
end
|
14
|
+
|
15
|
+
context "make Monday the first DOW" do
|
16
|
+
it "creates a new plist with a hash value" do
|
17
|
+
plist global_prefs do
|
18
|
+
entry "AppleFirstWeekday"
|
19
|
+
value(gregorian: 4)
|
20
|
+
end
|
21
|
+
expect(File.exist?(global_prefs))
|
22
|
+
expect(shell_out!("/usr/libexec/PlistBuddy -c 'Print :\"AppleFirstWeekday\":gregorian' \"#{global_prefs}\"").stdout.to_i).to eq(4)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef/mixin/shell_out"
|
20
|
+
|
21
|
+
metadata = {
|
22
|
+
requires_root: true,
|
23
|
+
linux_only: true,
|
24
|
+
}
|
25
|
+
|
26
|
+
describe "Chef::Resource::User with Chef::Provider::User::LinuxUser provider", metadata do
|
27
|
+
include Chef::Mixin::ShellOut
|
28
|
+
|
29
|
+
def clean_user
|
30
|
+
shell_out!("/usr/sbin/userdel #{username}")
|
31
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
32
|
+
# Raised when the user is already cleaned
|
33
|
+
end
|
34
|
+
|
35
|
+
def ensure_file_cache_path_exists
|
36
|
+
path = Chef::Config["file_cache_path"]
|
37
|
+
FileUtils.mkdir_p(path) unless File.directory?(path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def user_should_exist
|
41
|
+
expect(shell_out("grep -q #{username} /etc/passwd").error?).to be(false)
|
42
|
+
end
|
43
|
+
|
44
|
+
def check_password(pass, user)
|
45
|
+
expect(shell_out("grep ^#{user}: /etc/shadow | cut -d: -f2 | grep ^#{pass}$").exitstatus).to eq(0)
|
46
|
+
end
|
47
|
+
|
48
|
+
let(:node) do
|
49
|
+
n = Chef::Node.new
|
50
|
+
n.consume_external_attrs(OHAI_SYSTEM.data.dup, {})
|
51
|
+
n
|
52
|
+
end
|
53
|
+
|
54
|
+
let(:events) do
|
55
|
+
Chef::EventDispatch::Dispatcher.new
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:run_context) do
|
59
|
+
Chef::RunContext.new(node, {}, events)
|
60
|
+
end
|
61
|
+
|
62
|
+
let(:username) do
|
63
|
+
"greatchef"
|
64
|
+
end
|
65
|
+
|
66
|
+
let(:uid) { nil }
|
67
|
+
let(:gid) do
|
68
|
+
# SLES 15 doesn't have the "20" group and
|
69
|
+
# so lets just pick the last group... no,
|
70
|
+
# Etc.group.map(&:gid).last does not work
|
71
|
+
Etc.enum_for(:group).map(&:gid).last
|
72
|
+
end
|
73
|
+
let(:home) { nil }
|
74
|
+
let(:manage_home) { false }
|
75
|
+
let(:password) { "XXXYYYZZZ" }
|
76
|
+
let(:comment) { "Great Chef" }
|
77
|
+
let(:shell) { "/bin/bash" }
|
78
|
+
let(:salt) { nil }
|
79
|
+
|
80
|
+
let(:user_resource) do
|
81
|
+
r = Chef::Resource::User::LinuxUser.new("TEST USER RESOURCE", run_context)
|
82
|
+
r.username(username)
|
83
|
+
r.uid(uid)
|
84
|
+
r.gid(gid)
|
85
|
+
|
86
|
+
r.home(home)
|
87
|
+
r.shell(shell)
|
88
|
+
r.comment(comment)
|
89
|
+
r.manage_home(manage_home)
|
90
|
+
r.password(password)
|
91
|
+
r.salt(salt)
|
92
|
+
r
|
93
|
+
end
|
94
|
+
|
95
|
+
before do
|
96
|
+
clean_user
|
97
|
+
ensure_file_cache_path_exists
|
98
|
+
end
|
99
|
+
|
100
|
+
after(:each) do
|
101
|
+
clean_user
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "action :create" do
|
105
|
+
it "should create the user" do
|
106
|
+
user_resource.run_action(:create)
|
107
|
+
user_should_exist
|
108
|
+
check_password(password, username)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "when user exists" do
|
113
|
+
before do
|
114
|
+
existing_resource = user_resource.dup
|
115
|
+
existing_resource.run_action(:create)
|
116
|
+
user_should_exist
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "when password is updated" do
|
120
|
+
it "should update the password of the user" do
|
121
|
+
user_resource.password("mykitchen")
|
122
|
+
user_resource.run_action(:create)
|
123
|
+
check_password("mykitchen", username)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -89,7 +89,9 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
89
89
|
|
90
90
|
end
|
91
91
|
|
92
|
-
after
|
92
|
+
after do
|
93
|
+
delete_store
|
94
|
+
end
|
93
95
|
|
94
96
|
describe "action: create" do
|
95
97
|
it "starts with no certificates" do
|
@@ -195,7 +197,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
195
197
|
create_store
|
196
198
|
end
|
197
199
|
it "fails with no certificates in the store" do
|
198
|
-
expect(Chef::Log).to receive(:info).with("Certificate not
|
200
|
+
expect(Chef::Log).to receive(:info).with("Certificate not valid")
|
199
201
|
|
200
202
|
resource.source = tests_thumbprint
|
201
203
|
resource.run_action(:verify)
|
@@ -219,7 +221,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
219
221
|
end
|
220
222
|
|
221
223
|
it "fails with an invalid thumbprint" do
|
222
|
-
expect(Chef::Log).to receive(:info).with("Certificate not
|
224
|
+
expect(Chef::Log).to receive(:info).with("Certificate not valid")
|
223
225
|
|
224
226
|
resource.source = others_thumbprint
|
225
227
|
resource.run_action(:verify)
|
@@ -253,7 +255,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
253
255
|
end
|
254
256
|
|
255
257
|
it "fails with an invalid thumbprint" do
|
256
|
-
expect(Chef::Log).to receive(:info).with("Certificate not
|
258
|
+
expect(Chef::Log).to receive(:info).with("Certificate not valid")
|
257
259
|
|
258
260
|
resource.source = others_thumbprint
|
259
261
|
resource.run_action(:verify)
|
@@ -265,11 +267,11 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
265
267
|
|
266
268
|
describe "action: fetch" do
|
267
269
|
context "with no certificate in the store" do
|
268
|
-
it "
|
269
|
-
expect(Chef::Log).
|
270
|
+
it "logs a debug error with no certificates in the store" do
|
271
|
+
expect(Chef::Log).to receive(:debug).with("Certificate Not Found")
|
270
272
|
resource.source = others_thumbprint
|
271
273
|
resource.output_path = cert_output_path
|
272
|
-
|
274
|
+
resource.run_action(:fetch)
|
273
275
|
end
|
274
276
|
end
|
275
277
|
|
@@ -288,7 +290,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
288
290
|
end
|
289
291
|
|
290
292
|
it "fails with an invalid thumbprint" do
|
291
|
-
expect(Chef::Log).
|
293
|
+
expect(Chef::Log).to receive(:debug).with("Certificate Not Found")
|
292
294
|
|
293
295
|
resource.source = others_thumbprint
|
294
296
|
|
@@ -296,7 +298,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
296
298
|
path = File.join(dir, "test.pem")
|
297
299
|
|
298
300
|
resource.output_path = path
|
299
|
-
|
301
|
+
resource.run_action(:fetch)
|
300
302
|
end
|
301
303
|
|
302
304
|
end
|
@@ -340,9 +342,10 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
340
342
|
end
|
341
343
|
|
342
344
|
describe "action: delete" do
|
343
|
-
it "
|
345
|
+
it "logs an error when attempting to delete a certificate that doesn't exist" do
|
346
|
+
expect(Chef::Log).to receive(:debug).with("Certificate Not Found")
|
344
347
|
resource.source = tests_thumbprint
|
345
|
-
|
348
|
+
resource.run_action(:delete)
|
346
349
|
end
|
347
350
|
|
348
351
|
it "deletes an existing certificate while leaving other certificates alone" do
|
@@ -360,7 +363,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
360
363
|
expect(certificate_count).to eq(1)
|
361
364
|
expect(resource).to be_updated_by_last_action
|
362
365
|
|
363
|
-
expect { resource.run_action :delete }.
|
366
|
+
expect { resource.run_action :delete }.not_to raise_error
|
364
367
|
expect(certificate_count).to eq(1)
|
365
368
|
expect(resource).not_to be_updated_by_last_action
|
366
369
|
|
@@ -37,13 +37,16 @@ describe Chef::Resource::WindowsFont, :windows_only do
|
|
37
37
|
resource
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
expect(subject).to be_updated_by_last_action
|
43
|
-
end
|
40
|
+
## these were commented out because testing hangs in the verify pipeline with them enabled. WEIRD
|
41
|
+
## that needs to be addressed
|
44
42
|
|
45
|
-
it "
|
46
|
-
|
47
|
-
|
48
|
-
end
|
43
|
+
# it "installs font on first install" do
|
44
|
+
# subject.run_action(:install)
|
45
|
+
# expect(subject).to be_updated_by_last_action
|
46
|
+
# end
|
47
|
+
|
48
|
+
# it "does not install font when already installed" do
|
49
|
+
# subject.run_action(:install)
|
50
|
+
# expect(subject).not_to be_updated_by_last_action
|
51
|
+
# end
|
49
52
|
end
|
@@ -40,13 +40,32 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
|
|
40
40
|
new_resource
|
41
41
|
end
|
42
42
|
|
43
|
+
def set_automatic_managed_to_false
|
44
|
+
powershell_code = <<~EOH
|
45
|
+
$computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges;
|
46
|
+
$computersys.AutomaticManagedPagefile = $False;
|
47
|
+
$computersys.Put();
|
48
|
+
EOH
|
49
|
+
powershell_exec!(powershell_code)
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_automatic_managed_to_true
|
53
|
+
powershell_code = <<~EOH
|
54
|
+
$computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges;
|
55
|
+
$computersys.AutomaticManagedPagefile = $True;
|
56
|
+
$computersys.Put();
|
57
|
+
EOH
|
58
|
+
powershell_exec!(powershell_code)
|
59
|
+
end
|
60
|
+
|
43
61
|
describe "Setting Up Pagefile Management" do
|
44
62
|
context "Disable Automatic Management" do
|
45
|
-
it "
|
63
|
+
it "Verifies Automatic Management is Disabled" do
|
64
|
+
set_automatic_managed_to_false
|
46
65
|
subject.path c_path
|
47
66
|
subject.automatic_managed false
|
48
67
|
subject.run_action(:set)
|
49
|
-
expect(subject).
|
68
|
+
expect(subject).not_to be_updated_by_last_action
|
50
69
|
end
|
51
70
|
|
52
71
|
it "Enable Automatic Management " do
|
@@ -55,6 +74,14 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
|
|
55
74
|
subject.run_action(:set)
|
56
75
|
expect(subject).to be_updated_by_last_action
|
57
76
|
end
|
77
|
+
|
78
|
+
it "Disables Automatic Management" do
|
79
|
+
set_automatic_managed_to_true
|
80
|
+
subject.path c_path
|
81
|
+
subject.automatic_managed false
|
82
|
+
subject.run_action(:set)
|
83
|
+
expect(subject).to be_updated_by_last_action
|
84
|
+
end
|
58
85
|
end
|
59
86
|
end
|
60
87
|
|
@@ -69,8 +96,8 @@ describe Chef::Resource::WindowsPagefile, :windows_only do
|
|
69
96
|
context "Update a pagefile" do
|
70
97
|
it "Changes a pagefile to use custom sizes" do
|
71
98
|
subject.path c_path
|
72
|
-
subject.initial_size
|
73
|
-
subject.maximum_size
|
99
|
+
subject.initial_size 128
|
100
|
+
subject.maximum_size 512
|
74
101
|
subject.run_action(:set)
|
75
102
|
expect(subject).to be_updated_by_last_action
|
76
103
|
end
|
@@ -754,6 +754,21 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do
|
|
754
754
|
action :install
|
755
755
|
end.should_not_be_updated
|
756
756
|
end
|
757
|
+
|
758
|
+
it "works with constraints in the version property" do
|
759
|
+
flush_cache
|
760
|
+
yum_package "chef_rpm" do
|
761
|
+
version ">= 1.10"
|
762
|
+
options default_options
|
763
|
+
action :install
|
764
|
+
end.should_be_updated
|
765
|
+
expect_matching_installed_version("^chef_rpm-1.10-1.#{pkg_arch}$")
|
766
|
+
yum_package "chef_rpm" do
|
767
|
+
version ">= 1.10"
|
768
|
+
options default_options
|
769
|
+
action :install
|
770
|
+
end.should_not_be_updated
|
771
|
+
end
|
757
772
|
end
|
758
773
|
|
759
774
|
context "with source arguments" do
|
@@ -74,6 +74,18 @@ describe Chef::Resource::ZypperPackage, :requires_root, :suse_only do
|
|
74
74
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
75
75
|
end
|
76
76
|
|
77
|
+
it "install package with source argument" do
|
78
|
+
zypper_package.source = "#{CHEF_SPEC_ASSETS}/zypprepo/chef_rpm-1.10-1.#{pkg_arch}.rpm"
|
79
|
+
zypper_package.run_action(:install)
|
80
|
+
expect(zypper_package.updated_by_last_action?).to be true
|
81
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "raises an error when passed a source that does not exist" do
|
85
|
+
zypper_package.source = "#{CHEF_SPEC_ASSETS}/false/zypprepo/chef_rpm-1.10-1.#{pkg_arch}.rpm"
|
86
|
+
expect { zypper_package.run_action(:install) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
87
|
+
end
|
88
|
+
|
77
89
|
it "does not install if the package is installed" do
|
78
90
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
79
91
|
zypper_package.run_action(:install)
|
@@ -78,10 +78,15 @@ describe Shell do
|
|
78
78
|
def run_chef_shell_with(options)
|
79
79
|
# Windows ruby installs don't (always?) have PTY,
|
80
80
|
# so hide the require here
|
81
|
-
|
82
81
|
require "pty"
|
82
|
+
|
83
|
+
# FIXME this is temporary... Solaris envs have TERM set to unknown
|
84
|
+
# and the value isn't propagating from the build environment TERM
|
85
|
+
# variable
|
86
|
+
ENV["TERM"] = "vt100" if ["", "unknown"].include?(ENV["TERM"].to_s)
|
87
|
+
|
83
88
|
config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
|
84
|
-
reader, writer, pid = PTY.spawn("bundle exec
|
89
|
+
reader, writer, pid = PTY.spawn("bundle exec #{ChefUtils::Dist::Infra::SHELL} --no-multiline --no-singleline --no-colorize -c #{config} #{options}")
|
85
90
|
read_until(reader, "chef (#{Chef::VERSION})>")
|
86
91
|
yield reader, writer if block_given?
|
87
92
|
writer.puts('"done"')
|
@@ -25,7 +25,7 @@ describe "Chef Versions", :executables do
|
|
25
25
|
include Chef::Mixin::ShellOut
|
26
26
|
let(:chef_dir) { File.join(__dir__, "..", "..") }
|
27
27
|
|
28
|
-
binaries = [ ChefUtils::Dist::Infra::CLIENT,
|
28
|
+
binaries = [ ChefUtils::Dist::Infra::CLIENT, ChefUtils::Dist::Infra::SHELL, "chef-apply", ChefUtils::Dist::Solo::EXEC ]
|
29
29
|
|
30
30
|
binaries.each do |binary|
|
31
31
|
it "#{binary} version should be sane" do
|