summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-08-24 21:09:37 -0700
committerGitHub <noreply@github.com>2020-08-24 21:09:37 -0700
commit8a46c4527eb015757070156eae11869ae00f2f6b (patch)
tree7063d3cf213a5972963982c7d3463528d680ee2b
parent00f1be999ec3e72d297df0653b6f01b8cc309404 (diff)
parent437b472852e12e1334393bfe8948b3d6b7571e6c (diff)
downloadchef-8a46c4527eb015757070156eae11869ae00f2f6b.tar.gz
Merge branch 'master' into bug_sir
-rw-r--r--.expeditor/release.omnibus.yml8
-rw-r--r--CHANGELOG.md12
-rw-r--r--Gemfile.lock40
-rw-r--r--VERSION2
-rw-r--r--chef-bin/lib/chef-bin/version.rb2
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef-utils/lib/chef-utils/version.rb2
-rw-r--r--docs/dev/design_documents/client_exit_codes.md12
-rw-r--r--lib/chef/application.rb11
-rw-r--r--lib/chef/application/exit_code.rb9
-rw-r--r--lib/chef/knife/ssh.rb17
-rw-r--r--lib/chef/resource/windows_package.rb29
-rw-r--r--lib/chef/version.rb2
-rw-r--r--omnibus/Gemfile.lock40
-rw-r--r--omnibus/omnibus-test.ps125
-rw-r--r--spec/unit/application/client_spec.rb4
-rw-r--r--spec/unit/application/exit_code_spec.rb10
-rw-r--r--spec/unit/application_spec.rb10
-rw-r--r--spec/unit/knife/ssh_spec.rb4
19 files changed, 165 insertions, 76 deletions
diff --git a/.expeditor/release.omnibus.yml b/.expeditor/release.omnibus.yml
index a41ae1362c..0d8a21dd3c 100644
--- a/.expeditor/release.omnibus.yml
+++ b/.expeditor/release.omnibus.yml
@@ -27,6 +27,8 @@ builder-to-testers-map:
- el-7-ppc64
el-7-ppc64le:
- el-7-ppc64le
+ el-7-s390x:
+ - el-7-s390x
el-7-x86_64:
- el-7-x86_64
- el-8-x86_64
@@ -39,6 +41,8 @@ builder-to-testers-map:
- mac_os_x-10.14-x86_64
- mac_os_x-10.15-x86_64
- mac_os_x-11.0-x86_64
+ sles-12-s390x:
+ - sles-12-s390x
sles-12-x86_64:
- sles-12-x86_64
- sles-15-x86_64
@@ -55,8 +59,8 @@ builder-to-testers-map:
- ubuntu-16.04-x86_64
- ubuntu-18.04-x86_64
- ubuntu-20.04-x86_64
-# windows-2012r2-i386:
-# - windows-2012r2-i386
+ windows-2012r2-i386:
+ - windows-2012r2-i386
windows-2012r2-x86_64:
- windows-2012-x86_64
- windows-2012r2-x86_64
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2cd33561c6..16f57fda03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,21 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 16.5.2 -->
-## [v16.5.2](https://github.com/chef/chef/tree/v16.5.2) (2020-08-21)
+<!-- latest_release 16.5.8 -->
+## [v16.5.8](https://github.com/chef/chef/tree/v16.5.8) (2020-08-24)
#### Merged Pull Requests
-- Simplify macos detection in specs to include big sur [#10335](https://github.com/chef/chef/pull/10335) ([tas50](https://github.com/tas50))
+- separate omnibus rspec path from options [#10343](https://github.com/chef/chef/pull/10343) ([mwrock](https://github.com/mwrock))
<!-- latest_release -->
<!-- release_rollup since=16.4.41 -->
### Changes not yet released to stable
#### Merged Pull Requests
+- separate omnibus rspec path from options [#10343](https://github.com/chef/chef/pull/10343) ([mwrock](https://github.com/mwrock)) <!-- 16.5.8 -->
+- Start building S390x packages again [#10338](https://github.com/chef/chef/pull/10338) ([btm](https://github.com/btm)) <!-- 16.5.7 -->
+- Avoid knife ssh freeze on windows [#9482](https://github.com/chef/chef/pull/9482) ([dheerajd-msys](https://github.com/dheerajd-msys)) <!-- 16.5.6 -->
+- fix chocolatey and x86 windows omnibus builds [#10339](https://github.com/chef/chef/pull/10339) ([mwrock](https://github.com/mwrock)) <!-- 16.5.5 -->
+- Bump all deps to the latest for the require optimizations [#10337](https://github.com/chef/chef/pull/10337) ([tas50](https://github.com/tas50)) <!-- 16.5.4 -->
+- New exit code to signal chef-client exits due to configuration errors [#10302](https://github.com/chef/chef/pull/10302) ([NaomiReeves](https://github.com/NaomiReeves)) <!-- 16.5.3 -->
- Simplify macos detection in specs to include big sur [#10335](https://github.com/chef/chef/pull/10335) ([tas50](https://github.com/tas50)) <!-- 16.5.2 -->
- Add new chef_client_trusted_certificate resource [#10331](https://github.com/chef/chef/pull/10331) ([tas50](https://github.com/tas50)) <!-- 16.5.0 -->
<!-- release_rollup -->
diff --git a/Gemfile.lock b/Gemfile.lock
index 768aa6cfca..82a3ad27be 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -8,7 +8,7 @@ GIT
GIT
remote: https://github.com/chef/ohai.git
- revision: 66d31133c14ab890ac57ec411d657824934661ef
+ revision: 654df0481f3c35c027a9afc313c74583f3d4112f
branch: master
specs:
ohai (16.4.12)
@@ -27,12 +27,12 @@ GIT
PATH
remote: .
specs:
- chef (16.5.2)
+ chef (16.5.8)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.5.2)
- chef-utils (= 16.5.2)
+ chef-config (= 16.5.8)
+ chef-utils (= 16.5.8)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -62,12 +62,12 @@ PATH
tty-prompt (~> 0.21)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (16.5.2-universal-mingw32)
+ chef (16.5.8-universal-mingw32)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.5.2)
- chef-utils (= 16.5.2)
+ chef-config (= 16.5.8)
+ chef-utils (= 16.5.8)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -112,15 +112,15 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (16.5.2)
- chef (= 16.5.2)
+ chef-bin (16.5.8)
+ chef (= 16.5.8)
PATH
remote: chef-config
specs:
- chef-config (16.5.2)
+ chef-config (16.5.8)
addressable
- chef-utils (= 16.5.2)
+ chef-utils (= 16.5.8)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
@@ -129,7 +129,7 @@ PATH
PATH
remote: chef-utils
specs:
- chef-utils (16.5.2)
+ chef-utils (16.5.8)
GEM
remote: https://rubygems.org/
@@ -151,8 +151,8 @@ GEM
chef-config
concurrent-ruby (~> 1.0)
ffi-yajl (~> 2.2)
- chef-vault (4.0.6)
- chef-zero (15.0.1)
+ chef-vault (4.0.11)
+ chef-zero (15.0.2)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 5.0)
mixlib-log (>= 2.0, < 4.0)
@@ -244,15 +244,15 @@ GEM
little-plugger (~> 1.1)
multi_json (~> 1.14)
method_source (1.0.0)
- mixlib-archive (1.0.6)
+ mixlib-archive (1.0.7)
mixlib-log
- mixlib-archive (1.0.6-universal-mingw32)
+ mixlib-archive (1.0.7-universal-mingw32)
mixlib-log
- mixlib-authentication (3.0.6)
- mixlib-cli (2.1.6)
+ mixlib-authentication (3.0.7)
+ mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
- mixlib-log (3.0.8)
+ mixlib-log (3.0.9)
mixlib-shellout (3.1.4)
chef-utils
mixlib-shellout (3.1.4-universal-mingw32)
@@ -394,7 +394,7 @@ GEM
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
win32-api (1.5.3-universal-mingw32)
- win32-certstore (0.4.0)
+ win32-certstore (0.4.1)
ffi
mixlib-shellout
win32-event (0.6.3)
diff --git a/VERSION b/VERSION
index f5f6b51bbf..088c805bcc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-16.5.2 \ No newline at end of file
+16.5.8 \ No newline at end of file
diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb
index ca7b84938c..1feb064907 100644
--- a/chef-bin/lib/chef-bin/version.rb
+++ b/chef-bin/lib/chef-bin/version.rb
@@ -21,7 +21,7 @@
module ChefBin
CHEFBIN_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.5.2".freeze
+ VERSION = "16.5.8".freeze
end
#
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index d49845a2c1..e29472df4e 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -15,5 +15,5 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.5.2".freeze
+ VERSION = "16.5.8".freeze
end
diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb
index 5efa57755d..894fdbb3d3 100644
--- a/chef-utils/lib/chef-utils/version.rb
+++ b/chef-utils/lib/chef-utils/version.rb
@@ -15,5 +15,5 @@
module ChefUtils
CHEFUTILS_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.5.2".freeze
+ VERSION = "16.5.8".freeze
end
diff --git a/docs/dev/design_documents/client_exit_codes.md b/docs/dev/design_documents/client_exit_codes.md
index b196c531e3..63bb28a1bf 100644
--- a/docs/dev/design_documents/client_exit_codes.md
+++ b/docs/dev/design_documents/client_exit_codes.md
@@ -23,7 +23,7 @@ Chef-client exit codes signal outside tools to the result of the Chef-Client run
All exit codes defined should be usable on all supported Chef Platforms. Also, the exit codes used should be identical across all platforms. That limits the total range from 1-255. Exit codes not explicitly used by Linux/Windows are listed below. There are 59 exit codes that are available on both platforms.
* Any numbers below that have a strike-through are used below in the **Exit Codes in Use** section
* Exit Codes Available for Chef use :
- * ~~35,37,40,41,42~~,43,44,45,46,47,48,49,79,81,90,91,92,93,94,95,96,97
+ * ~~35,37,40,41,42,43~~,44,45,46,47,48,49,79,81,90,91,92,93,94,95,96,97
* 98,99,115,116,168,169,172,175,176,177,178,179,181,184,185,204,211
* ~~213~~,219,227,228,235,236,237,238,239,241,242,243,244,245
@@ -34,7 +34,7 @@ All exit codes defined should be usable on all supported Chef Platforms. Also, t
## Exit Codes in Use
-#### Reboot Requirement
+### Reboot Requirement
Exit Code | Reason | Details
------------- | ------------- |-----
@@ -42,18 +42,18 @@ Exit Code | Reason | Details
37 | Reboot Needed | Reboot needs to be completed
41 | Reboot Failed | Initiated Reboot failed - due to permissions or any other reason
-
-#### Chef Run State
+### Chef Run State
Exit Code | Reason | Details
------------- | ------------- |-----
--1 | Failed execution* | Generic error during Chef execution. On Linux this will show up as 255, on Windows as -1
+-1 | Failed execution* | Generic error during Chef execution. On Linux this will show up as 255, on Windows as -1
0 | Successful run | Any successful execution of a Chef utility should return this exit code
1 | Failed execution | Generic error during Chef execution.
2 | SIGINT received | Received an interrupt signal
3 | SIGTERM received | Received an terminate signal
42 | Audit Mode Failure | Audit mode failed, but chef converged successfully.
-213 | Chef upgrade | Chef has exited during a client upgrade
+43 | Invalid config | Exit due to invalid configuration
+213 | Client upgrade | Chef has exited during a client upgrade
* \*Next release should deprecate any use of this exit code.
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 322c10460d..257f993bbe 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -96,7 +96,11 @@ class Chef
# Parse configuration (options and config file)
def configure_chef
parse_options
- load_config_file
+ begin
+ load_config_file
+ rescue Exception => e
+ Chef::Application.fatal!(e.message, Chef::Exceptions::ConfigurationError.new)
+ end
chef_config.export_proxies
chef_config.init_openssl
File.umask chef_config[:umask]
@@ -151,8 +155,6 @@ class Chef
def apply_extra_config_options(extra_config_options)
chef_config.apply_extra_config_options(extra_config_options)
- rescue ChefConfig::UnparsableConfigOption => e
- Chef::Application.fatal!(e.message)
end
# Set the specific recipes to Chef::Config if the recipes are valid
@@ -352,7 +354,8 @@ class Chef
logger.fatal("Configuration error #{error.class}: #{error.message}")
filtered_trace = error.backtrace.grep(/#{Regexp.escape(config_file_path)}/)
filtered_trace.each { |line| logger.fatal(" " + line ) }
- Chef::Application.fatal!("Aborting due to error in '#{config_file_path}'", error)
+ raise Chef::Exceptions::ConfigurationError.new("Aborting due to error in '#{config_file_path}': #{error}")
+ # Chef::Application.fatal!("Aborting due to error in '#{config_file_path}'", Chef::Exceptions::ConfigurationError.new(error))
end
# This is a hook for testing
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb
index 3235bfadeb..ee0621f5ce 100644
--- a/lib/chef/application/exit_code.rb
+++ b/lib/chef/application/exit_code.rb
@@ -36,6 +36,7 @@ class Chef
REBOOT_NEEDED: 37,
REBOOT_FAILED: 41,
# 42 was used by audit mode and should not be reused
+ CONFIG_FAILURE: 43,
CLIENT_UPGRADED: 213,
}.freeze
@@ -79,6 +80,8 @@ class Chef
VALID_RFC_062_EXIT_CODES[:REBOOT_NEEDED]
elsif reboot_failed?(exception)
VALID_RFC_062_EXIT_CODES[:REBOOT_FAILED]
+ elsif configuration_failure?(exception)
+ VALID_RFC_062_EXIT_CODES[:CONFIG_FAILURE]
elsif client_upgraded?(exception)
VALID_RFC_062_EXIT_CODES[:CLIENT_UPGRADED]
else
@@ -104,6 +107,12 @@ class Chef
end
end
+ def configuration_failure?(exception)
+ resolve_exception_array(exception).any? do |e|
+ e.is_a? Chef::Exceptions::ConfigurationError
+ end
+ end
+
def client_upgraded?(exception)
resolve_exception_array(exception).any? do |e|
e.is_a? Chef::Exceptions::ClientUpgraded
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 5e856ec011..a6428d9726 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -358,11 +358,21 @@ class Chef
subsession ||= session
command = fixup_sudo(command)
command.force_encoding("binary") if command.respond_to?(:force_encoding)
+ begin
+ open_session(subsession, command)
+ rescue => e
+ open_session(subsession, command, true)
+ end
+ end
+
+ def open_session(subsession, command, pty = false)
+ stderr = ""
+ exit_status = 0
subsession.open_channel do |chan|
if config[:on_error] && exit_status != 0
chan.close
else
- chan.request_pty
+ chan.request_pty if pty
chan.exec command do |ch, success|
raise ArgumentError, "Cannot execute #{command}" unless success
@@ -373,6 +383,11 @@ class Chef
ichannel.send_data("#{get_password}\n")
end
end
+
+ ch.on_extended_data do |_, _type, data|
+ stderr += data
+ end
+
ch.on_request "exit-status" do |ichannel, data|
exit_status = [exit_status, data.read_long].max
end
diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb
index ba5ecd31aa..b11567311f 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -30,7 +30,30 @@ class Chef
provides(:windows_package) { true }
provides :package, os: "windows"
- description "Use the **windows_package** resource to manage packages on the Microsoft Windows platform. The windows_package resource supports these installer formats:\n\n Microsoft Installer Package (MSI)\n Nullsoft Scriptable Install System (NSIS)\n Inno Setup (inno)\n Wise\n InstallShield\n Custom installers such as installing a non-.msi file that embeds an .msi-based installer\n"
+ description <<~DESC
+ Use the **windows_package** resource to manage packages on the Microsoft Windows platform.
+ The **windows_package** resource supports these installer formats:
+ * Microsoft Installer Package (MSI)
+ * Nullsoft Scriptable Install System (NSIS)
+ * Inno Setup (inno)
+ * Wise
+ * InstallShield
+ * Custom installers such as installing a non-.msi file that embeds an .msi-based installer
+
+ To enable idempotence of the `:install` action or to enable the `:remove` action with no source property specified,
+ `package_name` MUST be an exact match of the name used by the package installer. The names of installed packages
+ Windows knows about can be found in **Add/Remove programs**, in the output of `ohai packages`, or in the
+ `DisplayName` property in one of the following in the Windows registry:
+
+ * `HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`
+ * `HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`
+ * `HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall`
+
+ Note: If there are multiple versions of a package installed with the same display name, all of those packages will
+ be removed unless a version is provided in the **version** property or unless it can be discovered in the installer
+ file specified by the **source** property.
+ DESC
+
introduced "11.12"
examples <<~DOC
**Install a package**:
@@ -135,7 +158,7 @@ class Chef
end
end),
default_description: "The resource block's name", # this property is basically a name_property but not really so we need to spell it out
- description: "The path to a package in the local file system. The location of the package may be at a URL."
+ description: "The path to a package in the local file system or the URL of a remote file that will be downloaded."
property :checksum, String,
desired_state: false, coerce: (proc { |c| c.downcase }),
@@ -143,7 +166,7 @@ class Chef
property :remote_file_attributes, Hash,
desired_state: false,
- description: "If the source package to install is at a remote location this property allows you to define a hash of properties and their value which will be used by the underlying remote_file resource, which fetches the source."
+ description: "If the source package to install is at a remote location, this property allows you to define a hash of properties which will be used by the underlying **remote_file** resource used to fetch the source."
end
end
end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index cfede9a424..1911036ec0 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require_relative "version_string"
class Chef
CHEF_ROOT = File.expand_path("..", __dir__)
- VERSION = Chef::VersionString.new("16.5.2")
+ VERSION = Chef::VersionString.new("16.5.8")
end
#
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 21679226ee..b2bf0db34b 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -32,8 +32,8 @@ GEM
artifactory (3.0.15)
awesome_print (1.8.0)
aws-eventstream (1.1.0)
- aws-partitions (1.357.0)
- aws-sdk-core (3.104.3)
+ aws-partitions (1.358.0)
+ aws-sdk-core (3.104.4)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
@@ -64,12 +64,12 @@ GEM
solve (~> 4.0)
thor (>= 0.20)
builder (3.2.4)
- chef (16.4.38)
+ chef (16.4.41)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.4.38)
- chef-utils (= 16.4.38)
+ chef-config (= 16.4.41)
+ chef-utils (= 16.4.41)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -99,12 +99,12 @@ GEM
tty-prompt (~> 0.21)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (16.4.38-universal-mingw32)
+ chef (16.4.41-universal-mingw32)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.4.38)
- chef-utils (= 16.4.38)
+ chef-config (= 16.4.41)
+ chef-utils (= 16.4.41)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -146,17 +146,17 @@ GEM
win32-taskscheduler (~> 2.0)
wmi-lite (~> 1.0)
chef-cleanroom (1.0.2)
- chef-config (16.4.38)
+ chef-config (16.4.41)
addressable
- chef-utils (= 16.4.38)
+ chef-utils (= 16.4.41)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
chef-sugar (5.1.11)
- chef-utils (16.4.38)
- chef-vault (4.0.6)
- chef-zero (15.0.1)
+ chef-utils (16.4.41)
+ chef-vault (4.0.11)
+ chef-zero (15.0.2)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 5.0)
mixlib-log (>= 2.0, < 4.0)
@@ -211,19 +211,19 @@ GEM
little-plugger (~> 1.1)
multi_json (~> 1.14)
minitar (0.9)
- mixlib-archive (1.0.6)
+ mixlib-archive (1.0.7)
mixlib-log
- mixlib-archive (1.0.6-universal-mingw32)
+ mixlib-archive (1.0.7-universal-mingw32)
mixlib-log
- mixlib-authentication (3.0.6)
- mixlib-cli (2.1.6)
+ mixlib-authentication (3.0.7)
+ mixlib-cli (2.1.8)
mixlib-config (3.0.9)
tomlrb
mixlib-install (3.12.3)
mixlib-shellout
mixlib-versioning
thor
- mixlib-log (3.0.8)
+ mixlib-log (3.0.9)
mixlib-shellout (3.1.4)
chef-utils
mixlib-shellout (3.1.4-universal-mingw32)
@@ -248,7 +248,7 @@ GEM
octokit (4.18.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
- ohai (16.4.11)
+ ohai (16.4.12)
chef-config (>= 12.8, < 17)
chef-utils (>= 16.0, < 17)
ffi (~> 1.9)
@@ -336,7 +336,7 @@ GEM
unicode_utils (1.4.0)
uuidtools (2.1.5)
win32-api (1.5.3-universal-mingw32)
- win32-certstore (0.4.0)
+ win32-certstore (0.4.1)
ffi
mixlib-shellout
win32-event (0.6.3)
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1
index 5240d8e6e3..8ca48beb69 100644
--- a/omnibus/omnibus-test.ps1
+++ b/omnibus/omnibus-test.ps1
@@ -94,5 +94,26 @@ winrm quickconfig -quiet
bundle
If ($lastexitcode -ne 0) { Exit $lastexitcode }
-bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f progress --profile --tag ~choco_installed
-If ($lastexitcode -ne 0) { Exit $lastexitcode }
+# buildkite changes the casing of the Path variable to PATH
+# It is not clear how or where that happens, but it breaks the choco
+# tests. Removing the PATH and resetting it with the expected casing
+$p = $env:PATH
+$env:PATH = $null
+$env:Path = $p
+
+# Running the specs separately fixes an edgecase on 2012R2-i386 where the desktop heap's
+# allocated limit is hit and any test's attempt to create a new process is met with
+# exit code -1073741502 (STATUS_DLL_INIT_FAILED). after much research and troubleshooting,
+# desktop heap exhaustion seems likely (https://docs.microsoft.com/en-us/archive/blogs/ntdebugging/desktop-heap-overview)
+$exit = 0
+
+bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f progress --profile -- ./spec/unit
+If ($lastexitcode -ne 0) { $exit = 1 }
+
+bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f progress --profile -- ./spec/functional
+If ($lastexitcode -ne 0) { $exit = 1 }
+
+bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f progress --profile -- ./spec/integration
+If ($lastexitcode -ne 0) { $exit = 1 }
+
+Exit $exit
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index 004debf5ad..6977e4f108 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -192,7 +192,7 @@ describe Chef::Application::Client, "reconfigure" do
context "with an empty value" do
it "should terminate with message" do
- expect(Chef::Application).to receive(:fatal!).with('Unparsable config option ""').and_raise("so ded")
+ expect(Chef::Application).to receive(:fatal!).with('Unparsable config option ""', ChefConfig::ConfigurationError.new).and_raise("so ded")
ARGV.replace(["--config-option", ""])
expect { app.reconfigure }.to raise_error "so ded"
end
@@ -200,7 +200,7 @@ describe Chef::Application::Client, "reconfigure" do
context "with an invalid value" do
it "should terminate with message" do
- expect(Chef::Application).to receive(:fatal!).with('Unparsable config option "asdf"').and_raise("so ded")
+ expect(Chef::Application).to receive(:fatal!).with('Unparsable config option "asdf"', ChefConfig::ConfigurationError.new).and_raise("so ded")
ARGV.replace(["--config-option", "asdf"])
expect { app.reconfigure }.to raise_error "so ded"
end
diff --git a/spec/unit/application/exit_code_spec.rb b/spec/unit/application/exit_code_spec.rb
index 6b025938a6..7ede9fb86d 100644
--- a/spec/unit/application/exit_code_spec.rb
+++ b/spec/unit/application/exit_code_spec.rb
@@ -61,6 +61,10 @@ describe Chef::Application::ExitCode do
expect(valid_rfc_exit_codes.include?(41)).to eq(true)
end
+ it "validates a CONFIG_FAILURE return code of 43" do
+ expect(valid_rfc_exit_codes.include?(43)).to eq(true)
+ end
+
it "validates a CLIENT_UPGRADED return code of 213" do
expect(valid_rfc_exit_codes.include?(213)).to eq(true)
end
@@ -113,6 +117,12 @@ describe Chef::Application::ExitCode do
expect(exit_codes.normalize_exit_code(runtime_error)).to eq(37)
end
+ it "returns CONFIG_FAILURE when a configuration exception is specified" do
+ config_error = Chef::Exceptions::ConfigurationError.new("BOOM")
+ runtime_error = Chef::Exceptions::RunFailedWrappingError.new(config_error)
+ expect(exit_codes.normalize_exit_code(runtime_error)).to eq(43)
+ end
+
it "returns CLIENT_UPGRADED when the client was upgraded during converge" do
client_upgraded_error = Chef::Exceptions::ClientUpgraded.new("BOOM")
runtime_error = Chef::Exceptions::RunFailedWrappingError.new(client_upgraded_error)
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index aa916d0793..b84f0c99f2 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -491,16 +491,14 @@ describe Chef::Application do
describe "configuration errors" do
before do
- expect(Process).to receive(:exit)
+ allow(Process).to receive(:exit).and_return(true)
end
def raises_informative_fatals_on_configure_chef
config_file_regexp = Regexp.new @app.config[:config_file]
- expect(Chef::Log).to receive(:fatal)
- .with(/Configuration error/)
- expect(Chef::Log).to receive(:fatal)
- .with(config_file_regexp)
- .at_least(1).times
+ expect(Chef::Log).to receive(:fatal).with(/Configuration error/)
+ expect(Chef::Log).to receive(:fatal).with(config_file_regexp)
+ expect(Process).to receive(:exit).with(43).and_return(true)
@app.configure_chef
end
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 72111eed3d..8606045e8c 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -283,10 +283,10 @@ describe Chef::Knife::Ssh do
end
describe "#ssh_command" do
- let(:execution_channel) { double(:execution_channel, on_data: nil) }
+ let(:execution_channel) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
let(:session_channel) { double(:session_channel, request_pty: nil) }
- let(:execution_channel2) { double(:execution_channel, on_data: nil) }
+ let(:execution_channel2) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
let(:session_channel2) { double(:session_channel, request_pty: nil) }
let(:session) { double(:session, loop: nil) }