summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2019-12-10 18:55:17 +0900
committersawanoboly <sawanoboriyu@higanworks.com>2019-12-10 18:55:17 +0900
commit4097bb0603e3a18bb3be66f7512b2ac0ed6a96ba (patch)
treebc642637b6e5aa527a670f6d61b11ecf564bbaa8
parent98c462456079842e3c46a8e472f1b8e5a5711288 (diff)
parent4ef700e7a1543e73eca792c11b823c0c56f5b581 (diff)
downloadchef-4097bb0603e3a18bb3be66f7512b2ac0ed6a96ba.tar.gz
Merge branch 'master' into bootstrap_project
-rw-r--r--CHANGELOG.md52
-rw-r--r--Dockerfile2
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock54
-rw-r--r--RELEASE_NOTES.md14
-rw-r--r--VERSION2
-rwxr-xr-xchef-bin/bin/chef-service-manager7
-rw-r--r--chef-bin/lib/chef-bin/version.rb2
-rw-r--r--chef-config/lib/chef-config/config.rb108
-rw-r--r--chef-config/lib/chef-config/dist.rb10
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef-config/spec/unit/config_spec.rb83
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb30
-rw-r--r--chef-utils/lib/chef-utils/version.rb2
-rw-r--r--docs/dev/design_documents/how_chef_is_tested_and_built.md10
-rw-r--r--ext/win32-eventlog/Rakefile4
-rw-r--r--lib/chef/application.rb10
-rw-r--r--lib/chef/application/apply.rb4
-rw-r--r--lib/chef/application/windows_service.rb4
-rw-r--r--lib/chef/application/windows_service_manager.rb6
-rw-r--r--lib/chef/client.rb2
-rw-r--r--lib/chef/cookbook_site_streaming_uploader.rb3
-rw-r--r--lib/chef/deprecation/warnings.rb3
-rw-r--r--lib/chef/dist.rb14
-rw-r--r--lib/chef/exceptions.rb2
-rw-r--r--lib/chef/guard_interpreter/default_guard_interpreter.rb2
-rw-r--r--lib/chef/node/common_api.rb2
-rw-r--r--lib/chef/provider/apt_repository.rb3
-rw-r--r--lib/chef/provider/file.rb5
-rw-r--r--lib/chef/provider/support/yum_repo.erb2
-rw-r--r--lib/chef/provider/user/linux.rb7
-rw-r--r--lib/chef/resource/file/verification.rb5
-rw-r--r--lib/chef/shell/ext.rb2
-rw-r--r--lib/chef/version.rb2
-rw-r--r--omnibus/Gemfile.lock77
-rw-r--r--omnibus_overrides.rb2
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/shared/unit/provider/file.rb20
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb24
-rw-r--r--spec/unit/node/vivid_mash_spec.rb6
-rw-r--r--spec/unit/provider/apt_repository_spec.rb15
-rw-r--r--spec/unit/util/selinux_spec.rb2
42 files changed, 417 insertions, 193 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2bcb1c2556..4649b186ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,23 +1,56 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 15.5.14 -->
-## [v15.5.14](https://github.com/chef/chef/tree/v15.5.14) (2019-11-19)
+<!-- latest_release 15.6.10 -->
+## [v15.6.10](https://github.com/chef/chef/tree/v15.6.10) (2019-12-10)
#### Merged Pull Requests
-- Fix failures in build_essential on rhel platforms [#9111](https://github.com/chef/chef/pull/9111) ([lamont-granquist](https://github.com/lamont-granquist))
+- Bump ohai to 15.6.3 [#9152](https://github.com/chef/chef/pull/9152) ([chef-expeditor[bot]](https://github.com/chef-expeditor[bot]))
<!-- latest_release -->
-<!-- release_rollup since=15.5.9 -->
+<!-- release_rollup since=15.5.17 -->
### Changes not yet released to stable
#### Merged Pull Requests
-- Fix failures in build_essential on rhel platforms [#9111](https://github.com/chef/chef/pull/9111) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 15.5.14 -->
-- Remove bonus `.md` to fix link [#9110](https://github.com/chef/chef/pull/9110) ([btm](https://github.com/btm)) <!-- 15.5.13 -->
-- Convert reboot resource to a custom resource with descriptions [#7239](https://github.com/chef/chef/pull/7239) ([tas50](https://github.com/tas50)) <!-- 15.5.12 -->
-- Don&#39;t ship the extra rake tasks in the gem [#9104](https://github.com/chef/chef/pull/9104) ([tas50](https://github.com/tas50)) <!-- 15.5.11 -->
-- Improve input validation on windows_package [#9102](https://github.com/chef/chef/pull/9102) ([tas50](https://github.com/tas50)) <!-- 15.5.10 -->
+- Bump ohai to 15.6.3 [#9152](https://github.com/chef/chef/pull/9152) ([chef-expeditor[bot]](https://github.com/chef-expeditor[bot])) <!-- 15.6.10 -->
+- Remove duplicate constant for Chef::Dist::SHORT [#9150](https://github.com/chef/chef/pull/9150) ([bobchaos](https://github.com/bobchaos)) <!-- 15.6.9 -->
+- Add a new distro constant for chef-apply [#9149](https://github.com/chef/chef/pull/9149) ([bobchaos](https://github.com/bobchaos)) <!-- 15.6.8 -->
+- Add output for the file provider verification [#9039](https://github.com/chef/chef/pull/9039) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 15.6.7 -->
+- Fix apt_repository uri single/double quotes and spaces [#9036](https://github.com/chef/chef/pull/9036) ([vsingh-msys](https://github.com/vsingh-msys)) <!-- 15.6.6 -->
+- Fix for ChefConfig should expand relative paths [#9042](https://github.com/chef/chef/pull/9042) ([kapilchouhan99](https://github.com/kapilchouhan99)) <!-- 15.6.5 -->
+- Replace hardcoded /etc/chef with Chef::Dist::CONF_DIR [#9060](https://github.com/chef/chef/pull/9060) ([bobchaos](https://github.com/bobchaos)) <!-- 15.6.4 -->
+- Symbolize config for ssl_verify_mode in credentials [#9064](https://github.com/chef/chef/pull/9064) ([teknofire](https://github.com/teknofire)) <!-- 15.6.3 -->
+- Specify item path in Node.read! error message [#9147](https://github.com/chef/chef/pull/9147) ([zeusttu](https://github.com/zeusttu)) <!-- 15.6.2 -->
+- bump omnibus-software + rhel6 fix [#9145](https://github.com/chef/chef/pull/9145) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 15.6.1 -->
+- Update ruby_prof to 1.0 [#9130](https://github.com/chef/chef/pull/9130) ([tas50](https://github.com/tas50)) <!-- 15.6.0 -->
+- Update omnnibus-software to add further ruby cleanup [#9141](https://github.com/chef/chef/pull/9141) ([tas50](https://github.com/tas50)) <!-- 15.5.26 -->
+- Bump Omnibus to the latest [#9138](https://github.com/chef/chef/pull/9138) ([tas50](https://github.com/tas50)) <!-- 15.5.25 -->
+- Update Ohai and pull in Ruby perf improvements [#9137](https://github.com/chef/chef/pull/9137) ([tas50](https://github.com/tas50)) <!-- 15.5.24 -->
+- Bump omnibus-software to remove libtool+pkg-config [#9136](https://github.com/chef/chef/pull/9136) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 15.5.23 -->
+- Resolve non-zero &quot;success&quot; error code issues with linux_user re… [#9105](https://github.com/chef/chef/pull/9105) ([skippyj](https://github.com/skippyj)) <!-- 15.5.22 -->
+- Tiny spelling typo and grammar [#9135](https://github.com/chef/chef/pull/9135) ([ehershey](https://github.com/ehershey)) <!-- 15.5.21 -->
+- [yum_repository] Add indentation for multiple baseurls [#9134](https://github.com/chef/chef/pull/9134) ([bugok](https://github.com/bugok)) <!-- 15.5.20 -->
+- restoring correct value to windows event source [#9117](https://github.com/chef/chef/pull/9117) ([bobchaos](https://github.com/bobchaos)) <!-- 15.5.19 -->
+- Spelling, punctuation, grammar [#9122](https://github.com/chef/chef/pull/9122) ([ehershey](https://github.com/ehershey)) <!-- 15.5.18 -->
<!-- release_rollup -->
<!-- latest_stable_release -->
+## [v15.5.17](https://github.com/chef/chef/tree/v15.5.17) (2019-11-21)
+<!-- latest_stable_release -->
+
+## [v15.5.16](https://github.com/chef/chef/tree/v15.5.16) (2019-11-21)
+
+#### Merged Pull Requests
+- Require relative in the win32-eventlog rakefile [#9116](https://github.com/chef/chef/pull/9116) ([tas50](https://github.com/tas50))
+
+## [v15.5.15](https://github.com/chef/chef/tree/v15.5.15) (2019-11-19)
+
+#### Merged Pull Requests
+- Improve input validation on windows_package [#9102](https://github.com/chef/chef/pull/9102) ([tas50](https://github.com/tas50))
+- Don&#39;t ship the extra rake tasks in the gem [#9104](https://github.com/chef/chef/pull/9104) ([tas50](https://github.com/tas50))
+- Convert reboot resource to a custom resource with descriptions [#7239](https://github.com/chef/chef/pull/7239) ([tas50](https://github.com/tas50))
+- Remove bonus `.md` to fix link [#9110](https://github.com/chef/chef/pull/9110) ([btm](https://github.com/btm))
+- Fix failures in build_essential on rhel platforms [#9111](https://github.com/chef/chef/pull/9111) ([lamont-granquist](https://github.com/lamont-granquist))
+- fix enforce_path_sanity being set to true [#9114](https://github.com/chef/chef/pull/9114) ([lamont-granquist](https://github.com/lamont-granquist))
+
## [v15.5.9](https://github.com/chef/chef/tree/v15.5.9) (2019-11-15)
#### Merged Pull Requests
@@ -64,7 +97,6 @@
- Bump inspec-core-bin to 4.18.39 [#9098](https://github.com/chef/chef/pull/9098) ([chef-expeditor[bot]](https://github.com/chef-expeditor[bot]))
- Improve resource descriptions and the rake task for docs generation [#9097](https://github.com/chef/chef/pull/9097) ([tas50](https://github.com/tas50))
- Add Chef Infra Client 15.5. release notes [#9089](https://github.com/chef/chef/pull/9089) ([tas50](https://github.com/tas50))
-<!-- latest_stable_release -->
## [v15.4.45](https://github.com/chef/chef/tree/v15.4.45) (2019-10-15)
diff --git a/Dockerfile b/Dockerfile
index 238686f033..2243848e23 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -20,7 +20,7 @@ LABEL maintainer="Chef Software, Inc. <docker@chef.io>"
ARG EXPEDITOR_CHANNEL
ARG CHANNEL=stable
ARG EXPEDITOR_VERSION
-ARG VERSION=15.5.9
+ARG VERSION=15.5.17
# Allow the build arg below to be controlled by either build arguments
ENV VERSION ${EXPEDITOR_VERSION:-${VERSION}}
diff --git a/Gemfile b/Gemfile
index 41fa898cef..464bb02685 100644
--- a/Gemfile
+++ b/Gemfile
@@ -46,7 +46,7 @@ end
# Everything except AIX
group(:ruby_prof) do
- gem "ruby-prof", "< 0.18" # 0.18 includes a x64-mingw32 gem, which doesn't load correctly. See https://github.com/ruby-prof/ruby-prof/issues/255
+ gem "ruby-prof"
end
# Everything except AIX and Windows
diff --git a/Gemfile.lock b/Gemfile.lock
index 0df28e2d1f..be30377bb7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -8,10 +8,10 @@ GIT
GIT
remote: https://github.com/chef/ohai.git
- revision: 12d0d485b09a003500feb8c5f4078f9ba8f119a9
+ revision: 4bbe44d771746b9b2eab118c9b8368ea4361f1d9
branch: master
specs:
- ohai (15.3.1)
+ ohai (15.6.3)
chef-config (>= 12.8, < 16)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
@@ -27,12 +27,12 @@ GIT
PATH
remote: .
specs:
- chef (15.5.14)
+ chef (15.6.10)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.5.14)
- chef-utils (= 15.5.14)
+ chef-config (= 15.6.10)
+ chef-utils (= 15.6.10)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -59,12 +59,12 @@ PATH
train-winrm (>= 0.2.5)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (15.5.14-universal-mingw32)
+ chef (15.6.10-universal-mingw32)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.5.14)
- chef-utils (= 15.5.14)
+ chef-config (= 15.6.10)
+ chef-utils (= 15.6.10)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -107,15 +107,15 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (15.5.14)
- chef (= 15.5.14)
+ chef-bin (15.6.10)
+ chef (= 15.6.10)
PATH
remote: chef-config
specs:
- chef-config (15.5.14)
+ chef-config (15.6.10)
addressable
- chef-utils (= 15.5.14)
+ chef-utils (= 15.6.10)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
@@ -124,7 +124,7 @@ PATH
PATH
remote: chef-utils
specs:
- chef-utils (15.5.14)
+ chef-utils (15.6.10)
GEM
remote: https://rubygems.org/
@@ -162,15 +162,15 @@ GEM
equatable (0.6.1)
erubi (1.9.0)
erubis (2.7.0)
- faraday (0.17.0)
+ faraday (0.17.1)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
fauxhai-ng (7.5.1)
net-ssh
- ffi (1.11.2)
- ffi (1.11.2-x64-mingw32)
- ffi (1.11.2-x86-mingw32)
+ ffi (1.11.3)
+ ffi (1.11.3-x64-mingw32)
+ ffi (1.11.3-x86-mingw32)
ffi-libarchive (0.4.10)
ffi (~> 1.0)
ffi-win32-extensions (1.0.3)
@@ -247,7 +247,7 @@ GEM
wmi-lite (~> 1.0)
multi_json (1.14.1)
multipart-post (2.1.1)
- necromancer (0.5.0)
+ necromancer (0.5.1)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-sftp (2.1.2)
@@ -259,7 +259,7 @@ GEM
net-ssh (>= 2.6.5)
net-ssh-gateway (>= 1.2.0)
nori (2.6.0)
- parallel (1.19.0)
+ parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
parslet (1.8.2)
@@ -311,7 +311,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
- ruby-prof (0.17.0)
+ ruby-prof (1.0.0)
ruby-progressbar (1.10.1)
ruby-shadow (2.5.0)
rubyntlm (0.6.2)
@@ -325,7 +325,7 @@ GEM
simplecov-html (0.10.2)
slop (3.6.0)
sslshake (1.3.0)
- strings (0.1.7)
+ strings (0.1.8)
strings-ansi (~> 0.1)
unicode-display_width (~> 1.5)
unicode_utils (~> 1.4)
@@ -337,8 +337,8 @@ GEM
tins (~> 1.0)
thor (0.20.3)
tins (1.22.2)
- tomlrb (1.2.8)
- train-core (3.1.4)
+ tomlrb (1.2.9)
+ train-core (3.2.0)
json (>= 1.8, < 3.0)
mixlib-shellout (>= 2.0, < 4.0)
net-scp (>= 1.2, < 3.0)
@@ -352,11 +352,11 @@ GEM
tty-cursor (~> 0.7)
tty-color (0.5.0)
tty-cursor (0.7.0)
- tty-prompt (0.19.0)
+ tty-prompt (0.20.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
- tty-reader (~> 0.6.0)
- tty-reader (0.6.0)
+ tty-reader (~> 0.7.0)
+ tty-reader (0.7.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
@@ -446,7 +446,7 @@ DEPENDENCIES
rspec-expectations (~> 3.5)
rspec-mocks (~> 3.5)
rspec_junit_formatter (~> 0.2.0)
- ruby-prof (< 0.18)
+ ruby-prof
ruby-shadow
simplecov
webmock
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 47cbf783a4..eb5afc7df6 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,6 +1,12 @@
This file holds "in progress" release notes for the current release under development and is intended for consumption by the Chef Documentation team. Please see <https://docs.chef.io/release_notes.html> for the official Chef release notes.
-# Chef Infra Client 15.5
+# Chef Infra Client 15.5.15
+
+The Chef Infra Client 15.5.15 release includes fixes for two regressions. A regression in the `build_essential` resource caused failures on `rhel` platforms and a second regression caused Chef Infra Client to fail when starting with `enforce_path_sanity` enabled. As part of this fix we've added a new property, `raise_if_unsupported`, to the `build-essential` resource. Instead of silently continuing, this property will fail a Chef Infra Client run if an unknown platform is encountered.
+
+We've also updated the `windows_package` resource. The resource will now provide better error messages if invalid options are passed to the `installer_type` property and the `checksum` property will now accept uppercase SHA256 checksums.
+
+# Chef Infra Client 15.5.9
## New Cookbook Helpers
@@ -10,7 +16,7 @@ For more information all all of the new helpers available, see the [chef-utils r
## Chefignore Improvements
-We've reworked how chefignore files are handled in `knife`, which has allowed us to close out a large number of long outstanding bugs. `knife` will now traverse all the way up the directory structure looking for a chefignore file. This means you can place a chefignore file in each cookkbook or any parent directory in your repository structure. Additionally, we have made fixes that ensure that commmands like `knife diff` and `knife cookbook upload` always honor your chefignore files.
+We've reworked how chefignore files are handled in `knife`, which has allowed us to close out a large number of long outstanding bugs. `knife` will now traverse all the way up the directory structure looking for a chefignore file. This means you can place a chefignore file in each cookbook or any parent directory in your repository structure. Additionally, we have made fixes that ensure that commands like `knife diff` and `knife cookbook upload` always honor your chefignore files.
## Windows Habitat Plan
@@ -22,7 +28,7 @@ This release of Chef Infra Client ships with several optimizations to our Ruby i
## Chef InSpec 4.18.39
-Chef InSpec has been updated from 4.17.17 to 4.18.38. This release includes a large number of bug fixes in additition to some great resource enhancements:
+Chef InSpec has been updated from 4.17.17 to 4.18.38. This release includes a large number of bug fixes in addition to some great resource enhancements:
- Inputs can now be used within a `describe.one` block
- The `service` resource now includes a `startname` property for Windows and systemd services
@@ -280,7 +286,7 @@ The `windows_task` resource has been updated to allow the `day` property to acce
### zypper_package
-The `zypper_package` package has been updated to properly upgrade packages if necessary based on the versin specified in the resource block. Thanks [@foobarbam](https://github.com/foobarbam) for this fix.
+The `zypper_package` package has been updated to properly upgrade packages if necessary based on the version specified in the resource block. Thanks [@foobarbam](https://github.com/foobarbam) for this fix.
## Platform Support Updates
diff --git a/VERSION b/VERSION
index fa05c789ed..af7d388b51 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-15.5.14 \ No newline at end of file
+15.6.10 \ No newline at end of file
diff --git a/chef-bin/bin/chef-service-manager b/chef-bin/bin/chef-service-manager
index 9021824fed..64cc043a54 100755
--- a/chef-bin/bin/chef-service-manager
+++ b/chef-bin/bin/chef-service-manager
@@ -21,12 +21,13 @@
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "chef"
require "chef/application/windows_service_manager"
+require "chef/dist"
if Chef::Platform.windows?
chef_client_service = {
- service_name: "chef-client",
- service_display_name: "Chef Client Service",
- service_description: "Runs Chef Client on regular, configurable intervals.",
+ service_name: Chef::Dist::CLIENT,
+ service_display_name: "#{Chef::Dist::PRODUCT} Service",
+ service_description: "Runs #{Chef::Dist::PRODUCT} on regular, configurable intervals.",
service_file_path: File.expand_path("../chef-windows-service", $PROGRAM_NAME),
delayed_start: true,
dependencies: ["Winmgmt"],
diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb
index 9781ce4d5d..dbc9392daf 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("../..", __FILE__)
- VERSION = "15.5.14".freeze
+ VERSION = "15.6.10".freeze
end
#
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index d1c4001739..d146051672 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -34,6 +34,7 @@ require "uri" unless defined?(URI)
require "addressable/uri" unless defined?(Addressable::URI)
require "openssl" unless defined?(OpenSSL)
require "yaml"
+require_relative "dist"
module ChefConfig
@@ -73,6 +74,31 @@ module ChefConfig
path
end
+ # On *nix, /etc/chef
+ def self.etc_chef_dir
+ path = ChefUtils.windows? ? c_chef_dir : PathHelper.join("/etc", ChefConfig::Dist::DIR_SUFFIX)
+ PathHelper.cleanpath(path)
+ end
+
+ # On *nix, /var/chef
+ def self.var_chef_dir
+ path = ChefUtils.windows? ? c_chef_dir : PathHelper.join("/var", ChefConfig::Dist::DIR_SUFFIX)
+ PathHelper.cleanpath(path)
+ end
+
+ # On *nix, the root of /var/, used to test if we can create and write in /var/chef
+ def self.var_root_dir
+ path = ChefUtils.windows? ? c_chef_dir : "/var"
+ PathHelper.cleanpath(path)
+ end
+
+ # On windows, C:/chef/
+ def self.c_chef_dir
+ drive = windows_installation_drive || "C:"
+ path = PathHelper.join(drive, ChefConfig::Dist::DIR_SUFFIX)
+ PathHelper.cleanpath(path)
+ end
+
# the drive where Chef is installed on a windows host. This is determined
# either by the drive containing the current file or by the SYSTEMDRIVE ENV
# variable
@@ -108,12 +134,20 @@ module ChefConfig
# Split including whitespace if someone does truly odd like
# --config-option "foo = bar"
key, value = option.split(/\s*=\s*/, 2)
+
# Call to_sym because Chef::Config expects only symbol keys. Also
# runs a simple parse on the string for some common types.
memo[key.to_sym] = YAML.safe_load(value)
memo
end
- merge!(extra_parsed_options)
+ set_extra_config_options(extra_parsed_options)
+ end
+ end
+
+ # We use :[]= assignment here to not bypass any coercions that happen via mixlib-config writes_value callbacks
+ def self.set_extra_config_options(extra_parsed_options)
+ extra_parsed_options.each do |key, value|
+ self[key.to_sym] = value
end
end
@@ -156,6 +190,20 @@ module ChefConfig
# properly.
configurable(:daemonize).writes_value { |v| v }
+ def self.expand_relative_paths(path)
+ unless path.nil?
+ if path.is_a?(String)
+ File.expand_path(path)
+ else
+ Array(path).map { |path| File.expand_path(path) }
+ end
+ end
+ end
+
+ configurable(:cookbook_path).writes_value { |path| expand_relative_paths(path) }
+
+ configurable(:chef_repo_path).writes_value { |path| expand_relative_paths(path) }
+
# The root where all local chef object data is stored. cookbooks, data bags,
# environments are all assumed to be in separate directories under this.
# chef-solo uses these directories for input data. knife commands
@@ -204,23 +252,23 @@ module ChefConfig
# Location of acls on disk. String or array of strings.
# Defaults to <chef_repo_path>/acls.
- default(:acl_path) { derive_path_from_chef_repo_path("acls") }
+ default(:acl_path) { derive_path_from_chef_repo_path("acls") }.writes_value { |path| expand_relative_paths(path) }
# Location of clients on disk. String or array of strings.
# Defaults to <chef_repo_path>/clients.
- default(:client_path) { derive_path_from_chef_repo_path("clients") }
+ default(:client_path) { derive_path_from_chef_repo_path("clients") }.writes_value { |path| expand_relative_paths(path) }
# Location of client keys on disk. String or array of strings.
# Defaults to <chef_repo_path>/client_keys.
- default(:client_key_path) { derive_path_from_chef_repo_path("client_keys") }
+ default(:client_key_path) { derive_path_from_chef_repo_path("client_keys") }.writes_value { |path| expand_relative_paths(path) }
# Location of containers on disk. String or array of strings.
# Defaults to <chef_repo_path>/containers.
- default(:container_path) { derive_path_from_chef_repo_path("containers") }
+ default(:container_path) { derive_path_from_chef_repo_path("containers") }.writes_value { |path| expand_relative_paths(path) }
# Location of cookbook_artifacts on disk. String or array of strings.
# Defaults to <chef_repo_path>/cookbook_artifacts.
- default(:cookbook_artifact_path) { derive_path_from_chef_repo_path("cookbook_artifacts") }
+ default(:cookbook_artifact_path) { derive_path_from_chef_repo_path("cookbook_artifacts") }.writes_value { |path| expand_relative_paths(path) }
# Location of cookbooks on disk. String or array of strings.
# Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
@@ -236,35 +284,35 @@ module ChefConfig
# Location of data bags on disk. String or array of strings.
# Defaults to <chef_repo_path>/data_bags.
- default(:data_bag_path) { derive_path_from_chef_repo_path("data_bags") }
+ default(:data_bag_path) { derive_path_from_chef_repo_path("data_bags") }.writes_value { |path| expand_relative_paths(path) }
# Location of environments on disk. String or array of strings.
# Defaults to <chef_repo_path>/environments.
- default(:environment_path) { derive_path_from_chef_repo_path("environments") }
+ default(:environment_path) { derive_path_from_chef_repo_path("environments") }.writes_value { |path| expand_relative_paths(path) }
# Location of groups on disk. String or array of strings.
# Defaults to <chef_repo_path>/groups.
- default(:group_path) { derive_path_from_chef_repo_path("groups") }
+ default(:group_path) { derive_path_from_chef_repo_path("groups") }.writes_value { |path| expand_relative_paths(path) }
# Location of nodes on disk. String or array of strings.
# Defaults to <chef_repo_path>/nodes.
- default(:node_path) { derive_path_from_chef_repo_path("nodes") }
+ default(:node_path) { derive_path_from_chef_repo_path("nodes") }.writes_value { |path| expand_relative_paths(path) }
# Location of policies on disk. String or array of strings.
# Defaults to <chef_repo_path>/policies.
- default(:policy_path) { derive_path_from_chef_repo_path("policies") }
+ default(:policy_path) { derive_path_from_chef_repo_path("policies") }.writes_value { |path| expand_relative_paths(path) }
# Location of policy_groups on disk. String or array of strings.
# Defaults to <chef_repo_path>/policy_groups.
- default(:policy_group_path) { derive_path_from_chef_repo_path("policy_groups") }
+ default(:policy_group_path) { derive_path_from_chef_repo_path("policy_groups") }.writes_value { |path| expand_relative_paths(path) }
# Location of roles on disk. String or array of strings.
# Defaults to <chef_repo_path>/roles.
- default(:role_path) { derive_path_from_chef_repo_path("roles") }
+ default(:role_path) { derive_path_from_chef_repo_path("roles") }.writes_value { |path| expand_relative_paths(path) }
# Location of users on disk. String or array of strings.
# Defaults to <chef_repo_path>/users.
- default(:user_path) { derive_path_from_chef_repo_path("users") }
+ default(:user_path) { derive_path_from_chef_repo_path("users") }.writes_value { |path| expand_relative_paths(path) }
# Turn on "path sanity" by default.
default :enforce_path_sanity, false
@@ -284,8 +332,8 @@ module ChefConfig
if local_mode
PathHelper.join(config_dir, "local-mode-cache")
else
- primary_cache_root = platform_specific_path("/var")
- primary_cache_path = platform_specific_path("/var/chef")
+ primary_cache_root = var_root_dir
+ primary_cache_path = var_chef_dir
# Use /var/chef as the cache path only if that folder exists and we can read and write
# into it, or /var exists and we can read and write into it (we'll create /var/chef later).
# Otherwise, we'll create .chef under the user's home directory and use that as
@@ -312,7 +360,7 @@ module ChefConfig
default(:checksum_path) { PathHelper.join(cache_path, "checksums") }
# Where chef's cache files should be stored
- default(:file_cache_path) { PathHelper.join(cache_path, "cache") }
+ default(:file_cache_path) { PathHelper.join(cache_path, "cache") }.writes_value { |path| expand_relative_paths(path) }
# Where backups of chef-managed files should go
default(:file_backup_path) { PathHelper.join(cache_path, "backup") }
@@ -564,6 +612,16 @@ module ChefConfig
# be validated.
default :ssl_verify_mode, :verify_peer
+ # Needed to coerce string value to a symbol when loading settings from the
+ # credentials toml files which doesn't allow ruby symbol values
+ configurable(:ssl_verify_mode).writes_value do |value|
+ if value.is_a?(String) && value[0] == ":"
+ value[1..-1].to_sym
+ else
+ value.to_sym
+ end
+ end
+
# Whether or not to verify the SSL cert for HTTPS requests to the Chef
# server API. If set to `true`, the server's cert will be validated
# regardless of the :ssl_verify_mode setting. This is set to `true` when
@@ -645,9 +703,9 @@ module ChefConfig
if chef_zero.enabled
nil
elsif target_mode?
- platform_specific_path("/etc/chef/#{target_mode.host}/client.pem")
+ PathHelper.cleanpath("#{etc_chef_dir}/#{target_mode.host}/client.pem")
else
- platform_specific_path("/etc/chef/client.pem")
+ PathHelper.cleanpath("#{etc_chef_dir}/client.pem")
end
end
@@ -669,10 +727,10 @@ module ChefConfig
# This secret is used to decrypt encrypted data bag items.
default(:encrypted_data_bag_secret) do
- if target_mode? && File.exist?(platform_specific_path("/etc/chef/#{target_mode.host}/encrypted_data_bag_secret"))
- platform_specific_path("/etc/chef/#{target_mode.host}/encrypted_data_bag_secret")
- elsif File.exist?(platform_specific_path("/etc/chef/encrypted_data_bag_secret"))
- platform_specific_path("/etc/chef/encrypted_data_bag_secret")
+ if target_mode? && File.exist?(PathHelper.cleanpath("#{etc_chef_dir}/#{target_mode.host}/encrypted_data_bag_secret"))
+ PathHelper.cleanpath("#{etc_chef_dir}/#{target_mode.host}/encrypted_data_bag_secret")
+ elsif File.exist?(PathHelper.cleanpath("#{etc_chef_dir}/encrypted_data_bag_secret"))
+ PathHelper.cleanpath("#{etc_chef_dir}/encrypted_data_bag_secret")
else
nil
end
@@ -699,7 +757,7 @@ module ChefConfig
# The `validation_key` is never used if the `client_key` exists.
#
# If chef-zero is enabled, this defaults to nil (no authentication).
- default(:validation_key) { chef_zero.enabled ? nil : platform_specific_path("/etc/chef/validation.pem") }
+ default(:validation_key) { chef_zero.enabled ? nil : PathHelper.cleanpath("#{etc_chef_dir}/validation.pem") }
default :validation_client_name do
# If the URL is set and looks like a normal Chef Server URL, extract the
# org name and use that as part of the default.
@@ -746,7 +804,7 @@ module ChefConfig
# the new (and preferred) configuration setting. If not set, knife will
# fall back to using cache_options[:path], which is deprecated but exists in
# many client configs generated by pre-Chef-11 bootstrappers.
- default(:syntax_check_cache_path) { cache_options[:path] }
+ default(:syntax_check_cache_path) { cache_options[:path] }.writes_value { |path| expand_relative_paths(path) }
# Deprecated:
# Move this to the default value of syntax_cache_path when this is removed.
diff --git a/chef-config/lib/chef-config/dist.rb b/chef-config/lib/chef-config/dist.rb
new file mode 100644
index 0000000000..01db6765fb
--- /dev/null
+++ b/chef-config/lib/chef-config/dist.rb
@@ -0,0 +1,10 @@
+module ChefConfig
+ class Dist
+ # The chef executable name. Also used in directory names.
+ EXEC = "chef".freeze
+
+ # The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
+ # "cinc" => /etc/cinc, /var/cinc, C:\\cinc
+ DIR_SUFFIX = "chef".freeze
+ end
+end
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 65e27643af..71377c09fa 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("../..", __FILE__)
- VERSION = "15.5.14".freeze
+ VERSION = "15.6.10".freeze
end
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 674246dfd1..b7f070c0fa 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -151,6 +151,38 @@ RSpec.describe ChefConfig::Config do
end
+ describe "expand relative paths" do
+ let(:current_directory) { Dir.pwd }
+
+ context "when given cookbook_path" do
+ let(:extra_config_options) { [ "cookbook_path=cookbooks/" ] }
+
+ it "expanded cookbook_path" do
+ apply_config
+ expect(described_class[:cookbook_path]).to eq("#{current_directory}/cookbooks")
+ end
+ end
+
+ context "when passes multiple config options" do
+ let(:extra_config_options) { ["data_bag_path=data_bags/", "cookbook_path=cookbooks", "chef_repo_path=."] }
+
+ it "expanded paths" do
+ apply_config
+ expect(described_class[:data_bag_path]).to eq("#{current_directory}/data_bags")
+ expect(described_class[:cookbook_path]).to eq("#{current_directory}/cookbooks")
+ expect(described_class[:chef_repo_path]).to eq("#{current_directory}")
+ end
+ end
+
+ context "when passes multiple cookbook_paths in config options" do
+ let(:extra_config_options) { ["cookbook_path=[first_cookbook, secound_cookbooks]"] }
+
+ it "expanded paths" do
+ apply_config
+ expect(described_class[:cookbook_path]).to eq(["#{current_directory}/first_cookbook", "#{current_directory}/secound_cookbooks"])
+ end
+ end
+ end
end
describe "when configuring formatters" do
@@ -196,9 +228,6 @@ RSpec.describe ChefConfig::Config do
[ false, true ].each do |is_windows|
context "On #{is_windows ? "Windows" : "Unix"}" do
- def to_platform(*args)
- ChefConfig::Config.platform_specific_path(*args)
- end
before :each do
allow(ChefUtils).to receive(:windows?).and_return(is_windows)
@@ -277,7 +306,7 @@ RSpec.describe ChefConfig::Config do
end
describe "ChefConfig::Config[:client_key]" do
- let(:path_to_client_key) { to_platform("/etc/chef") + ChefConfig::PathHelper.path_separator }
+ let(:path_to_client_key) { ChefConfig::Config.etc_chef_dir + ChefConfig::PathHelper.path_separator }
it "sets the default path to the client key" do
expect(ChefConfig::Config.client_key).to eq(path_to_client_key + "client.pem")
@@ -412,7 +441,7 @@ RSpec.describe ChefConfig::Config do
context "when /var/chef exists and is accessible" do
before do
- allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/chef")).and_return(true)
+ allow(ChefConfig::Config).to receive(:path_accessible?).with(ChefConfig::Config.var_chef_dir).and_return(true)
end
it "defaults to /var/chef" do
@@ -430,25 +459,25 @@ RSpec.describe ChefConfig::Config do
context "when /var/chef does not exist and /var is accessible" do
it "defaults to /var/chef" do
- allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(false)
- allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var")).and_return(true)
+ allow(File).to receive(:exists?).with(ChefConfig::Config.var_chef_dir).and_return(false)
+ allow(ChefConfig::Config).to receive(:path_accessible?).with(ChefConfig::Config.var_root_dir).and_return(true)
expect(ChefConfig::Config[:cache_path]).to eq(primary_cache_path)
end
end
context "when /var/chef does not exist and /var is not accessible" do
it "defaults to $HOME/.chef" do
- allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(false)
- allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var")).and_return(false)
+ allow(File).to receive(:exists?).with(ChefConfig::Config.var_chef_dir).and_return(false)
+ allow(ChefConfig::Config).to receive(:path_accessible?).with(ChefConfig::Config.var_root_dir).and_return(false)
expect(ChefConfig::Config[:cache_path]).to eq(secondary_cache_path)
end
end
context "when /var/chef exists and is not accessible" do
before do
- allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(true)
- allow(File).to receive(:readable?).with(to_platform("/var/chef")).and_return(true)
- allow(File).to receive(:writable?).with(to_platform("/var/chef")).and_return(false)
+ allow(File).to receive(:exists?).with(ChefConfig::Config.var_chef_dir).and_return(true)
+ allow(File).to receive(:readable?).with(ChefConfig::Config.var_chef_dir).and_return(true)
+ allow(File).to receive(:writable?).with(ChefConfig::Config.var_chef_dir).and_return(false)
end
it "defaults to $HOME/.chef" do
@@ -471,21 +500,21 @@ RSpec.describe ChefConfig::Config do
context "and config_dir is /a/b/c" do
before do
- ChefConfig::Config.config_dir to_platform("/a/b/c")
+ ChefConfig::Config.config_dir ChefConfig::PathHelper.cleanpath("/a/b/c")
end
it "cache_path is /a/b/c/local-mode-cache" do
- expect(ChefConfig::Config.cache_path).to eq(to_platform("/a/b/c/local-mode-cache"))
+ expect(ChefConfig::Config.cache_path).to eq(ChefConfig::PathHelper.cleanpath("/a/b/c/local-mode-cache"))
end
end
context "and config_dir is /a/b/c/" do
before do
- ChefConfig::Config.config_dir to_platform("/a/b/c/")
+ ChefConfig::Config.config_dir ChefConfig::PathHelper.cleanpath("/a/b/c/")
end
it "cache_path is /a/b/c/local-mode-cache" do
- expect(ChefConfig::Config.cache_path).to eq(to_platform("/a/b/c/local-mode-cache"))
+ expect(ChefConfig::Config.cache_path).to eq(ChefConfig::PathHelper.cleanpath("/a/b/c/local-mode-cache"))
end
end
end
@@ -651,15 +680,15 @@ RSpec.describe ChefConfig::Config do
end
it "expands the path when determining config_dir" do
- # config_dir goes through PathHelper.canonical_path, which
+ # config_dir goes through ChefConfig::PathHelper.canonical_path, which
# downcases on windows because the FS is case insensitive, so we
# have to downcase expected and actual to make the tests work.
- expect(ChefConfig::Config.config_dir.downcase).to eq(to_platform(Dir.pwd).downcase)
+ expect(ChefConfig::Config.config_dir.downcase).to eq(ChefConfig::PathHelper.cleanpath(Dir.pwd).downcase)
end
it "does not set derived paths at FS root" do
ChefConfig::Config.local_mode = true
- expect(ChefConfig::Config.cache_path.downcase).to eq(to_platform(File.join(Dir.pwd, "local-mode-cache")).downcase)
+ expect(ChefConfig::Config.cache_path.downcase).to eq(ChefConfig::PathHelper.cleanpath(File.join(Dir.pwd, "local-mode-cache")).downcase)
end
end
@@ -667,13 +696,13 @@ RSpec.describe ChefConfig::Config do
context "when the config file is /etc/chef/client.rb" do
before do
- config_location = to_platform("/etc/chef/client.rb").downcase
+ config_location = ChefConfig::PathHelper.cleanpath(ChefConfig::PathHelper.join(ChefConfig::Config.etc_chef_dir, "client.rb")).downcase
allow(File).to receive(:absolute_path).with(config_location).and_return(config_location)
ChefConfig::Config.config_file = config_location
end
it "config_dir is /etc/chef" do
- expect(ChefConfig::Config.config_dir).to eq(to_platform("/etc/chef").downcase)
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::Config.etc_chef_dir.downcase)
end
context "and chef is running in local mode" do
@@ -682,17 +711,17 @@ RSpec.describe ChefConfig::Config do
end
it "config_dir is /etc/chef" do
- expect(ChefConfig::Config.config_dir).to eq(to_platform("/etc/chef").downcase)
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::Config.etc_chef_dir.downcase)
end
end
context "when config_dir is set to /other/config/dir/" do
before do
- ChefConfig::Config.config_dir = to_platform("/other/config/dir/")
+ ChefConfig::Config.config_dir = ChefConfig::PathHelper.cleanpath("/other/config/dir/")
end
it "yields the explicit value" do
- expect(ChefConfig::Config.config_dir).to eq(to_platform("/other/config/dir/"))
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.cleanpath("/other/config/dir/"))
end
end
@@ -721,7 +750,7 @@ RSpec.describe ChefConfig::Config do
if is_windows
context "when the user's home dir is windows specific" do
before do
- ChefConfig::Config.user_home = to_platform("/home/charlie/")
+ ChefConfig::Config.user_home = ChefConfig::PathHelper.cleanpath("/home/charlie/")
end
it "config_dir is with backslashes" do
@@ -777,7 +806,7 @@ RSpec.describe ChefConfig::Config do
describe "ChefConfig::Config[:user_home]" do
it "should set when HOME is provided" do
- expected = to_platform("/home/kitten")
+ expected = ChefConfig::PathHelper.cleanpath("/home/kitten")
allow(ChefConfig::PathHelper).to receive(:home).and_return(expected)
expect(ChefConfig::Config[:user_home]).to eq(expected)
end
@@ -789,7 +818,7 @@ RSpec.describe ChefConfig::Config do
end
describe "ChefConfig::Config[:encrypted_data_bag_secret]" do
- let(:db_secret_default_path) { to_platform("/etc/chef/encrypted_data_bag_secret") }
+ let(:db_secret_default_path) { ChefConfig::PathHelper.cleanpath("#{ChefConfig::Config.etc_chef_dir}/encrypted_data_bag_secret") }
before do
allow(File).to receive(:exist?).with(db_secret_default_path).and_return(secret_exists)
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index 704c3ac2dc..3248184d77 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -583,6 +583,36 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
end
end
+ context "and ssl_verify_mode is a symbol string" do
+ let(:content) do
+ content = <<~EOH
+ [default]
+ ssl_verify_mode = ":verify_none"
+ EOH
+ content
+ end
+
+ it "raises a ConfigurationError" do
+ expect { config_loader.load_credentials }.not_to raise_error
+ expect(ChefConfig::Config.ssl_verify_mode).to eq(:verify_none)
+ end
+ end
+
+ context "and ssl_verify_mode is a string" do
+ let(:content) do
+ content = <<~EOH
+ [default]
+ ssl_verify_mode = "verify_none"
+ EOH
+ content
+ end
+
+ it "raises a ConfigurationError" do
+ expect { config_loader.load_credentials }.not_to raise_error
+ expect(ChefConfig::Config.ssl_verify_mode).to eq(:verify_none)
+ end
+ end
+
context "and has a syntax error" do
let(:content) { "<<<<<" }
diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb
index 8852f5b115..a94fe58953 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("../..", __FILE__)
- VERSION = "15.5.14".freeze
+ VERSION = "15.6.10".freeze
end
diff --git a/docs/dev/design_documents/how_chef_is_tested_and_built.md b/docs/dev/design_documents/how_chef_is_tested_and_built.md
index 06307ee366..094dd68caa 100644
--- a/docs/dev/design_documents/how_chef_is_tested_and_built.md
+++ b/docs/dev/design_documents/how_chef_is_tested_and_built.md
@@ -12,15 +12,15 @@ We can't just merge any old change, so we run various checks against your submit
- **Expeditor Config**: At Chef, we use an internal tool named Expeditor to manage our overall release process, including bumping chef versions, adding changelog entries, kicking off CI/CD jobs, and promoting artifacts. It's important that we don't break this critical component of our release process, so each PR will be checked by Expeditor to make sure the config is valid. If anything doesn't pass, Expeditor will link you to remediation steps in the Expeditor docs.
- **DCO sign-off**: Our Expeditor tool will check to make sure that every commit in your pull request has been signed off for the Developer Certificate of Origin (DCO). This gives us added legal protection above the Apache-2.0 license that we need to accept your contribution. Without this sign-off, we are unable to merge a PR.
- **Buildkite**: Buildkite is where we run the majority of our publicly available tests. Buildkite allows us to run tests in our own infrastructure while exposing the results to community members. We run 18 separate tests against each submitted PR. This includes the following tests:
- - Unit, functional, and integration tests on all supported Ruby releases. These run on Ubuntu, CentOS and openSUSE so we can make sure our functional / integration tests run on the platforms where user's consume Chef Infra.
+ - Unit, functional, and integration tests on all supported Ruby releases. These run on Ubuntu, CentOS and openSUSE so we can make sure our functional / integration tests run on the platforms where users consume Chef Infra.
- Chefstyle Ruby linting
- Unit tests from chef-sugar, chef-zero, cheffish, chefspec, and knife-windows against the chef code in your PR
- - Full Test Kitchen integration tests that covers common Chef usage on various different Linux Distros. Those integration tests run using the kitchen-dokken plugin and the dokken-images Docker containers, which do their best to replicate a real Linux system. You can see the exactly what we test here: https://github.com/chef/chef/blob/master/kitchen-tests/cookbooks/end_to_end/recipes/default.rb
+ - Full Test Kitchen integration tests that covers common Chef usage on various different Linux Distros. Those integration tests run using the kitchen-dokken plugin and the dokken-images Docker containers, which do their best to replicate a real Linux system. You can see exactly what we test here: https://github.com/chef/chef/blob/master/kitchen-tests/cookbooks/end_to_end/recipes/default.rb
- **Appveyor**: Buildkite does a great job of testing PRs against Linux hosts, but many rspec tests require a Windows system to run, and for this, we test in Appveyor. In Appveyor, we run our unit, integration, and functional specs against our supported Ruby releases, but this time, we do it on Windows.
## PR is Reviewed and Merged
-Once your pull request passes the above tests, it will need to be reviewed by at least two members of the Chef Infra project owners, approvers, or reviewers groups. For a list of owners, approvers, and reviewers, see https://github.com/chef/chef-oss-practices/blob/master/projects/chef-infra.md. GitHub will automatically assign these groups as reviewers. Reviews will happen adhoc as members in those groups have time, or during our weekly issue triage. Check the above team doc link for information on when that review takes place.
+Once your pull request passes the above tests, it will need to be reviewed by at least two members of the Chef Infra project owners, approvers, or reviewers groups. For a list of owners, approvers, and reviewers, see https://github.com/chef/chef-oss-practices/blob/master/projects/chef-infra.md. GitHub will automatically assign these groups as reviewers. Reviews will happen ad hoc as members in those groups have time, or during our weekly issue triage. Check the above team doc link for information on when that review takes place.
Your PR will be reviewed for Chef and Ruby correctness, overall design, and likelihood of impact on the community. We do our best to make sure all the changes made to Chef are high quality and easy to maintain going forward, while also having the lowest chance of negatively impacting our end users. If your PR meets that criteria, we'll merge the change into our master branch.
@@ -30,10 +30,10 @@ Every commit that we merge into Chef Infra should be ready to release. In order
## Buildkite Build / Test Pipeline
-Once the version has been incremented, Expeditor will begin a build matrix in our internal Buildkite pipeline. In Buiildkitie, we build omnibus-based system packages of Chef Infra for multiple platforms, distros, and architectures. Each of the platforms we build are those which will eventually be available on our downloads site if this build is successful and later promoted. Upon completion, builds are promoted to the `unstable` channel and are available to any system supporting our Omnitruck API (Test Kitchen, mixlib-install, etc).
+Once the version has been incremented, Expeditor will begin a build matrix in our internal Buildkite pipeline. In Buildkite, we build omnibus-based system packages of Chef Infra for multiple platforms, distros, and architectures. Each of the platforms we build are those which will eventually be available on our downloads site if this build is successful and later promoted. Upon completion, builds are promoted to the `unstable` channel and are available to any system supporting our Omnitruck API (Test Kitchen, mixlib-install, etc).
Once the builds complete, Buildkite will move to the test phase where each of these builds will be verified on all the platforms that Chef officially supports. For many build artifacts, this means the artifact tests on multiple versions of the same platform. For example, Chef is built on Windows 2012 R2, yet tests are run on 2008, 2012, 2012 R2, and 2016 to ensure full compatibility. In total, this phase includes nearly three dozen test nodes. Assuming all tests pass, the build will be promoted to the `current` channel, which is available on the downloads site, in addition to being available via the Omnitruck API.
## Releasing Chef
-Once a build has been blessed by our Buildkite gauntlet and everyone has agreed that we are ready to release, an artifact can be promoted from current to stable channels. For the complete release process see [Releasing Chef Infra Client](../how_to/releasing_chef_infra.md)
+Once a build has been blessed by our Buildkite gauntlet and everyone has agreed that we are ready to release, an artifact can be promoted from current to stable channels. For the complete release process see [Releasing Chef Infra Client](../how_to/releasing_chef_infra.md).
diff --git a/ext/win32-eventlog/Rakefile b/ext/win32-eventlog/Rakefile
index 6f59f096a3..2cf1a40896 100644
--- a/ext/win32-eventlog/Rakefile
+++ b/ext/win32-eventlog/Rakefile
@@ -2,7 +2,7 @@ require "rubygems"
require "rake"
require "mkmf"
require "erb"
-require "chef/dist"
+require_relative "../../lib/chef/dist"
desc "Building event log dll"
@@ -51,7 +51,7 @@ task register: EVT_SHARED_OBJECT do
begin
Win32::EventLog.add_event_source(
source: "Application",
- key_name: Chef::Dist::PRODUCT,
+ key_name: Chef::Dist::SHORT,
event_message_file: dll_file,
category_message_file: dll_file
)
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index a793a91909..197ae20c6d 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -343,7 +343,7 @@ class Chef
exit 0
end
end
- logger.trace "Fork successful. Waiting for new chef pid: #{pid}"
+ logger.trace "Fork successful. Waiting for new #{Chef::Dist::CLIENT} pid: #{pid}"
result = Process.waitpid2(pid)
handle_child_exit(result)
logger.trace "Forked instance successfully reaped (pid: #{pid})"
@@ -355,9 +355,9 @@ class Chef
return true if status.success?
message = if status.signaled?
- "Chef run process terminated by signal #{status.termsig} (#{Signal.list.invert[status.termsig]})"
+ "#{Chef::Dist::PRODUCT} run process terminated by signal #{status.termsig} (#{Signal.list.invert[status.termsig]})"
else
- "Chef run process exited unsuccessfully (exit code #{status.exitstatus})"
+ "#{Chef::Dist::PRODUCT} run process exited unsuccessfully (exit code #{status.exitstatus})"
end
raise Exceptions::ChildConvergeError, message
end
@@ -389,8 +389,8 @@ class Chef
chef_stacktrace_out = "Generated at #{Time.now}\n"
chef_stacktrace_out += message
- Chef::FileCache.store("chef-stacktrace.out", chef_stacktrace_out)
- logger.fatal("Stacktrace dumped to #{Chef::FileCache.load("chef-stacktrace.out", false)}")
+ Chef::FileCache.store("#{Chef::Dist::SHORT}-stacktrace.out", chef_stacktrace_out)
+ logger.fatal("Stacktrace dumped to #{Chef::FileCache.load("#{Chef::Dist::SHORT}-stacktrace.out", false)}")
logger.fatal("Please provide the contents of the stacktrace.out file if you file a bug report")
logger.debug(message)
true
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index a5fe2260db..35aefc949d 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -32,7 +32,7 @@ require "license_acceptance/cli_flags/mixlib_cli"
class Chef::Application::Apply < Chef::Application
include LicenseAcceptance::CLIFlags::MixlibCLI
- banner "Usage: chef-apply [RECIPE_FILE | -e RECIPE_TEXT | -s] [OPTIONS]"
+ banner "Usage: #{Chef::Dist::APPLY} [RECIPE_FILE | -e RECIPE_TEXT | -s] [OPTIONS]"
option :execute,
short: "-e RECIPE_TEXT",
@@ -163,7 +163,7 @@ class Chef::Application::Apply < Chef::Application
else
Chef::RunContext.new(@chef_client.node, {}, @chef_client.events)
end
- recipe = Chef::Recipe.new("(chef-apply cookbook)", "(chef-apply recipe)", run_context)
+ recipe = Chef::Recipe.new("(#{Chef::Dist::APPLY} cookbook)", "(#{Chef::Dist::APPLY} recipe)", run_context)
[recipe, run_context]
end
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 04a8812efc..ee6d0b1616 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -40,7 +40,7 @@ class Chef
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
- default: "#{ENV["SYSTEMDRIVE"]}/chef/client.rb",
+ default: "#{Chef::Config.etc_chef_dir}/client.rb",
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
option :log_location,
@@ -60,7 +60,7 @@ class Chef
description: "Set the number of seconds to wait between #{Chef::Dist::PRODUCT} runs.",
proc: lambda { |s| s.to_i }
- DEFAULT_LOG_LOCATION ||= "#{ENV["SYSTEMDRIVE"]}/chef/client.log".freeze
+ DEFAULT_LOG_LOCATION ||= "#{Chef::Config.c_chef_dir}/client.log".freeze
def service_init
@service_action_mutex = Mutex.new
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index a43c29d072..cab5111352 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -41,18 +41,18 @@ class Chef
short: "-a ACTION",
long: "--action ACTION",
default: "status",
- description: "Action to carry out on chef-service (install, uninstall, status, start, stop, pause, or resume)."
+ description: "Action to carry out on #{Chef::Dist::SHORT}-service (install, uninstall, status, start, stop, pause, or resume)."
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
- default: "#{ENV["SYSTEMDRIVE"]}/chef/client.rb",
+ default: "#{ChefConfig::Config.c_chef_dir}/client.rb",
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
option :log_location,
short: "-L LOGLOCATION",
long: "--logfile LOGLOCATION",
- description: "Set the log file location for chef-service."
+ description: "Set the log file location for #{Chef::Dist::SHORT}-service."
option :help,
short: "-h",
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 9e1859eba8..ff5dd485dc 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -250,7 +250,7 @@ class Chef
logger.info "#{Chef::Dist::CLIENT.capitalize} pid: #{Process.pid}"
logger.info "Targeting node: #{Chef::Config.target_mode.host}" if Chef::Config.target_mode?
logger.debug("#{Chef::Dist::CLIENT.capitalize} request_id: #{request_id}")
- ENV["PATH"] = ChefUtils::PathSanity.sanitized_path if Chef::Config[:enforce_path_sanity]
+ ENV["PATH"] = ChefUtils::DSL::PathSanity.sanitized_path if Chef::Config[:enforce_path_sanity]
if Chef::Config.target_mode?
get_ohai_data_remotely
diff --git a/lib/chef/cookbook_site_streaming_uploader.rb b/lib/chef/cookbook_site_streaming_uploader.rb
index dd9cf8fa39..6719ad370b 100644
--- a/lib/chef/cookbook_site_streaming_uploader.rb
+++ b/lib/chef/cookbook_site_streaming_uploader.rb
@@ -22,6 +22,7 @@ require "uri" unless defined?(URI)
require "net/http" unless defined?(Net::HTTP)
require "mixlib/authentication/signedheaderauth"
require "openssl" unless defined?(OpenSSL)
+require_relative "dist"
class Chef
# == Chef::CookbookSiteStreamingUploader
@@ -36,7 +37,7 @@ class Chef
class << self
def create_build_dir(cookbook)
- tmp_cookbook_path = Tempfile.new("chef-#{cookbook.name}-build")
+ tmp_cookbook_path = Tempfile.new("#{Chef::Dist::SHORT}-#{cookbook.name}-build")
tmp_cookbook_path.close
tmp_cookbook_dir = tmp_cookbook_path.path
File.unlink(tmp_cookbook_dir)
diff --git a/lib/chef/deprecation/warnings.rb b/lib/chef/deprecation/warnings.rb
index 7120b87f43..ae521ac48e 100644
--- a/lib/chef/deprecation/warnings.rb
+++ b/lib/chef/deprecation/warnings.rb
@@ -21,11 +21,12 @@ class Chef
module Warnings
require_relative "../version"
+ require_relative "../dist"
def add_deprecation_warnings_for(method_names)
method_names.each do |name|
define_method(name) do |*args|
- message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in Chef #{Chef::VERSION.to_i.next}."
+ message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in #{Chef::Dist::PRODUCT} #{Chef::VERSION.to_i.next}."
message << " Please update your cookbooks accordingly."
Chef.deprecated(:internal_api, message)
super(*args)
diff --git a/lib/chef/dist.rb b/lib/chef/dist.rb
index baf43c9127..d25dbff569 100644
--- a/lib/chef/dist.rb
+++ b/lib/chef/dist.rb
@@ -1,9 +1,16 @@
class Chef
class Dist
+ require "chef-config/dist"
+ require "chef-config/config"
+
# This class is not fully implemented, depending on it is not recommended!
# When referencing a product directly, like Chef (Now Chef Infra)
PRODUCT = "Chef Infra Client".freeze
+ # A short designation for the product, used in Windows event logs
+ # and some nomenclature.
+ SHORT = "chef".freeze
+
# The name of the server product
SERVER_PRODUCT = "Chef Infra Server".freeze
@@ -14,7 +21,7 @@ class Chef
AUTOMATE = "Chef Automate".freeze
# The chef executable, as in `chef gem install` or `chef generate cookbook`
- EXEC = "chef".freeze
+ EXEC = ChefConfig::Dist::EXEC.freeze
# product website address
WEBSITE = "https://chef.io".freeze
@@ -34,12 +41,15 @@ class Chef
# The chef-shell executable
SHELL = "chef-shell".freeze
+ # The chef-apply executable
+ APPLY = "chef-apply".freeze
+
# Configuration related constants
# The chef-shell configuration file
SHELL_CONF = "chef_shell.rb".freeze
# The configuration directory
- CONF_DIR = "/etc/#{Chef::Dist::EXEC}".freeze
+ CONF_DIR = ChefConfig::Config.etc_chef_dir.freeze
# The user's configuration directory
USER_CONF_DIR = ".chef".freeze
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 40d20cc3ac..d1317cec69 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -475,7 +475,7 @@ class Chef
class CookbookChefVersionMismatch < RuntimeError
def initialize(chef_version, cookbook_name, cookbook_version, *constraints)
constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(", ")
- super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on chef version #{constraint_str}, but the running chef version is #{chef_version}"
+ super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on #{Chef::Dist::PRODUCT} version #{constraint_str}, but the running #{Chef::Dist::PRODUCT} version is #{chef_version}"
end
end
diff --git a/lib/chef/guard_interpreter/default_guard_interpreter.rb b/lib/chef/guard_interpreter/default_guard_interpreter.rb
index 7ed0570291..b14b714c7d 100644
--- a/lib/chef/guard_interpreter/default_guard_interpreter.rb
+++ b/lib/chef/guard_interpreter/default_guard_interpreter.rb
@@ -23,6 +23,7 @@ class Chef
class GuardInterpreter
class DefaultGuardInterpreter
include Chef::Mixin::ShellOut
+ attr_reader :output
def initialize(command, opts)
@command = command
@@ -31,6 +32,7 @@ class Chef
def evaluate
result = shell_out(@command, default_env: false, **@command_opts)
+ @output = "STDOUT: #{result.stdout}\nSTDERR: #{result.stderr}\n"
Chef::Log.debug "Command failed: #{result.stderr}" unless result.status.success?
result.status.success?
# Timeout fails command rather than chef-client run, see:
diff --git a/lib/chef/node/common_api.rb b/lib/chef/node/common_api.rb
index 1ea1067113..388b2b5e23 100644
--- a/lib/chef/node/common_api.rb
+++ b/lib/chef/node/common_api.rb
@@ -100,7 +100,7 @@ class Chef
# non-autovivifying reader that throws an exception if the attribute does not exist
def read!(*path)
- raise Chef::Exceptions::NoSuchAttribute unless exist?(*path)
+ raise Chef::Exceptions::NoSuchAttribute.new(path.join ".") unless exist?(*path)
path.inject(self) do |memo, key|
memo[key]
diff --git a/lib/chef/provider/apt_repository.rb b/lib/chef/provider/apt_repository.rb
index 85fac1d2da..9443c58ef8 100644
--- a/lib/chef/provider/apt_repository.rb
+++ b/lib/chef/provider/apt_repository.rb
@@ -321,8 +321,7 @@ class Chef
# @return [String] complete repo config text
def build_repo(uri, distribution, components, trusted, arch, add_src = false)
uri = make_ppa_url(uri) if is_ppa_url?(uri)
-
- uri = '"' + uri + '"' unless uri.start_with?("'", '"')
+ uri = URI.escape(uri)
components = Array(components).join(" ")
options = []
options << "arch=#{arch}" if arch
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index a2b956c282..1b1f73b9d5 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -341,7 +341,10 @@ class Chef
if tempfile
new_resource.verify.each do |v|
unless v.verify(tempfile.path)
- raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? "[sensitive]" : v}"
+ backupfile = "#{Chef::Config[:file_cache_path]}/failed_validations/#{::File.basename(tempfile.path)}"
+ FileUtils.mkdir_p ::File.dirname(backupfile)
+ FileUtils.cp tempfile.path, backupfile
+ raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? "[sensitive]" : "#{v}\n#{v.output}"}\nTemporary file moved to #{backupfile}"
end
end
end
diff --git a/lib/chef/provider/support/yum_repo.erb b/lib/chef/provider/support/yum_repo.erb
index f60d8688da..7a55c1b7d2 100644
--- a/lib/chef/provider/support/yum_repo.erb
+++ b/lib/chef/provider/support/yum_repo.erb
@@ -6,7 +6,7 @@ name=<%= @config.description %>
<% if @config.baseurl %>
baseurl=<%= case @config.baseurl
when Array
- @config.baseurl.join("\n")
+ @config.baseurl.join("\n ")
else
@config.baseurl
end %>
diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb
index d27dbcabd4..224c9f9803 100644
--- a/lib/chef/provider/user/linux.rb
+++ b/lib/chef/provider/user/linux.rb
@@ -28,7 +28,12 @@ class Chef
end
def manage_user
- shell_out!("usermod", universal_options, usermod_options, new_resource.username)
+ manage_u = shell_out("usermod", universal_options, usermod_options, new_resource.username, returns: [0, 12])
+ if manage_u.exitstatus == 12 && manage_u.stderr !~ /exists/
+ raise Chef::Exceptions::User, "Unable to modify home directory for #{new_resource.username}"
+ end
+
+ manage_u.error!
end
def remove_user
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 7cd3144509..59d0981ddc 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -63,6 +63,7 @@ class Chef
class Verification
extend Chef::Mixin::DescendantsTracker
+ attr_reader :output
def self.provides(name)
@provides = name
@@ -117,7 +118,9 @@ class Chef
command = @command % { path: path }
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
- interpreter.evaluate
+ ret = interpreter.evaluate
+ @output = interpreter.output
+ ret
end
def verify_registered_verification(path, opts)
diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb
index b62b87ac6d..fd978e0aa7 100644
--- a/lib/chef/shell/ext.rb
+++ b/lib/chef/shell/ext.rb
@@ -208,7 +208,7 @@ module Shell
end
alias :halp :help
- desc "prints information about chef"
+ desc "prints information about #{Chef::Dist::PRODUCT}"
def version
puts "This is the #{Chef::Dist::SHELL}.\n" +
" #{Chef::Dist::PRODUCT} Version: #{::Chef::VERSION}\n" +
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index b800c515b2..6dec3794df 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("../..", __FILE__)
- VERSION = Chef::VersionString.new("15.5.14")
+ VERSION = Chef::VersionString.new("15.6.10")
end
#
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 13c8086a8e..570e6cb280 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/chef/omnibus
- revision: 97490bb29fc5203d32d9475b044807ecad3ef7ef
+ revision: 9fbb95fd6636a034874e9a7e3a1a02e4c8b74c2f
branch: master
specs:
- omnibus (6.1.14)
+ omnibus (6.1.18)
aws-sdk-s3 (~> 1)
chef-cleanroom (~> 1.0)
chef-sugar (>= 3.3)
@@ -18,7 +18,7 @@ GIT
GIT
remote: https://github.com/chef/omnibus-software
- revision: 53ab4169b691367dc16a317fca4426fb6563a65a
+ revision: bed563eb2e1872ab02b5cdaee07b3ef42491fd85
branch: master
specs:
omnibus-software (4.0.0)
@@ -32,17 +32,17 @@ GEM
artifactory (3.0.5)
awesome_print (1.8.0)
aws-eventstream (1.0.3)
- aws-partitions (1.240.0)
- aws-sdk-core (3.77.0)
+ aws-partitions (1.251.0)
+ aws-sdk-core (3.84.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
- aws-sdk-kms (1.25.0)
+ aws-sdk-kms (1.26.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.54.0)
- aws-sdk-core (~> 3, >= 3.77.0)
+ aws-sdk-s3 (1.59.0)
+ aws-sdk-core (~> 3, >= 3.83.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
@@ -64,11 +64,12 @@ GEM
solve (~> 4.0)
thor (>= 0.20)
builder (3.2.3)
- chef (15.2.20)
+ chef (15.5.17)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.2.20)
+ chef-config (= 15.5.17)
+ chef-utils (= 15.5.17)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -80,10 +81,10 @@ GEM
iniparse (~> 1.4)
license-acceptance (~> 1.0, >= 1.0.5)
mixlib-archive (>= 0.4, < 2.0)
- mixlib-authentication (~> 2.1)
+ mixlib-authentication (>= 2.1, < 4)
mixlib-cli (>= 2.1.1, < 3.0)
mixlib-log (>= 2.0.3, < 4.0)
- mixlib-shellout (>= 2.4, < 4.0)
+ mixlib-shellout (>= 3.0.3, < 4.0)
net-sftp (~> 2.1, >= 2.1.2)
net-ssh (>= 4.2, < 6)
net-ssh-multi (~> 1.2, >= 1.2.1)
@@ -91,14 +92,16 @@ GEM
plist (~> 3.2)
proxifier (~> 1.0)
syslog-logger (~> 1.6)
- train-core (~> 2.0, >= 2.0.12)
+ train-core (~> 3.1)
+ train-winrm (>= 0.2.5)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (15.2.20-universal-mingw32)
+ chef (15.5.17-universal-mingw32)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.2.20)
+ chef-config (= 15.5.17)
+ chef-utils (= 15.5.17)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -111,10 +114,10 @@ GEM
iso8601 (~> 0.12.1)
license-acceptance (~> 1.0, >= 1.0.5)
mixlib-archive (>= 0.4, < 2.0)
- mixlib-authentication (~> 2.1)
+ mixlib-authentication (>= 2.1, < 4)
mixlib-cli (>= 2.1.1, < 3.0)
mixlib-log (>= 2.0.3, < 4.0)
- mixlib-shellout (>= 2.4, < 4.0)
+ mixlib-shellout (>= 3.0.3, < 4.0)
net-sftp (~> 2.1, >= 2.1.2)
net-ssh (>= 4.2, < 6)
net-ssh-multi (~> 1.2, >= 1.2.1)
@@ -122,7 +125,8 @@ GEM
plist (~> 3.2)
proxifier (~> 1.0)
syslog-logger (~> 1.6)
- train-core (~> 2.0, >= 2.0.12)
+ train-core (~> 3.1)
+ train-winrm (>= 0.2.5)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
win32-api (~> 1.5.3)
@@ -137,13 +141,15 @@ GEM
win32-taskscheduler (~> 2.0)
wmi-lite (~> 1.0)
chef-cleanroom (1.0.2)
- chef-config (15.2.20)
+ chef-config (15.5.17)
addressable
+ chef-utils (= 15.5.17)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
chef-sugar (5.1.9)
+ chef-utils (15.5.17)
chef-zero (14.0.13)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 4.0)
@@ -158,11 +164,11 @@ GEM
equatable (0.6.1)
erubi (1.9.0)
erubis (2.7.0)
- faraday (0.17.0)
+ faraday (0.17.1)
multipart-post (>= 1.2, < 3)
- ffi (1.11.2)
- ffi (1.11.2-x64-mingw32)
- ffi (1.11.2-x86-mingw32)
+ ffi (1.11.3)
+ ffi (1.11.3-x64-mingw32)
+ ffi (1.11.3-x86-mingw32)
ffi-libarchive (0.4.10)
ffi (~> 1.0)
ffi-win32-extensions (1.0.3)
@@ -191,9 +197,9 @@ GEM
tomlrb (~> 1.2)
tty-box (~> 0.3)
tty-prompt (~> 0.18)
- license_scout (1.0.28)
+ license_scout (1.0.29)
ffi-yajl (~> 2.2)
- mixlib-shellout (~> 2.2)
+ mixlib-shellout (>= 2.2, < 4.0)
toml-rb (~> 1.0)
little-plugger (1.1.4)
logging (2.2.2)
@@ -204,7 +210,7 @@ GEM
mixlib-log
mixlib-archive (1.0.1-universal-mingw32)
mixlib-log
- mixlib-authentication (2.1.1)
+ mixlib-authentication (3.0.4)
mixlib-cli (2.1.1)
mixlib-config (3.0.5)
tomlrb
@@ -213,15 +219,15 @@ GEM
mixlib-versioning
thor
mixlib-log (3.0.1)
- mixlib-shellout (2.4.4)
- mixlib-shellout (2.4.4-universal-mingw32)
+ mixlib-shellout (3.0.7)
+ mixlib-shellout (3.0.7-universal-mingw32)
win32-process (~> 0.8.2)
wmi-lite (~> 1.0)
mixlib-versioning (1.2.7)
molinillo (0.6.6)
multi_json (1.14.1)
multipart-post (2.0.0)
- necromancer (0.5.0)
+ necromancer (0.5.1)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-sftp (2.1.2)
@@ -272,7 +278,7 @@ GEM
solve (4.0.2)
molinillo (~> 0.6)
semverse (>= 1.1, < 4.0)
- strings (0.1.6)
+ strings (0.1.8)
strings-ansi (~> 0.1)
unicode-display_width (~> 1.5)
unicode_utils (~> 1.4)
@@ -296,12 +302,13 @@ GEM
thor (0.20.3)
toml-rb (1.1.2)
citrus (~> 3.0, > 3.0)
- tomlrb (1.2.8)
- train-core (2.1.19)
+ tomlrb (1.2.9)
+ train-core (3.2.0)
json (>= 1.8, < 3.0)
mixlib-shellout (>= 2.0, < 4.0)
net-scp (>= 1.2, < 3.0)
net-ssh (>= 2.9, < 6.0)
+ train-winrm (0.2.5)
winrm (~> 2.0)
winrm-fs (~> 1.0)
tty-box (0.5.0)
@@ -310,11 +317,11 @@ GEM
tty-cursor (~> 0.7)
tty-color (0.5.0)
tty-cursor (0.7.0)
- tty-prompt (0.19.0)
+ tty-prompt (0.20.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
- tty-reader (~> 0.6.0)
- tty-reader (0.6.0)
+ tty-reader (~> 0.7.0)
+ tty-reader (0.7.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb
index 81737b43e6..8b3ec50a1a 100644
--- a/omnibus_overrides.rb
+++ b/omnibus_overrides.rb
@@ -24,7 +24,7 @@ override "util-macros", version: "1.19.0"
override "xproto", version: "7.0.28"
override "zlib", version: "1.2.11"
-# we build both a chef and ohai omnibus-software defintion which create the
+# We build both chef and ohai omnibus-software definitions which creates the
# chef-client and ohai binstubs. Out of the box the ohai definition uses whatever
# is in master, which won't match what's in the Gemfile.lock and used by the chef
# definition. This pin will ensure that ohai and chef-client commands use the
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 27cf301d67..3154e2f255 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -123,8 +123,10 @@ RSpec.configure do |config|
config.filter_run_excluding external: true
# Explicitly disable :should syntax
+ # And set max_formatted_output_length to nil to prevent RSpec from doing truncation.
config.expect_with :rspec do |c|
c.syntax = :expect
+ c.max_formatted_output_length = nil
end
config.mock_with :rspec do |c|
c.syntax = :expect
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 36b19675c2..3df8eecc6f 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -458,14 +458,24 @@ shared_examples_for Chef::Provider::File do
end
context "do_validate_content" do
- before { setup_normal_file }
+ let(:tempfile_name) { "foo-bar-baz" }
+ let(:backupfile) { "/tmp/failed_validations/#{tempfile_name}" }
let(:tempfile) do
- t = double("Tempfile", path: "/tmp/foo-bar-baz", closed?: true)
+ t = double("Tempfile", path: "/tmp/#{tempfile_name}", closed?: true)
allow(content).to receive(:tempfile).and_return(t)
t
end
+ before do
+ Chef::Config[:file_cache_path] = "/tmp"
+ allow(File).to receive(:dirname).and_return(tempfile)
+ allow(File).to receive(:basename).and_return(tempfile_name)
+ allow(FileUtils).to receive(:mkdir_p).and_return(true)
+ allow(FileUtils).to receive(:cp).and_return(true)
+ setup_normal_file
+ end
+
context "with user-supplied verifications" do
it "calls #verify on each verification with tempfile path" do
provider.new_resource.verify windows? ? "REM" : "true"
@@ -477,7 +487,8 @@ shared_examples_for Chef::Provider::File do
allow(File).to receive(:directory?).with("C:\\Windows\\system32/cmd.exe").and_return(false)
provider.new_resource.verify windows? ? "REM" : "true"
provider.new_resource.verify windows? ? "cmd.exe /c exit 1" : "false"
- expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, "Proposed content for #{provider.new_resource.path} failed verification #{windows? ? "cmd.exe /c exit 1" : "false"}")
+ msg = "Proposed content for #{provider.new_resource.path} failed verification #{windows? ? "cmd.exe /c exit 1" : "false"}"
+ expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, /#{msg}/)
end
it "does not show verification for sensitive resources" do
@@ -485,7 +496,8 @@ shared_examples_for Chef::Provider::File do
provider.new_resource.verify windows? ? "REM" : "true"
provider.new_resource.verify windows? ? "cmd.exe /c exit 1" : "false"
provider.new_resource.sensitive true
- expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, "Proposed content for #{provider.new_resource.path} failed verification [sensitive]")
+ msg = "Proposed content for #{provider.new_resource.path} failed verification [sensitive]\nTemporary file moved to #{backupfile}"
+ expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, msg)
end
end
end
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index a30f543e72..99933991a9 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -159,7 +159,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-u", "1000",
"-d", "/Users/mud",
"-m",
- "adam" ])
+ "adam"])
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.create_user
end
@@ -180,7 +180,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
command.concat([ "-s", "/usr/bin/zsh",
"-u", "1000",
"-r", "-m",
- "adam" ])
+ "adam"])
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.create_user
end
@@ -190,10 +190,15 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
describe "when managing a user" do
+ let(:manage_u_status) do
+ double("Mixlib::ShellOut command", exitstatus: 0, stdout: @stdout, stderr: @stderr, error!: nil)
+ end
+
before(:each) do
provider.new_resource.manage_home true
provider.new_resource.home "/Users/mud"
provider.new_resource.gid "23"
+ @stderr = ""
end
# CHEF-3423, -m must come before the username
@@ -203,8 +208,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-g", "23",
"-d", "/Users/mud",
"-m",
- "adam" ]
- expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
+ "adam"]
+ command.concat([ { returns: [0, 12] } ])
+ expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
provider.manage_user
end
@@ -214,8 +220,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-g", "23",
"-d", "/Users/mud",
"-m",
- "adam" ]
- expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
+ "adam"]
+ command.concat([ { returns: [0, 12] } ])
+ expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
provider.manage_user
end
@@ -223,8 +230,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
expect(provider).to receive(:updating_home?).at_least(:once).and_return(false)
command = ["usermod",
"-g", "23",
- "adam" ]
- expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
+ "adam"]
+ command.concat([ { returns: [0, 12] } ])
+ expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
provider.manage_user
end
end
diff --git a/spec/unit/node/vivid_mash_spec.rb b/spec/unit/node/vivid_mash_spec.rb
index 575d8c3321..098da46d70 100644
--- a/spec/unit/node/vivid_mash_spec.rb
+++ b/spec/unit/node/vivid_mash_spec.rb
@@ -163,15 +163,15 @@ describe Chef::Node::VividMash do
end
it "throws an exception when attributes do not exist" do
- expect { vivid.read!("one", "five", "six") }.to raise_error(Chef::Exceptions::NoSuchAttribute)
+ expect { vivid.read!("one", "five", "six") }.to raise_error(Chef::Exceptions::NoSuchAttribute, "one.five.six")
end
it "throws an exception when traversing a non-container" do
- expect { vivid.read!("one", "two", "three", "four") }.to raise_error(Chef::Exceptions::NoSuchAttribute)
+ expect { vivid.read!("one", "two", "three", "four") }.to raise_error(Chef::Exceptions::NoSuchAttribute, "one.two.three.four")
end
it "throws an exception when an array element does not exist" do
- expect { vivid.read!("array", 3) }.to raise_error(Chef::Exceptions::NoSuchAttribute)
+ expect { vivid.read!("array", 3) }.to raise_error(Chef::Exceptions::NoSuchAttribute, "array.3")
end
end
diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb
index 11d505dad8..7537f2a9fb 100644
--- a/spec/unit/provider/apt_repository_spec.rb
+++ b/spec/unit/provider/apt_repository_spec.rb
@@ -226,27 +226,32 @@ C5986B4F1257FFA86632CBA746181433FBB75451
describe "#build_repo" do
it "creates a repository string" do
- target = %Q{deb "http://test/uri" unstable main\n}
+ target = "deb http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil)).to eql(target)
end
+ it "creates a repository string with spaces" do
+ target = "deb http://test/uri%20with%20spaces unstable main\n"
+ expect(provider.build_repo("http://test/uri with spaces", "unstable", "main", false, nil)).to eql(target)
+ end
+
it "creates a repository string with no distribution" do
- target = %Q{deb "http://test/uri" main\n}
+ target = "deb http://test/uri main\n"
expect(provider.build_repo("http://test/uri", nil, "main", false, nil)).to eql(target)
end
it "creates a repository string with source" do
- target = %Q{deb "http://test/uri" unstable main\ndeb-src "http://test/uri" unstable main\n}
+ target = "deb http://test/uri unstable main\ndeb-src http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, true)).to eql(target)
end
it "creates a repository string with options" do
- target = %Q{deb [trusted=yes] "http://test/uri" unstable main\n}
+ target = "deb [trusted=yes] http://test/uri unstable main\n"
expect(provider.build_repo("http://test/uri", "unstable", "main", true, nil)).to eql(target)
end
it "handles a ppa repo" do
- target = %Q{deb "http://ppa.launchpad.net/chef/main/ubuntu" unstable main\n}
+ target = "deb http://ppa.launchpad.net/chef/main/ubuntu unstable main\n"
expect(provider).to receive(:make_ppa_url).with("ppa:chef/main").and_return("http://ppa.launchpad.net/chef/main/ubuntu")
expect(provider.build_repo("ppa:chef/main", "unstable", "main", false, nil)).to eql(target)
end
diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb
index 18774aee2c..55d909dae4 100644
--- a/spec/unit/util/selinux_spec.rb
+++ b/spec/unit/util/selinux_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Util::Selinux do
end
it "each part of ENV['PATH'] should be checked" do
- expected_paths = ENV["PATH"].split(File::PATH_SEPARATOR) + [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
+ expected_paths = ENV["PATH"].split(File::PATH_SEPARATOR) + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
expected_paths.uniq.each do |bin_path|
selinux_path = File.join(bin_path, "selinuxenabled")