diff options
33 files changed, 443 insertions, 86 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe63db43c..6450c8a656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,33 @@ This changelog reflects the current state of chef's master branch on github and may not reflect the current released version of chef, which is [![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef). -## [v12.17.47](https://github.com/chef/chef/tree/v12.17.47) (2016-12-07) -[Full Changelog](https://github.com/chef/chef/compare/v12.16.42...v12.17.47) +## [v12.17.55](https://github.com/chef/chef/tree/v12.17.55) (2016-12-12) +[Full Changelog](https://github.com/chef/chef/compare/v12.16.42...v12.17.55) **Implemented enhancements:** -- Action :umount for mount resource is an obtuse anachronism [\#5595](https://github.com/chef/chef/issues/5595) +- Mount resource: Action :umount for mount resource is an obtuse anachronism [\#5595](https://github.com/chef/chef/issues/5595) +- Core: Properly deprecate old Chef::Platform methods [\#5631](https://github.com/chef/chef/pull/5631) ([lamont-granquist](https://github.com/lamont-granquist)) - Core: Update ohai resource to new style, stop overwriting name property [\#5607](https://github.com/chef/chef/pull/5607) ([adamleff](https://github.com/adamleff)) -- Linux: mount provider - skip device detection for zfs [\#5603](https://github.com/chef/chef/pull/5603) ([ttr](https://github.com/ttr)) +- Mount Resource: skip device detection for zfs on Linux systems [\#5603](https://github.com/chef/chef/pull/5603) ([ttr](https://github.com/ttr)) - Core: Ensure chef-solo creates node files w/ correct permissions [\#5601](https://github.com/chef/chef/pull/5601) ([scottopherson](https://github.com/scottopherson)) - Resources: Add unmount as an alias to umount in the mount resource [\#5599](https://github.com/chef/chef/pull/5599) ([shortdudey123](https://github.com/shortdudey123)) - Core: Update Data Collector to use Chef::JSONCompat [\#5590](https://github.com/chef/chef/pull/5590) ([adamleff](https://github.com/adamleff)) - Knife: Add ability to pass multiple nodes to knife node/client delete [\#5572](https://github.com/chef/chef/pull/5572) ([jeunito](https://github.com/jeunito)) - Core: Data Collector debug log should output JSON [\#5570](https://github.com/chef/chef/pull/5570) ([adamleff](https://github.com/adamleff)) +- Windows: PowerShell module output pass through [\#5549](https://github.com/chef/chef/pull/5549) ([coolmacool](https://github.com/coolmacool)) +- Windows: Added support in WIX to install chef-client as a scheduled task. [\#5540](https://github.com/chef/chef/pull/5540) ([Aliasgar16](https://github.com/Aliasgar16)) - Yum: Purge yum cache before deleting repo config [\#5509](https://github.com/chef/chef/pull/5509) ([iancward](https://github.com/iancward)) -- Knife Bootstrap: Passing config\_log\_level and config\_log\_location from config.rb [\#5502](https://github.com/chef/chef/pull/5502) ([dheerajd-msys](https://github.com/dheerajd-msys)) **Fixed bugs:** - Custom Resources: Undefined method up\_to\_date thrown by Chef 12.16.42 [\#5593](https://github.com/chef/chef/issues/5593) +- Knife: cookbook site share doesn't work with some json metadata [\#5622](https://github.com/chef/chef/pull/5622) ([lamont-granquist](https://github.com/lamont-granquist)) - Core: Ensure deprecation messages are always included [\#5618](https://github.com/chef/chef/pull/5618) ([thommay](https://github.com/thommay)) - Core: Fix bug where Access Controls on existing symlink resources would be ignored on first chef-client run [\#5616](https://github.com/chef/chef/pull/5616) ([tduffield](https://github.com/tduffield)) - The suggested fix for the manage\_home deprecation is incorrect [\#5615](https://github.com/chef/chef/pull/5615) ([tas50](https://github.com/tas50)) -- change choco -version to choco --version [\#5613](https://github.com/chef/chef/pull/5613) ([spuder](https://github.com/spuder)) +- Yum: Fix yum regexp similarly to rpm regexp in \#3985 [\#5614](https://github.com/chef/chef/pull/5614) ([lamont-granquist](https://github.com/lamont-granquist)) +- Windows: Fix specifying version of a chocolatey package [\#5613](https://github.com/chef/chef/pull/5613) ([spuder](https://github.com/spuder)) +- Core: Use object ID when detected unprocessed Resources [\#5604](https://github.com/chef/chef/pull/5604) ([adamleff](https://github.com/adamleff)) - Knife: Correct example `chef\_server\_url` in `knife configure` [\#5602](https://github.com/chef/chef/pull/5602) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) - Windows: Ensure correct version of shutdown is called when using the reboot resource [\#5596](https://github.com/chef/chef/pull/5596) ([Xoph](https://github.com/Xoph)) - Windows: Support for running cab\_package on non-English system locales [\#5591](https://github.com/chef/chef/pull/5591) ([jugatsu](https://github.com/jugatsu)) @@ -31,13 +36,7 @@ This changelog reflects the current state of chef's master branch on github and - Unset http\[s\]\_proxy in the subversion spec [\#5562](https://github.com/chef/chef/pull/5562) ([stefanor](https://github.com/stefanor)) - Core: fix Lint/UnifiedInteger cop [\#5547](https://github.com/chef/chef/pull/5547) ([lamont-granquist](https://github.com/lamont-granquist)) - Core: fix ImmutableArray slices [\#5541](https://github.com/chef/chef/pull/5541) ([lamont-granquist](https://github.com/lamont-granquist)) -- Prevent apt\_update failures on non-Linux platforms [\#5524](https://github.com/chef/chef/pull/5524) ([tas50](https://github.com/tas50)) -- Core: Ensure that the sensitive property is correctly accessed [\#5508](https://github.com/chef/chef/pull/5508) ([axos88](https://github.com/axos88)) - -**Closed issues:** - -- cab\_package doesn't support running on non-English system locales [\#5592](https://github.com/chef/chef/issues/5592) -- Support restarting/stopping/ the service from state paused on windows [\#5586](https://github.com/chef/chef/issues/5586) +- Apt\_update resource: Prevent failures on non-Linux platforms [\#5524](https://github.com/chef/chef/pull/5524) ([tas50](https://github.com/tas50)) ## [v12.16.42](https://github.com/chef/chef/tree/v12.16.42) (2016-11-04) [Full Changelog](https://github.com/chef/chef/compare/v12.15.19...v12.16.42) diff --git a/Gemfile.lock b/Gemfile.lock index e10887221d..37aed437f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,10 +47,10 @@ GIT PATH remote: . specs: - chef (12.17.47) + chef (12.17.55) addressable bundler (>= 1.10) - chef-config (= 12.17.47) + chef-config (= 12.17.55) chef-zero (>= 4.8) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -76,10 +76,10 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (12.17.47-universal-mingw32) + chef (12.17.55-universal-mingw32) addressable bundler (>= 1.10) - chef-config (= 12.17.47) + chef-config (= 12.17.55) chef-zero (>= 4.8) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -120,7 +120,7 @@ PATH PATH remote: chef-config specs: - chef-config (12.17.47) + chef-config (12.17.55) addressable fuzzyurl mixlib-config (~> 2.0) @@ -20,13 +20,14 @@ If you just want to use Chef, check out these resources: * [learnchef](https://learn.chef.io): Getting started guide * [docs.chef.io](https://docs.chef.io): Comprehensive User Docs -* [Installer Downloads](https://downloads.chef.io/chef-client/): Install Chef as a complete package +* [Installer Downloads](https://downloads.chef.io/chef/): Install Chef as a complete package +* [chef/chef](https://hub.docker.com/r/chef/chef): Docker image for use with [kitchen-dokken](https://github.com/someara/kitchen-dokken) ## Installing From Git **NOTE:** Unless you have a specific reason to install from source (to try a new feature, contribute a patch, or run chef on an OS for which no -package is available), you should head to the [downloads page](https://downloads.chef.io/chef-client/) +package is available), you should head to the [downloads page](https://downloads.chef.io/chef/) to get a prebuilt package. ### Prerequisites @@ -68,6 +68,15 @@ task :register_eventlog do end end +desc "Keep the Dockerfile up-to-date" +task :update_dockerfile do + require "mixlib/install" + latest_stable_version = Mixlib::Install.available_versions("chef", "stable").last + text = File.read("Dockerfile") + new_text = text.gsub(/^ARG VERSION=[\d\.]+$/, "ARG VERSION=#{latest_stable_version}") + File.open("Dockerfile", "w+") { |f| f.write(new_text) } +end + begin require "chefstyle" require "rubocop/rake_task" @@ -1 +1 @@ -12.17.47
\ No newline at end of file +12.17.55
\ No newline at end of file diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index b59a2928ac..48b0c82bc9 100644 --- a/chef-config/lib/chef-config/version.rb +++ b/chef-config/lib/chef-config/version.rb @@ -21,7 +21,7 @@ module ChefConfig CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__) - VERSION = "12.17.47" + VERSION = "12.17.55" end # diff --git a/ci/version_bump.sh b/ci/version_bump.sh index f3c345b7f0..5fa6fa4e98 100755 --- a/ci/version_bump.sh +++ b/ci/version_bump.sh @@ -8,5 +8,6 @@ export LANG=en_US.UTF-8 bundle exec rake version:bump bundle exec rake changelog +bundle exec rake update_dockerfile git checkout .bundle/config diff --git a/distro/powershell/chef/chef.psm1 b/distro/powershell/chef/chef.psm1 index 6646226795..9196d62e6c 100644 --- a/distro/powershell/chef/chef.psm1 +++ b/distro/powershell/chef/chef.psm1 @@ -109,6 +109,12 @@ public enum StandardHandle : int Error = -12 } +public enum HandleFlags : int +{ + HANDLE_FLAG_INHERIT = 0x00000001, + HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002 +} + public static class Kernel32 { [DllImport("kernel32.dll", SetLastError=true)] @@ -128,11 +134,12 @@ public static class Kernel32 [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr GetStdHandle( StandardHandle nStdHandle); - - [DllImport("kernel32", SetLastError=true)] - public static extern int WaitForSingleObject( - IntPtr hHandle, - int dwMilliseconds); + + [DllImport("kernel32.dll")] + public static extern bool SetHandleInformation( + IntPtr hObject, + int dwMask, + uint dwFlags); [DllImport("kernel32", SetLastError=true)] [return: MarshalAs(UnmanagedType.Bool)] @@ -144,6 +151,32 @@ public static class Kernel32 public static extern bool GetExitCodeProcess( IntPtr hProcess, out int lpExitCode); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool CreatePipe( + out IntPtr phReadPipe, + out IntPtr phWritePipe, + IntPtr lpPipeAttributes, + uint nSize); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool ReadFile( + IntPtr hFile, + [Out] byte[] lpBuffer, + uint nNumberOfBytesToRead, + ref int lpNumberOfBytesRead, + IntPtr lpOverlapped); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool PeekNamedPipe( + IntPtr handle, + byte[] buffer, + uint nBufferSize, + ref uint bytesRead, + ref uint bytesAvail, + ref uint BytesLeftThisMessage); + + public const int STILL_ACTIVE = 259; } } "@ @@ -156,13 +189,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { $si = New-Object Chef.STARTUPINFO $pi = New-Object Chef.PROCESS_INFORMATION - $si.cb = [System.Runtime.InteropServices.Marshal]::SizeOf($si) - $si.wShowWindow = [Chef.ShowWindow]::SW_SHOW - $si.dwFlags = [Chef.STARTF]::STARTF_USESTDHANDLES - $si.hStdError = [Chef.Kernel32]::GetStdHandle([Chef.StandardHandle]::Error) - $si.hStdOutput = [Chef.Kernel32]::GetStdHandle([Chef.StandardHandle]::Output) - $si.hStdInput = [Chef.Kernel32]::GetStdHandle([Chef.StandardHandle]::Input) - $pSec = New-Object Chef.SECURITY_ATTRIBUTES $pSec.Length = [System.Runtime.InteropServices.Marshal]::SizeOf($pSec) $pSec.bInheritHandle = $true @@ -170,25 +196,103 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { $tSec.Length = [System.Runtime.InteropServices.Marshal]::SizeOf($tSec) $tSec.bInheritHandle = $true - $success = [Chef.Kernel32]::CreateProcess($AppPath, $ArgumentString, [ref] $pSec, [ref] $tSec, $true, [Chef.CreationFlags]::NONE, [IntPtr]::Zero, $pwd, [ref] $si, [ref] $pi) + # Create pipe for process stdout + $ptr = [System.Runtime.InteropServices.Marshal]::AllocHGlobal([System.Runtime.InteropServices.Marshal]::SizeOf($si)) + [System.Runtime.InteropServices.Marshal]::StructureToPtr($pSec, $ptr, $true) + $hReadOut = [IntPtr]::Zero + $hWriteOut = [IntPtr]::Zero + $success = [Chef.Kernel32]::CreatePipe([ref] $hReadOut, [ref] $hWriteOut, $ptr, 0) if (-Not $success) { $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - throw "Unable to create process [$ArgumentString]. Error code $reason." + throw "Unable to create output pipe. Error code $reason." } - $waitReason = [Chef.Kernel32]::WaitForSingleObject($pi.hProcess, -1) - if ($waitReason -ne 0) { - if ($waitReason -eq -1) { - $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - throw "Could not wait for process to terminate. Error code $reason." - } else { - throw "WaitForSingleObject failed with return code $waitReason - it's impossible!" - } + $success = [Chef.Kernel32]::SetHandleInformation($hReadOut, [Chef.HandleFlags]::HANDLE_FLAG_INHERIT, 0) + if (-Not $success) { + $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() + throw "Unable to set output pipe handle information. Error code $reason." } - $success = [Chef.Kernel32]::GetExitCodeProcess($pi.hProcess, [ref] $global:LASTEXITCODE) + + $si.cb = [System.Runtime.InteropServices.Marshal]::SizeOf($si) + $si.wShowWindow = [Chef.ShowWindow]::SW_SHOW + $si.dwFlags = [Chef.STARTF]::STARTF_USESTDHANDLES + $si.hStdOutput = $hWriteOut + $si.hStdError = $hWriteOut + $si.hStdInput = [Chef.Kernel32]::GetStdHandle([Chef.StandardHandle]::Input) + + $success = [Chef.Kernel32]::CreateProcess( + $AppPath, + $ArgumentString, + [ref] $pSec, + [ref] $tSec, + $true, + [Chef.CreationFlags]::NONE, + [IntPtr]::Zero, + $pwd, + [ref] $si, + [ref] $pi + ) if (-Not $success) { $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() - throw "Process exit code unavailable. Error code $reason." + throw "Unable to create process [$ArgumentString]. Error code $reason." } + + $sb = New-Object System.Text.StringBuilder + $buffer = New-Object byte[] 1024 + + # Initialize reference variables + $bytesRead = 0 + $bytesAvailable = 0 + $bytesLeftThisMsg = 0 + $global:LASTEXITCODE = [Chef.Kernel32]::STILL_ACTIVE + + $isActive = $true + while ($isActive) { + $success = [Chef.Kernel32]::GetExitCodeProcess($pi.hProcess, [ref] $global:LASTEXITCODE) + if (-Not $success) { + $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() + throw "Process exit code unavailable. Error code $reason." + } + + $success = [Chef.Kernel32]::PeekNamedPipe( + $hReadOut, + $null, + $buffer.Length, + [ref] $bytesRead, + [ref] $bytesAvailable, + [ref] $bytesLeftThisMsg + ) + if (-Not $success) { + $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() + throw "Output pipe unavailable for peeking. Error code $reason." + } + + if ($bytesRead -gt 0) { + while ([Chef.Kernel32]::ReadFile($hReadOut, $buffer, $buffer.Length, [ref] $bytesRead, 0)) { + $output = [Text.Encoding]::UTF8.GetString($buffer, 0, $bytesRead) + if ($output) { + [void]$sb.Append($output) + } + if ($bytesRead -lt $buffer.Length) { + # Partial buffer indicating the end of stream, break out of ReadFile loop + # ReadFile will block until: + # The number of bytes requested is read. + # A write operation completes on the write end of the pipe. + # An asynchronous handle is being used and the read is occurring asynchronously. + # An error occurs. + break + } + } + } + + if ($global:LASTEXITCODE -ne [Chef.Kernel32]::STILL_ACTIVE) { + $isActive = $false + } + } + + # Return output obtained from child process stdout/stderr + $sb.ToString() + + # Cleanup handles $success = [Chef.Kernel32]::CloseHandle($pi.hProcess) if (-Not $success) { $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() @@ -199,6 +303,17 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() throw "Unable to release thread handle. Error code $reason." } + $success = [Chef.Kernel32]::CloseHandle($hWriteOut) + if (-Not $success) { + $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() + throw "Unable to release output write handle. Error code $reason." + } + $success = [Chef.Kernel32]::CloseHandle($hReadOut) + if (-Not $success) { + $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error() + throw "Unable to release output read handle. Error code $reason." + } + [System.Runtime.InteropServices.Marshal]::FreeHGlobal($ptr) } function Get-ScriptDirectory { diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb index df3bce6167..acd42c355e 100644 --- a/lib/chef/data_collector.rb +++ b/lib/chef/data_collector.rb @@ -430,26 +430,33 @@ class Chef end def detect_unprocessed_resources - # create a Set containing all resource+action combinations from - # the Resource Collection - collection_resources = Set.new + # create a Hash (for performance reasons, rather than an Array) containing all + # resource+action combinations from the Resource Collection + # + # We use the object ID instead of the resource itself in the Hash key because + # we currently allow users to create a property called "hash" which creates + # a #hash instance method on the resource. Ruby expects that to be a Fixnum, + # so bad things happen when adding an object to an Array or a Hash if it's not. + collection_resources = {} run_context.resource_collection.all_resources.each do |resource| Array(resource.action).each do |action| - collection_resources.add([resource, action]) + collection_resources[[resource.__id__, action]] = resource end end - # Delete from the Set any resource+action combination we have + # Delete from the Hash any resource+action combination we have # already processed. all_resource_reports.each do |report| - collection_resources.delete([report.resource, report.action]) + collection_resources.delete([report.resource.__id__, report.action]) end - # The items remaining in the Set are unprocessed resource+actions, + # The items remaining in the Hash are unprocessed resource+actions, # so we'll create new resource reports for them which default to # a state of "unprocessed". - collection_resources.each do |resource, action| - add_resource_report(create_resource_report(resource, action)) + collection_resources.each do |key, resource| + # The Hash key is an array of the Resource's object ID and the action. + # We need to pluck out the action. + add_resource_report(create_resource_report(resource, key[1])) end end diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb index de5090a48b..3a988fdfa3 100644 --- a/lib/chef/deprecated.rb +++ b/lib/chef/deprecated.rb @@ -156,6 +156,16 @@ class Chef end end + class ChefPlatformMethods < Base + def id + 13 + end + + def target + "chef_platform_methods.html" + end + end + class ResourceCloning < Base def id 3694 diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb index a0c2d33967..f99ab970c5 100644 --- a/lib/chef/dsl/platform_introspection.rb +++ b/lib/chef/dsl/platform_introspection.rb @@ -257,8 +257,8 @@ class Chef def docker?(node = run_context.nil? ? nil : run_context.node) # Using "File.exist?('/.dockerinit') || File.exist?('/.dockerenv')" makes Travis sad, # and that makes us sad too. - node && node[:virtualization] && node[:virtualization][:systems] && - node[:virtualization][:systems][:docker] && node[:virtualization][:systems][:docker] == "guest" + !!(node && node[:virtualization] && node[:virtualization][:systems] && + node[:virtualization][:systems][:docker] && node[:virtualization][:systems][:docker] == "guest") end end diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index bc565d92ef..abab719688 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -35,6 +35,7 @@ class Chef include Chef::Mixin::ParamsValidate def find(name, version) + Chef.deprecated(:chef_platform_methods, "#{self.class.name}.find is deprecated") provider_map = platforms[:default].clone name_sym = name @@ -90,6 +91,7 @@ class Chef end def provider_for_resource(resource, action = :nothing) + Chef.deprecated(:chef_platform_methods, "#{self.class.name}.provider_for_resource is deprecated") node = resource.run_context && resource.run_context.node raise ArgumentError, "Cannot find the provider for a resource with no run context set" unless node provider = find_provider_for_node(node, resource).new(resource, resource.run_context) @@ -102,11 +104,13 @@ class Chef end def find_provider_for_node(node, resource_type) + Chef.deprecated(:chef_platform_methods, "#{self.class.name}.find_provider_for_node is deprecated") platform, version = find_platform_and_version(node) find_provider(platform, version, resource_type) end def set(args) + Chef.deprecated(:chef_platform_methods, "#{self.class.name}.set is deprecated") validate( args, { @@ -172,6 +176,7 @@ class Chef end def find_provider(platform, version, resource_type) + Chef.deprecated(:chef_platform_methods, "#{self.class.name}.find_provider is deprecated") provider_klass = explicit_provider(platform, version, resource_type) || platform_provider(platform, version, resource_type) || resource_matching_provider(platform, version, resource_type) diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb index 8903f65d26..2eb4d72ba5 100644 --- a/lib/chef/provider_resolver.rb +++ b/lib/chef/provider_resolver.rb @@ -90,8 +90,10 @@ class Chef @prioritized_handlers ||= begin supported_handlers = self.supported_handlers if supported_handlers.empty? - # if none of the providers specifically support the resource, we still need to pick one of the providers that are - # enabled on the node to handle the why-run use case. FIXME we should only do this in why-run mode then. + # We always require a provider to be able to call define_resource_requirements on. In the why-run case we need + # a provider to say "assuming /etc/init.d/whatever would have been installed" and in the non-why-run case we + # need to make a best guess at "cannot find /etc/init.d/whatever". We are essentially defining a "default" provider + # for the platform, which is the best we can do, but which might give misleading errors, but we cannot read minds. Chef::Log.debug "No providers responded true to `supports?` for action #{action} on resource #{resource}, falling back to enabled handlers so we can return something anyway." supported_handlers = enabled_handlers end diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 9f7de1e57a..67f2c301f3 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -21,7 +21,7 @@ class Chef CHEF_ROOT = File.expand_path("../..", __FILE__) - VERSION = "12.17.47" + VERSION = "12.17.55" end # diff --git a/omnibus/resources/chef/msi/localization-en-us.wxl.erb b/omnibus/resources/chef/msi/localization-en-us.wxl.erb index 62c27b99f6..c5e8e5ddab 100644 --- a/omnibus/resources/chef/msi/localization-en-us.wxl.erb +++ b/omnibus/resources/chef/msi/localization-en-us.wxl.erb @@ -16,15 +16,27 @@ <String Id="VerifyReadyDlgInstallTitle">{\WixUI_Font_Title_White}Ready to install [ProductName]</String> + <!-- Scheduled Task --> + <String Id="SchTaskDisplayName"><%= friendly_name %> Scheduled Task</String> + <String Id="SchTaskDescription">Schedule <%= friendly_name %> to run at a pre-defined time intervals.</String> <!-- Service --> <!-- Keep these in sync with the name and description in chef-service-manager --> <String Id="ServiceDisplayName"><%= friendly_name %> Service</String> <String Id="ServiceDescription">Runs <%= friendly_name %> on regular, configurable intervals.</String> <String Id="FeatureMainName"><%= friendly_name %></String> + <String Id="FeatureSchTaskName"><%= friendly_name %> Scheduled Task</String> <String Id="FeatureServiceName"><%= friendly_name %> Service</String> <String Id="FeaturePSModuleName"><%= friendly_name %> PowerShell wrappers</String> <String Id="MinimumOSVersionMessage">This package requires minimum OS version: Windows 7/Windows Server 2008 R2 or greater.</String> <String Id="DowngradeErrorMessage">A newer version of [ProductName] is already installed.</String> <String Id="FileExtractionProgress">Extracting files, please wait...</String> + + <String Id="CustomizeDlgTextMsg">Select an option to change between the Chef's unattended execution options.</String> + <String Id="CustomizeDlgTextTitle">Chef Unattended Execution Options</String> + <String Id="CustomizeDlgFirstRadioButtonText">Chef Client Scheduled Task</String> + <String Id="CustomizeDlgSecondRadioButtonText">Chef Client Service</String> + <String Id="CustomizeDlgThirdRadioButtonText">None</String> + + <String Id="CustomizeDlgOptionsMsg">The installer can configure the Chef Client to run periodically as either a scheduled task or a service. Using a scheduled task is recommended. For more information, see https://docs.chef.io/windows.html.</String> </WixLocalization> diff --git a/omnibus/resources/chef/msi/source.wxs.erb b/omnibus/resources/chef/msi/source.wxs.erb index bdde02687e..9bd13ff499 100644 --- a/omnibus/resources/chef/msi/source.wxs.erb +++ b/omnibus/resources/chef/msi/source.wxs.erb @@ -28,6 +28,8 @@ <Media Id="1" Cabinet="ChefClient.cab" EmbedCab="yes" CompressionLevel="high" /> + <Property Id="CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP" Value="None" /> + <!-- Uncomment launch condition below to check for minimum OS 601 = Windows 7/Server 2008R2. @@ -67,9 +69,42 @@ Impersonate="no" Return="ignore" /> + <CustomAction Id="CreateChefClientScheduledTask" + Directory="TARGETDIR" + ExeCommand=""[SystemFolder]SCHTASKS.EXE" /CREATE /TN "ChefClientSchTask" /SC "MINUTE" /MO "30" /F /TR "cmd /c \"[EMBEDDEDBIN]ruby.exe [PROJECTLOCATIONBIN]chef-client -L [CONFIGLOCATION]chef-client.log -c [CONFIGLOCATION]client.rb\"" /RU "NT Authority\System" /RP /RL "HIGHEST"" + Execute="deferred" + Impersonate="no" + Return="check" /> + + <CustomAction Id="RemoveChefClientScheduledTask" + Directory="TARGETDIR" + ExeCommand=""[SystemFolder]SCHTASKS.EXE" /DELETE /TN "ChefClientSchTask" /F" + Execute="deferred" + Impersonate="no" + Return="ignore" /> + + <CustomAction Id="RemoveChefClientService" + Directory="TARGETDIR" + ExeCommand=""[SystemFolder]SC.EXE" DELETE "chef-client"" + Execute="deferred" + Impersonate="no" + Return="ignore" /> + <InstallExecuteSequence> <Custom Action="FastUnzip" After="InstallFiles">NOT Installed</Custom> <Custom Action="Cleanup" After="RemoveFiles">REMOVE~="ALL"</Custom> + + <Custom Action="CreateChefClientScheduledTask" After="InstallFiles"> + <![CDATA[&ChefSchTaskFeature=3]]> + </Custom> + + <Custom Action="RemoveChefClientScheduledTask" Before="RemoveFiles"> + <![CDATA[(Installed AND (&NoneFeature=3 OR &ChefServiceFeature=3)) OR (REMOVE="ALL")]]> + </Custom> + + <Custom Action="RemoveChefClientService" Before="RemoveFiles"> + <![CDATA[Installed AND (&NoneFeature=3 OR &ChefSchTaskFeature=3) OR (REMOVE="ALL")]]> + </Custom> </InstallExecuteSequence> <UI> @@ -135,6 +170,16 @@ </Directory> </Directory> </Directory> + <Directory Id="ChefSchTaskFeatureTempDir"> + <Component Id="ChefSchTask" Guid="{7f9f917a-952c-41d8-baa1-037269eecb50}"> + <CreateFolder /> + </Component> + </Directory> + <Directory Id="NoneFeatureTempDir"> + <Component Id="None" Guid="{d8f3eba5-cecb-436c-a4ef-540dba3c5ccf}"> + <CreateFolder /> + </Component> + </Directory> </Directory> </Directory> @@ -151,8 +196,24 @@ <ComponentRef Id="ChefPSModulePath" /> </Feature> - <Feature Id="ChefServiceFeature" Title="!(loc.FeatureServiceName)" Level="1000" AllowAdvertise="no"> - <ComponentRef Id="ChefClientService" /> + <Feature Id="ChefUnattendedExecutionOptions" Title="Chef Unattended Execution Options" Level="1000" AllowAdvertise="no"> + <Feature Id="ChefSchTaskFeature" Title="!(loc.FeatureSchTaskName)" Level="1000" AllowAdvertise="no" Display="hidden"> + <!-- Here, CustomAction will get executed and scheduled task for chef-client will get created --> + + <!-- This is an empty component to keep track of the feature --> + <ComponentRef Id="ChefSchTask" /> + </Feature> + + <Feature Id="ChefServiceFeature" Title="!(loc.FeatureServiceName)" Level="1000" AllowAdvertise="no" Display="hidden"> + <ComponentRef Id="ChefClientService" /> + </Feature> + + <Feature Id="NoneFeature" Title="None" Level="1000" AllowAdvertise="no" Display="hidden"> + <!-- Do Nothing --> + + <!-- This is an empty component to keep track of the feature --> + <ComponentRef Id="None" /> + </Feature> </Feature> <!-- @@ -173,12 +234,92 @@ <UIRef Id="ChefClientUI_InstallDir"/> <UI Id="ChefClientUI_InstallDir"> - <UIRef Id="WixUI_FeatureTree"/> + <!-- WixUI_FeatureTree module's code embedded and modified here as per the requirement --> <TextStyle Id="WixUI_Font_Normal_White" FaceName="Tahoma" Size="8" Red="255" Green="255" Blue="255" /> <TextStyle Id="WixUI_Font_Bigger_White" FaceName="Tahoma" Size="12" Red="255" Green="255" Blue="255" /> <TextStyle Id="WixUI_Font_Title_White" FaceName="Tahoma" Size="9" Bold="yes" Red="255" Green="255" Blue="255" /> + <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" /> + <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" /> + <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" /> + <TextStyle Id="WixUI_Font_Msg" FaceName="Tahoma" Size="9" /> + + <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" /> + <Property Id="WixUI_Mode" Value="FeatureTree" /> + + <DialogRef Id="ErrorDlg" /> + <DialogRef Id="FatalError" /> + <DialogRef Id="FilesInUse" /> + <DialogRef Id="MsiRMFilesInUse" /> + <DialogRef Id="PrepareDlg" /> + <DialogRef Id="ProgressDlg" /> + <DialogRef Id="ResumeDlg" /> + <DialogRef Id="UserExit" /> + + <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> + + <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish> + <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish> + + <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish> + <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish> + + <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish> + <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="2">NOT Installed</Publish> + + <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[((NOT &ChefUnattendedExecutionOptions=3) AND NOT ((?ChefSchTask=3) OR (?ChefClientService=3) OR (?None=3)))]]></Publish> + + <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ChefUnattendedExecutionOptionsSelectionDlg"><![CDATA[((&ChefUnattendedExecutionOptions=3) OR (?ChefSchTask=3 OR ?ChefClientService=3 OR ?None=3))]]></Publish> + + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1"><![CDATA[NOT &ChefUnattendedExecutionOptions=3]]> AND (NOT Installed OR WixUI_InstallMode = "Change")</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ChefUnattendedExecutionOptionsSelectionDlg" Order="1"><![CDATA[&ChefUnattendedExecutionOptions=3]]> AND (NOT Installed OR WixUI_InstallMode = "Change")</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish> + <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish> + + <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> + + <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> + + <Dialog Id ="ChefUnattendedExecutionOptionsSelectionDlg" Width ="370" Height ="270" Title ="!(loc.ProductName) v$(var.DisplayVersionNumber) Setup" NoMinimize ="no"> + <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.CustomizeDlgBannerBitmap)" /> + <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" /> + <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> + <Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomizeDlgTitle)" /> + <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomizeDlgDescription)" /> + <Control Id="TextMsg" Type="Text" X="25" Y="55" Width="320" Height="20" Text="!(loc.CustomizeDlgTextMsg)" /> + + <Control Id="LeftBox" Type="GroupBox" X="25" Y="81" Width="175" Height="118" /> + <Control Id="TextTitle" Type="Text" X="30" Y="100" Width="169" Height="20" Text="{\WixUI_Font_Title}!(loc.CustomizeDlgTextTitle)" /> + <Control Id="OptionsRadioGroup" Type="RadioButtonGroup" Property="CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP" Height="80" Width="140" X="35" Y="110"> + <RadioButtonGroup Property="CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP"> + <RadioButton Value="SchTask" Text="!(loc.CustomizeDlgFirstRadioButtonText)" Height="17" Width="140" X="0" Y="10" /> + <RadioButton Value="Service" Text="!(loc.CustomizeDlgSecondRadioButtonText)" Height="17" Width="140" X="0" Y="35" /> + <RadioButton Value="None" Text="!(loc.CustomizeDlgThirdRadioButtonText)" Height="17" Width="140" X="0" Y="60" /> + </RadioButtonGroup> + </Control> + + <Control Id="RightBox" Type="GroupBox" X="210" Y="81" Width="150" Height="118" /> + <Control Id="OptionsMsg" Type="Text" X="214" Y="100" Width="146" Height="80" Text="{\WixUI_Font_Msg}!(loc.CustomizeDlgOptionsMsg)" /> + + <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="no" Text="Back"> + <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish> + </Control> + <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next"> + <Publish Event="AddLocal" Value="ChefSchTaskFeature">CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP = "SchTask"</Publish> + <Publish Event="AddLocal" Value="ChefServiceFeature">CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP = "Service"</Publish> + <Publish Event="AddLocal" Value="NoneFeature">CHEF_SERVICE_OPTIONS_RADIO_BUTTON_GROUP = "None"</Publish> + <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish> + </Control> + <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="no" Text="Cancel" Cancel="yes"> + <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> + </Control> + </Dialog> </UI> + <UIRef Id="WixUI_Common" /> + <WixVariable Id="WixUILicenseRtf" Value="Resources\assets\LICENSE.rtf" /> <WixVariable Id="WixUIDialogBmp" Value="Resources\assets\dialog_background.bmp" /> <WixVariable Id="WixUIBannerBmp" Value="Resources\assets\banner_background.bmp" /> diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb index e2b58f6432..8afcdbb590 100644 --- a/spec/functional/resource/dsc_script_spec.rb +++ b/spec/functional/resource/dsc_script_spec.rb @@ -76,6 +76,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do let(:env_value2) { "value2" } let(:dsc_test_run_context) do node = Chef::Node.new + node.automatic["os"] = "windows" node.automatic["platform"] = "windows" node.automatic["platform_version"] = "6.1" node.automatic["kernel"][:machine] = :x86_64 # Only 64-bit architecture is supported diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb index 456319c306..ce784b11ca 100644 --- a/spec/integration/recipes/recipe_dsl_spec.rb +++ b/spec/integration/recipes/recipe_dsl_spec.rb @@ -1425,6 +1425,7 @@ describe "Recipe DSL methods" do end it "my_resource fails to find a provider (and calls provides)" do + Chef::Config[:treat_deprecation_warnings_as_errors] = false my_resource = self.my_resource expect_converge do instance_eval("#{my_resource} 'foo'") @@ -1435,6 +1436,7 @@ describe "Recipe DSL methods" do context "that does not provide :my_resource" do it "my_resource fails to find a provider (and calls provides)" do + Chef::Config[:treat_deprecation_warnings_as_errors] = false my_resource = self.my_resource expect_converge do instance_eval("#{my_resource} 'foo'") @@ -1510,6 +1512,7 @@ describe "Recipe DSL methods" do end it "looks up the provider in Chef::Provider converting the resource name from snake case to camel case" do + Chef::Config[:treat_deprecation_warnings_as_errors] = false resource = nil recipe = converge do resource = lw_resource_with_hw_provider_test_case("blah") {} diff --git a/spec/support/lib/chef/provider/snakeoil.rb b/spec/support/lib/chef/provider/snakeoil.rb index a42f889e74..f7769ebfc8 100644 --- a/spec/support/lib/chef/provider/snakeoil.rb +++ b/spec/support/lib/chef/provider/snakeoil.rb @@ -19,6 +19,7 @@ class Chef class Provider class SnakeOil < Chef::Provider + provides :cat def load_current_resource true diff --git a/spec/support/lib/chef/resource/cat.rb b/spec/support/lib/chef/resource/cat.rb index f62db4d2cd..38cbd60f0b 100644 --- a/spec/support/lib/chef/resource/cat.rb +++ b/spec/support/lib/chef/resource/cat.rb @@ -19,6 +19,7 @@ class Chef class Resource class Cat < Chef::Resource + provides :cat attr_accessor :action diff --git a/spec/support/lib/chef/resource/one_two_three_four.rb b/spec/support/lib/chef/resource/one_two_three_four.rb index e46bede0fa..ef03a1133e 100644 --- a/spec/support/lib/chef/resource/one_two_three_four.rb +++ b/spec/support/lib/chef/resource/one_two_three_four.rb @@ -19,6 +19,7 @@ class Chef class Resource class OneTwoThreeFour < Chef::Resource + provides :one_two_three_four attr_reader :i_can_count diff --git a/spec/support/lib/chef/resource/openldap_includer.rb b/spec/support/lib/chef/resource/openldap_includer.rb index 5a7651b10d..356d622e38 100644 --- a/spec/support/lib/chef/resource/openldap_includer.rb +++ b/spec/support/lib/chef/resource/openldap_includer.rb @@ -19,6 +19,8 @@ class Chef class Resource class OpenldapIncluder < Chef::Resource::LWRPBase + provides :openldap_includer + allowed_actions :run default_action :run end diff --git a/spec/support/lib/chef/resource/with_state.rb b/spec/support/lib/chef/resource/with_state.rb index f256bf4984..444191da62 100644 --- a/spec/support/lib/chef/resource/with_state.rb +++ b/spec/support/lib/chef/resource/with_state.rb @@ -22,6 +22,8 @@ require "chef/json_compat" class Chef class Resource class WithState < Chef::Resource + provides :with_state + attr_accessor :state end end diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb index f5137c18ec..99d761c8cf 100644 --- a/spec/support/lib/chef/resource/zen_master.rb +++ b/spec/support/lib/chef/resource/zen_master.rb @@ -22,6 +22,7 @@ require "chef/json_compat" class Chef class Resource class ZenMaster < Chef::Resource + provides :zen_master allowed_actions :win, :score attr_reader :peace diff --git a/spec/unit/data_collector_spec.rb b/spec/unit/data_collector_spec.rb index 4ae227ba3c..f3f7ffb30f 100644 --- a/spec/unit/data_collector_spec.rb +++ b/spec/unit/data_collector_spec.rb @@ -682,4 +682,60 @@ describe Chef::DataCollector::Reporter do end end end + + describe "#detect_unprocessed_resources" do + context "when resources do not override core methods" do + it "adds resource reports for any resources that have not yet been processed" do + resource_a = Chef::Resource::Service.new("processed service") + resource_b = Chef::Resource::Service.new("unprocessed service") + + resource_a.action = [ :enable, :start ] + resource_b.action = :start + + run_context = Chef::RunContext.new(Chef::Node.new, Chef::CookbookCollection.new, nil) + run_context.resource_collection.insert(resource_a) + run_context.resource_collection.insert(resource_b) + + allow(reporter).to receive(:run_context).and_return(run_context) + + # process the actions for resource_a, but not resource_b + reporter.resource_up_to_date(resource_a, :enable) + reporter.resource_completed(resource_a) + reporter.resource_up_to_date(resource_a, :start) + reporter.resource_completed(resource_a) + expect(reporter.all_resource_reports.size).to eq(2) + + # detect unprocessed resources, which should find that resource_b has not yet been processed + reporter.send(:detect_unprocessed_resources) + expect(reporter.all_resource_reports.size).to eq(3) + end + end + + context "when a resource overrides a core method, such as #hash" do + it "does not raise an exception" do + resource_a = Chef::Resource::Service.new("processed service") + resource_b = Chef::Resource::Service.new("unprocessed service") + + resource_a.action = :start + resource_b.action = :start + + run_context = Chef::RunContext.new(Chef::Node.new, Chef::CookbookCollection.new, nil) + run_context.resource_collection.insert(resource_a) + run_context.resource_collection.insert(resource_b) + + allow(reporter).to receive(:run_context).and_return(run_context) + + # override the #hash method on resource_a to return a String instead of + # a Fixnum. Without the fix in chef/chef#5604, this would raise an + # exception when getting added to the Set/Hash. + resource_a.define_singleton_method(:hash) { "a string" } + + # process the actions for resource_a, but not resource_b + reporter.resource_up_to_date(resource_a, :start) + reporter.resource_completed(resource_a) + + expect { reporter.send(:detect_unprocessed_resources) }.not_to raise_error + end + end + end end diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index 0689d99647..9700b8ef2b 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -413,8 +413,7 @@ describe "LWRP" do resource = get_lwrp(:lwrp_foo).new("morpheus", run_context) resource.monkey("bob") resource.provider(get_lwrp_provider(:lwrp_monkey_name_printer)) - - provider = Chef::Platform.provider_for_resource(resource, :twiddle_thumbs) + provider = resource.provider_for_action(:twiddle_thumbs) provider.action_twiddle_thumbs end @@ -520,7 +519,7 @@ describe "LWRP" do resource.monkey("bob") resource.provider(get_lwrp_provider(:lwrp_monkey_name_printer)) - provider = Chef::Platform.provider_for_resource(resource, :twiddle_thumbs) + provider = resource.provider_for_action(:twiddle_thumbs) provider.action_twiddle_thumbs expect(provider.monkey_name).to eq("my monkey's name is 'bob'") @@ -531,7 +530,7 @@ describe "LWRP" do resource.monkey("bob") resource.provider(get_lwrp_provider(:lwrp_embedded_resource_accesses_providers_scope)) - provider = Chef::Platform.provider_for_resource(resource, :twiddle_thumbs) + provider = resource.provider_for_action(:twiddle_thumbs) #provider = @runner.build_provider(resource) provider.action_twiddle_thumbs diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb index 0559229d62..a3a5466c3a 100644 --- a/spec/unit/platform_spec.rb +++ b/spec/unit/platform_spec.rb @@ -31,6 +31,7 @@ describe Chef::Platform do end before(:each) do + Chef::Config[:treat_deprecation_warnings_as_errors] = false Chef::Platform.platforms = { :darwin => { ">= 10.11" => { diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb index 5ba5ddae03..ec102209ab 100644 --- a/spec/unit/provider_resolver_spec.rb +++ b/spec/unit/provider_resolver_spec.rb @@ -135,6 +135,7 @@ describe Chef::ProviderResolver do end else it "'#{name}' fails to resolve (since #{name.inspect} is unsupported on #{platform} #{platform_version})", *tags do + Chef::Config[:treat_deprecation_warnings_as_errors] = false expect(resolved_provider).to be_nil end end diff --git a/spec/unit/resource/remote_file_spec.rb b/spec/unit/resource/remote_file_spec.rb index 5fac457ebf..274f98e7f4 100644 --- a/spec/unit/resource/remote_file_spec.rb +++ b/spec/unit/resource/remote_file_spec.rb @@ -36,13 +36,13 @@ describe Chef::Resource::RemoteFile do it "says its provider is RemoteFile when the source is an absolute URI" do @resource.source("http://www.google.com/robots.txt") expect(@resource.provider).to eq(Chef::Provider::RemoteFile) - expect(Chef::Platform.find_provider(:noplatform, "noversion", @resource)).to eq(Chef::Provider::RemoteFile) + expect(@resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile) end it "says its provider is RemoteFile when the source is a network share" do @resource.source("\\\\fakey\\fakerton\\fake.txt") expect(@resource.provider).to eq(Chef::Provider::RemoteFile) - expect(Chef::Platform.find_provider(:noplatform, "noversion", @resource)).to eq(Chef::Provider::RemoteFile) + expect(@resource.provider_for_action(:create)).to be_kind_of(Chef::Provider::RemoteFile) end describe "source" do diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 68fc675b37..fbe4544c19 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -838,6 +838,8 @@ describe Chef::Resource do it "should run only_if/not_if conditionals when notified to run another action (CHEF-972)" do snitch_var1 = snitch_var2 = 0 runner = Chef::Runner.new(run_context) + + Chef::Config[:treat_deprecation_warnings_as_errors] = false Chef::Platform.set( :resource => :cat, :provider => Chef::Provider::SnakeOil diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb index c1e10a78f4..4e7f4d6671 100644 --- a/spec/unit/runner_spec.rb +++ b/spec/unit/runner_spec.rb @@ -101,6 +101,7 @@ describe Chef::Runner do context "when we fall through to old Chef::Platform resolution" do let(:provider_resolver) { Chef::ProviderResolver.new(node, first_resource, nil) } before do + Chef::Config[:treat_deprecation_warnings_as_errors] = false # set up old Chef::Platform resolution instead of provider_resolver Chef::Platform.set( :resource => :cat, diff --git a/tasks/templates/prerelease.md.erb b/tasks/templates/prerelease.md.erb index 82646e7485..0c5c55cffc 100644 --- a/tasks/templates/prerelease.md.erb +++ b/tasks/templates/prerelease.md.erb @@ -24,12 +24,3 @@ $ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v <%= @ve # In Windows Powershell . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version <%= @version %> -channel current ``` - -If you want to give this version a spin in Test Kitchen, create or add the following to a `.kitchen.local.yml` file: - -```yaml -provisioner: - product_name: chef - channel: current - product_version: <%= @version %> -``` diff --git a/tasks/templates/release.md.erb b/tasks/templates/release.md.erb index 080e77000a..2c6ff0b7c6 100644 --- a/tasks/templates/release.md.erb +++ b/tasks/templates/release.md.erb @@ -24,11 +24,3 @@ $ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v <%= @ve # In Windows Powershell . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version <%= @version %> ``` - -If you want to give this version a spin in Test Kitchen, create or add the following to a `.kitchen.local.yml` file: - -```yaml -provisioner: - product_name: chef - product_version: <%= @version %> -``` |