summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.expeditor/verify.pipeline.yml356
-rw-r--r--CHANGELOG.md9
-rw-r--r--Gemfile.lock14
-rw-r--r--RELEASE_NOTES.md42
-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--kitchen-tests/kitchen.yml2
-rw-r--r--lib/chef/application.rb2
-rw-r--r--lib/chef/application/client.rb4
-rw-r--r--lib/chef/application/solo.rb2
-rw-r--r--lib/chef/dist.rb16
-rw-r--r--lib/chef/encrypted_data_bag_item.rb3
-rw-r--r--lib/chef/knife/bootstrap.rb53
-rw-r--r--lib/chef/knife/bootstrap/templates/chef-full.erb26
-rw-r--r--lib/chef/knife/bootstrap/train_connector.rb1
-rw-r--r--lib/chef/knife/configure.rb3
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb10
-rw-r--r--lib/chef/resource/breakpoint.rb2
-rw-r--r--lib/chef/shell.rb30
-rw-r--r--lib/chef/shell/ext.rb12
-rw-r--r--lib/chef/shell/shell_session.rb3
-rw-r--r--lib/chef/train_transport.rb5
-rw-r--r--lib/chef/version.rb2
-rwxr-xr-xscripts/bk_tests/bk_dokken_install.sh35
-rwxr-xr-xscripts/bk_tests/bk_install.sh2
-rwxr-xr-xscripts/bk_tests/bk_linux_exec.sh45
-rw-r--r--spec/functional/resource/ifconfig_spec.rb2
-rw-r--r--spec/integration/client/exit_code_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb1
-rw-r--r--spec/unit/knife/bootstrap_spec.rb90
31 files changed, 599 insertions, 181 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml
index 86ff934af0..9df22e231d 100644
--- a/.expeditor/verify.pipeline.yml
+++ b/.expeditor/verify.pipeline.yml
@@ -1,39 +1,43 @@
+---
+expeditor:
+ defaults:
+ buildkite:
+ timeout_in_minutes: 30
+
steps:
#########################################################################
# Tests Ruby 2.6
#########################################################################
-# - label: "Integration Specs :ruby: 2.6"
-# commands:
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6
-# - cp /etc/hosts.noip6 /etc/hosts
-# - cd /workdir; bundle install --without docgen integration omnibus_package --frozen
-# - bundle exec rake spec:integration
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - FORCE_FFI_YAJL=ext
-# - CHEF_LICENSE=accept-no-persist
-# - INTEGRATION_SPECS_26=1
-# - BUNDLE_GEMFILE=/workdir/Gemfile
-#
-# - label: "Functional Specs :ruby: 2.6"
-# commands:
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6
-# - cp /etc/hosts.noip6 /etc/hosts
-# - cd /workdir; bundle install --without docgen integration omnibus_package --frozen
-# - bundle exec rake spec:functional
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - FORCE_FFI_YAJL=ext
-# - CHEF_LICENSE=accept-no-persist
-# - FUNCTIONAL_SPECS_26=1
+- label: "Integration Specs :ruby: 2.6"
+ commands:
+ - /workdir/scripts/bk_tests/bk_install.sh
+ - cd /workdir; bundle install --without docgen integration omnibus_package --frozen --path vendor/bundle
+ - bundle exec rake spec:integration
+ expeditor:
+ executor:
+ docker:
+ privileged: true
+ environment:
+ - FORCE_FFI_YAJL=ext
+ - CHEF_LICENSE=accept-no-persist
+ - INTEGRATION_SPECS_26=1
+ - BUNDLE_GEMFILE=/workdir/Gemfile
+
+- label: "Functional Specs :ruby: 2.6"
+ commands:
+ - /workdir/scripts/bk_tests/bk_install.sh
+ - cd /workdir; bundle install --without docgen integration omnibus_package --frozen --path vendor/bundle
+ - bundle exec rake spec:functional
+ expeditor:
+ executor:
+ docker:
+ privileged: true
+ environment:
+ - FORCE_FFI_YAJL=ext
+ - CHEF_LICENSE=accept-no-persist
+ - FUNCTIONAL_SPECS_26=1
- label: "Unit Specs :ruby: 2.6"
commands:
@@ -106,17 +110,6 @@ steps:
environment:
- TEST_GEM=chefspec/chefspec
-# - label: "Test poise/halite gem :ruby: 2.6"
-# commands:
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - bundle install --jobs=3 --retry=3 --deployment --path=vendor/bundle
-# - bundle exec tasks/bin/run_external_test poise/halite master rake spec
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - TEST_GEM=poise/halite
-
- label: "Test knife-windows gem :ruby: 2.6"
commands:
- /workdir/scripts/bk_tests/bk_install.sh
@@ -132,37 +125,35 @@ steps:
# Tests Ruby 2.5
#########################################################################
-# - label: "Integration Specs :ruby: 2.5"
-# commands:
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - asdf local ruby 2.5.5
-# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6
-# - cp /etc/hosts.noip6 /etc/hosts
-# - bundle install --without docgen integration omnibus_package --frozen
-# - bundle exec rake spec:integration
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - FORCE_FFI_YAJL=ext
-# - CHEF_LICENSE=accept-no-persist
-# - INTEGRATION_SPECS_25=1
+- label: "Integration Specs :ruby: 2.5"
+ commands:
+ - /workdir/scripts/bk_tests/bk_install.sh
+ - asdf local ruby 2.5.5
+ - bundle install --without docgen integration omnibus_package --frozen
+ - bundle exec rake spec:integration
+ expeditor:
+ executor:
+ docker:
+ privileged: true
+ environment:
+ - FORCE_FFI_YAJL=ext
+ - CHEF_LICENSE=accept-no-persist
+ - INTEGRATION_SPECS_25=1
#
-# - label: "Functional Specs :ruby: 2.5"
-# commands:
-# - asdf local ruby 2.5.5
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6
-# - cp /etc/hosts.noip6 /etc/hosts
-# - bundle install --without docgen integration omnibus_package --frozen
-# - bundle exec rake spec:functional
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - FORCE_FFI_YAJL=ext
-# - CHEF_LICENSE=accept-no-persist
-# - FUNCTIONAL_SPECS_25=1
+- label: "Functional Specs :ruby: 2.5"
+ commands:
+ - asdf local ruby 2.5.5
+ - /workdir/scripts/bk_tests/bk_install.sh
+ - bundle install --without docgen integration omnibus_package --frozen
+ - bundle exec rake spec:functional
+ expeditor:
+ executor:
+ docker:
+ privileged: true
+ environment:
+ - FORCE_FFI_YAJL=ext
+ - CHEF_LICENSE=accept-no-persist
+ - FUNCTIONAL_SPECS_25=1
- label: "Unit Specs :ruby: 2.5"
commands:
@@ -183,19 +174,210 @@ steps:
# START TEST KITCHEN ONLY
#########################################################################
-# - label: "Kitchen Tests :ruby: 2.5"
-# commands:
-# - /workdir/scripts/bk_tests/bk_install.sh
-# - asdf local ruby 2.5.5
-# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6
-# - cp /etc/hosts.noip6 /etc/hosts
-# - cd /workdir/kitchen-tests
-# - bundle install --jobs=3 --retry=3 --path=vendor/bundle
-# - bundle exec kitchen test end-to-end-amazonlinux-2
-# expeditor:
-# executor:
-# docker:
-# environment:
-# - AMAZON=2
-# - KITCHEN_YAML=/workdir/kitchen-tests/kitchen.bk.yml
-# - BUNDLE_GEMFILE=/workdir/kitchen-tests/Gemfile
+- label: "Kitchen Tests :amazon: 2 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-amazonlinux-2
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ AMAZON: "2"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests :amazon: 201X :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-amazonlinux-2
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ AMAZON: 201X
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Ubuntu: 16.04 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-1604
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ UBUNTU: "16.04"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Ubuntu: 18.04 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-1804
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ UBUNTU: "18.04"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Debian: 8 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-8
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ DEBIAN: "8"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Debian: 9 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-9
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ DEBIAN: "9"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Debian: 10 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-10
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ DEBIAN: "10"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Centos: 6 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-centos-6
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ CENTOS: "6"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Centos: 7 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-centos-7
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ CENTOS: "7"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Fedora: latest :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-fedora-latest
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ FEDORA: "latest"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests OPENSUSELEAP: 42 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test end-to-end-opensuse-leap
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ OPENSUSELEAP: "42"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Rspec Centos: 7 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test rspec-centos-7
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ RSPEC_CENTOS: "7"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
+
+- label: "Kitchen Tests Rspec OPENSUSELEAP: 42 :ruby: 2.5"
+ commands:
+ - scripts/bk_tests/bk_linux_exec.sh
+ - cd kitchen-tests
+ - ~/.asdf/shims/bundle exec kitchen test rspec-opensuse-leap\
+ artifact_paths:
+ - $PWD/.kitchen/logs/kitchen.log
+ env:
+ RSPEC_OPENSUSELEAP: "42"
+ KITCHEN_YAML: kitchen.yml
+ expeditor:
+ executor:
+ linux:
+ privileged: true
+ single-use: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6ea9804e3..8663403465 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,18 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 15.1.0 -->
-## [v15.1.0](https://github.com/chef/chef/tree/v15.1.0) (2019-06-03)
+<!-- latest_release 15.1.3 -->
+## [v15.1.3](https://github.com/chef/chef/tree/v15.1.3) (2019-06-05)
#### Merged Pull Requests
-- Add hooks for plugins in knife bootstrap [#8628](https://github.com/chef/chef/pull/8628) ([btm](https://github.com/btm))
+- Chef-15: Added deprecation check for short arguments [#8626](https://github.com/chef/chef/pull/8626) ([Nimesh-Msys](https://github.com/Nimesh-Msys))
<!-- latest_release -->
<!-- release_rollup since=15.0.300 -->
### Changes not yet released to rubygems.org
#### Merged Pull Requests
+- Chef-15: Added deprecation check for short arguments [#8626](https://github.com/chef/chef/pull/8626) ([Nimesh-Msys](https://github.com/Nimesh-Msys)) <!-- 15.1.3 -->
+- more distro constants [#8630](https://github.com/chef/chef/pull/8630) ([bobchaos](https://github.com/bobchaos)) <!-- 15.1.2 -->
+- Create bootstrap template in binmode to fix line endings [#8631](https://github.com/chef/chef/pull/8631) ([btm](https://github.com/btm)) <!-- 15.1.1 -->
- Add hooks for plugins in knife bootstrap [#8628](https://github.com/chef/chef/pull/8628) ([btm](https://github.com/btm)) <!-- 15.1.0 -->
- Raise knife exceptions when verbosity is 3 (-VVV) [#8618](https://github.com/chef/chef/pull/8618) ([btm](https://github.com/btm)) <!-- 15.0.325 -->
- Trace output the actual bootstrap template filename [#8619](https://github.com/chef/chef/pull/8619) ([btm](https://github.com/btm)) <!-- 15.0.324 -->
diff --git a/Gemfile.lock b/Gemfile.lock
index 2fe70964d0..424db7d77e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -27,11 +27,11 @@ GIT
PATH
remote: .
specs:
- chef (15.1.0)
+ chef (15.1.3)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.1.0)
+ chef-config (= 15.1.3)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -57,11 +57,11 @@ PATH
train-core (~> 2.0, >= 2.0.12)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (15.1.0-universal-mingw32)
+ chef (15.1.3-universal-mingw32)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
- chef-config (= 15.1.0)
+ chef-config (= 15.1.3)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
@@ -103,13 +103,13 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (15.1.0)
- chef (= 15.1.0)
+ chef-bin (15.1.3)
+ chef (= 15.1.3)
PATH
remote: chef-config
specs:
- chef-config (15.1.0)
+ chef-config (15.1.3)
addressable
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index c2a140e407..bfcac301f4 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -423,6 +423,47 @@ The `refresh_plugins` method in the `Ohai::System` class has been removed as it
The `Virtualization` plugin will no longer detect systems running on the circa ~2005 VirtualPC or VirtualServer hypervisors. These hypervisors were long ago deprecated by Microsoft and support can no longer be tested.
+# Chef Infra Client Release Notes 14.13:
+
+## Updated Resources
+
+### directory
+
+The `directory` has been updated to properly set the `deny_rights` permission on Windows. Thanks [@merlinjim](https://github.com/merlinjim) for reporting this issue.
+
+### service
+
+The `service` resource is now idempotent on SLES 11 systems. Thanks [@gsingla294](https://github.com/gsingla294) for reporting this issue.
+
+### cron
+
+The `cron` resource has been updated to advise users to use the specify properties rather than passing values in as part of the `environment` property. This avoids a situation where a user could pass the differing values in both locations and receive unexpected results.
+
+### link
+
+The `link` resource includes improved logging upon failure to help you debug what has failed. Thanks [@jaymzh](https://github.com/jaymzh) for this improvement.
+
+### template
+
+The `template` resource now includes additional information when templating failures, which is particularly useful in ChefSpec. Thanks [@brodock](https://github.com/brodock) for this improvement.
+
+## delete_resource Fix
+
+The `delete_resource` helper now works properly when the resource you are attempting to delete has multiple providers. Thanks [@artem-sidorenko](https://github.com/artem-sidorenko) for this fix.
+
+## Helpers Help Everywhere
+
+Various helpers have been moved into Chef Infra Client's `universal` class, which makes them available anywhere in your cookbook, not just recipes. If you've ever been confused why something like `search`, `powershell_out`, or `data_bag_item` didn't work somewhere in your code, that should be resolved now.
+
+## Deprecations
+
+The `CHEF-25` deprecation for resource collisions between cookbooks and resources in Chef Infra Client has been removed. Instead you will see a log warning that a collision has occurred, which advises you to update your run_list or cookbooks.
+
+## Updated Components
+
+- openssl 1.0.2r -> 1.0.2s (bugfix only release)
+- cacerts 2019-01-23 -> 2019-05-15
+
# Chef Infra Client Release Notes 14.12:
## Updated Resources
@@ -441,7 +482,6 @@ The windows_certificate resource now imports nested certificates while importing
- ruby 2.5.3 -> 2.5.5
- InSpec 3.7.1 -> 3.9.0
- The unused windows-api gem is no longer bundled with Chef on Windows hosts
-
# Chef Infra Client Release Notes 14.11:
## Updated Resources
diff --git a/VERSION b/VERSION
index 3dc9b03620..a9e1108673 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-15.1.0 \ No newline at end of file
+15.1.3 \ 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 97478f8202..5d79e30e50 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.1.0".freeze
+ VERSION = "15.1.3".freeze
end
#
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index c7e9743d14..21e0a5e956 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -21,7 +21,7 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "15.1.0".freeze
+ VERSION = "15.1.3".freeze
end
#
diff --git a/kitchen-tests/kitchen.yml b/kitchen-tests/kitchen.yml
index ee157926f6..944767eada 100644
--- a/kitchen-tests/kitchen.yml
+++ b/kitchen-tests/kitchen.yml
@@ -21,7 +21,7 @@ lifecycle:
- remote: /opt/chef/embedded/bin/ohai -v
- remote: /opt/chef/embedded/bin/gem install appbundler appbundle-updater
- remote: /opt/chef/embedded/bin/appbundle-updater chef ohai <%= File.readlines('../Gemfile.lock', File.expand_path(File.dirname(__FILE__))).find { |l| l =~ /^\s+ohai \((\d+\.\d+\.\d+)\)/ }; 'v' + $1 %> --tarball --github chef/ohai
- - remote: /opt/chef/embedded/bin/appbundle-updater chef chef <%= ENV['TRAVIS_COMMIT'] || %x(git rev-parse HEAD).chomp %> --tarball --github chef/chef
+ - remote: /opt/chef/embedded/bin/appbundle-updater chef chef <%= ENV['BUILDKITE_COMMIT'] || %x(git rev-parse HEAD).chomp %> --tarball --github chef/chef
- remote: echo "Installed Chef / Ohai release:"
- remote: /opt/chef/embedded/bin/chef-client -v
- remote: /opt/chef/embedded/bin/ohai -v
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 908ab3ea75..0b4ae139d7 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -331,7 +331,7 @@ class Chef
" finishing converge to exit normally (send SIGINT to terminate immediately)")
end
- client_solo = chef_config[:solo] ? "chef-solo" : "#{Chef::Dist::CLIENT}"
+ client_solo = chef_config[:solo] ? "#{Chef::Dist::SOLOEXEC}" : "#{Chef::Dist::CLIENT}"
$0 = "#{client_solo} worker: ppid=#{Process.ppid};start=#{Time.new.strftime("%R:%S")};"
begin
logger.trace "Forked instance now converging"
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 6363b9cdc7..d3e9a77646 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -352,7 +352,7 @@ class Chef::Application::Client < Chef::Application
tarball_path = File.join(Chef::Config.chef_repo_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
Mixlib::Archive.new(tarball_path).extract(Chef::Config.chef_repo_path, perms: false, ignore: /^\.$/)
- config_path = File.join(Chef::Config.chef_repo_path, ".chef/config.rb")
+ config_path = File.join(Chef::Config.chef_repo_path, "#{Chef::Dist::USER_CONF_DIR}/config.rb")
Chef::Config.from_string(IO.read(config_path), config_path) if File.file?(config_path)
end
end
@@ -395,7 +395,7 @@ class Chef::Application::Client < Chef::Application
if config[:local_mode]
config[:config_file] = Chef::WorkstationConfigLoader.new(nil, Chef::Log).config_location
else
- config[:config_file] = Chef::Config.platform_specific_path("/etc/chef/client.rb")
+ config[:config_file] = Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/client.rb")
end
end
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 5cb6e56807..29ee56a7e4 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -40,7 +40,7 @@ class Chef::Application::Solo < Chef::Application
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
- default: Chef::Config.platform_specific_path("/etc/chef/solo.rb"),
+ default: Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/solo.rb"),
description: "The configuration file to use."
option :config_option,
diff --git a/lib/chef/dist.rb b/lib/chef/dist.rb
index f0b0f9b375..baf43c9127 100644
--- a/lib/chef/dist.rb
+++ b/lib/chef/dist.rb
@@ -30,5 +30,21 @@ class Chef
# The chef-solo executable (legacy local mode)
SOLOEXEC = "chef-solo".freeze
+
+ # The chef-shell executable
+ SHELL = "chef-shell".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
+
+ # The user's configuration directory
+ USER_CONF_DIR = ".chef".freeze
+
+ # The server's configuration directory
+ SERVER_CONF_DIR = "/etc/chef-server".freeze
end
end
diff --git a/lib/chef/encrypted_data_bag_item.rb b/lib/chef/encrypted_data_bag_item.rb
index 314d52cafb..d23712dd6f 100644
--- a/lib/chef/encrypted_data_bag_item.rb
+++ b/lib/chef/encrypted_data_bag_item.rb
@@ -20,6 +20,7 @@ require_relative "config"
require_relative "data_bag_item"
require_relative "encrypted_data_bag_item/decryptor"
require_relative "encrypted_data_bag_item/encryptor"
+require_relative "dist"
require "open-uri"
# An EncryptedDataBagItem represents a read-only data bag item where
@@ -130,7 +131,7 @@ class Chef::EncryptedDataBagItem
def self.load_secret(path = nil)
path ||= Chef::Config[:encrypted_data_bag_secret]
if !path
- raise ArgumentError, "No secret specified and no secret found at #{Chef::Config.platform_specific_path('/etc/chef/encrypted_data_bag_secret')}"
+ raise ArgumentError, "No secret specified and no secret found at #{Chef::Config.platform_specific_path(Chef::Dist::CONF_DIR + '/encrypted_data_bag_secret')}"
end
secret = case path
when /^\w+:\/\//
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 8122c55b7c..f60928375e 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -348,10 +348,11 @@ class Chef
}
DEPRECATED_FLAGS = {
- # deprecated_key: [new_key, deprecated_long]
+ # deprecated_key: [new_key, deprecated_long, replacement_value, deprecated_short]
# optional third element: replacement_value - if converting from bool
# (--bool-option) to valued flag (--new-option VALUE)
# this will be the value that is assigned the new flag when the old flag is used.
+ # optional fourth element: deprecated_short - if the short form of flag has also been deprecated.
auth_timeout: [:max_wait, "--max-wait SECONDS" ],
forward_agent:
[:ssh_forward_agent, "--forward-agent"],
@@ -360,7 +361,7 @@ class Chef
prerelease:
[:channel, "--prerelease", "current"],
ssh_user:
- [:connection_user, "--ssh-user USER"],
+ [:connection_user, "--ssh-user USERNAME"],
ssh_password:
[:connection_password, "--ssh-password PASSWORD"],
ssh_port:
@@ -368,9 +369,9 @@ class Chef
ssl_peer_fingerprint:
[:winrm_ssl_peer_fingerprint, "--ssl-peer-fingerprint FINGERPRINT"],
winrm_user:
- [:connection_user, "--winrm-user USER"],
+ [:connection_user, "--winrm-user USERNAME", nil, "-x USERNAME"],
winrm_password:
- [:connection_password, "--winrm-password"],
+ [:connection_password, "--winrm-password PASSWORD"],
winrm_port:
[:connection_port, "--winrm-port"],
winrm_authentication_protocol:
@@ -384,18 +385,28 @@ class Chef
}.freeze
DEPRECATED_FLAGS.each do |deprecated_key, deprecation_entry|
- new_key, deprecated_long, replacement_value = deprecation_entry
+ new_key, deprecated_long, replacement_value, deprecated_short = deprecation_entry
new_long = options[new_key][:long]
+ new_long_key = new_long.split(" ").first
+ if new_short = options[new_key][:short]
+ new_long += "(or #{new_short})"
+ new_long_key += "(or #{new_short.split(" ").first})"
+ end
new_long_desc = if replacement_value.nil?
new_long
else
- "#{new_long.split(" ").first} #{replacement_value}"
+ "#{new_long_key} #{replacement_value}"
end
- option(deprecated_key, long: deprecated_long,
- description: "This flag is deprecated. Please use '#{new_long_desc}' instead.",
- boolean: options[new_key][:boolean] || !replacement_value.nil?,
- # Put deprecated options at the end of the options list
- on: :tail)
+
+ opt = { long: deprecated_long,
+ description: "This flag is deprecated. Please use '#{new_long_desc}' instead.",
+ boolean: options[new_key][:boolean] || !replacement_value.nil?,
+ # Put deprecated options at the end of the options list
+ on: :tail }
+
+ opt[:short] = deprecated_short if deprecated_short
+
+ option(deprecated_key, opt)
end
attr_reader :connection
@@ -699,13 +710,23 @@ class Chef
# are both used, exit
def verify_deprecated_flags!
DEPRECATED_FLAGS.each do |deprecated_key, deprecation_entry|
- new_key, deprecated_long, replacement_value = deprecation_entry
+ new_key, deprecated_long, replacement_value, deprecated_short = deprecation_entry
+
+ dep_long_key = deprecated_long.split(" ").first
+ if deprecated_short
+ dep_long_key += "(or #{deprecated_short.split(" ").first})"
+ end
+
if config.key?(deprecated_key) && config_source(deprecated_key) == :cli
if config.key?(new_key) && config_source(new_key) == :cli
- new_long = options[new_key][:long].split(" ").first
- deprecated_long = deprecated_long.split(" ").first
+ new_long = options[new_key][:long]
+ new_long_key = new_long.split(" ").first
+ if new_short = options[new_key][:short]
+ new_long += "(or #{new_short})"
+ new_long_key += "(or #{new_short.split(" ").first})"
+ end
ui.error <<~EOM
- You provided both #{new_long} and #{deprecated_long}.
+ You provided both #{new_long_key} and #{dep_long_key}.
Please use one or the other, but note that
#{deprecated_long} is deprecated.
@@ -714,7 +735,7 @@ class Chef
else
config[new_key] = replacement_value || config[deprecated_key]
unless Chef::Config[:silence_deprecation_warnings] == true
- ui.warn "You provided #{deprecated_long.split(" ").first}. #{options[deprecated_key][:description]}"
+ ui.warn "You provided #{dep_long_key}. #{options[deprecated_key][:description]}"
end
end
end
diff --git a/lib/chef/knife/bootstrap/templates/chef-full.erb b/lib/chef/knife/bootstrap/templates/chef-full.erb
index 9f2e96ba84..f70a94ea55 100644
--- a/lib/chef/knife/bootstrap/templates/chef-full.erb
+++ b/lib/chef/knife/bootstrap/templates/chef-full.erb
@@ -186,55 +186,55 @@ if test "x$tmp_dir" != "x"; then
rm -r "$tmp_dir"
fi
-mkdir -p /etc/chef
+mkdir -p <%= Chef::Dist::CONF_DIR %>
<% if client_pem -%>
-cat > /etc/chef/client.pem <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/client.pem <<'EOP'
<%= ::File.read(::File.expand_path(client_pem)) %>
EOP
-chmod 0600 /etc/chef/client.pem
+chmod 0600 <%= Chef::Dist::CONF_DIR %>/client.pem
<% end -%>
<% if validation_key -%>
-cat > /etc/chef/validation.pem <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/validation.pem <<'EOP'
<%= validation_key %>
EOP
-chmod 0600 /etc/chef/validation.pem
+chmod 0600 <%= Chef::Dist::CONF_DIR %>/validation.pem
<% end -%>
<% if encrypted_data_bag_secret -%>
-cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/encrypted_data_bag_secret <<'EOP'
<%= encrypted_data_bag_secret %>
EOP
-chmod 0600 /etc/chef/encrypted_data_bag_secret
+chmod 0600 <%= Chef::Dist::CONF_DIR %>/encrypted_data_bag_secret
<% end -%>
<% unless trusted_certs.empty? -%>
-mkdir -p /etc/chef/trusted_certs
+mkdir -p <%= Chef::Dist::CONF_DIR %>/trusted_certs
<%= trusted_certs %>
<% end -%>
<%# Generate Ohai Hints -%>
<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
-mkdir -p /etc/chef/ohai/hints
+mkdir -p <%= Chef::Dist::CONF_DIR %>/ohai/hints
<% @chef_config[:knife][:hints].each do |name, hash| -%>
-cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/ohai/hints/<%= name %>.json <<'EOP'
<%= Chef::JSONCompat.to_json(hash) %>
EOP
<% end -%>
<% end -%>
-cat > /etc/chef/client.rb <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/client.rb <<'EOP'
<%= config_content %>
EOP
-cat > /etc/chef/first-boot.json <<'EOP'
+cat > <%= Chef::Dist::CONF_DIR %>/first-boot.json <<'EOP'
<%= Chef::JSONCompat.to_json(first_boot) %>
EOP
<% unless client_d.empty? -%>
-mkdir -p /etc/chef/client.d
+mkdir -p <%= Chef::Dist::CONF_DIR %>/client.d
<%= client_d %>
<% end -%>
diff --git a/lib/chef/knife/bootstrap/train_connector.rb b/lib/chef/knife/bootstrap/train_connector.rb
index 2a1432a8c4..59de880cbd 100644
--- a/lib/chef/knife/bootstrap/train_connector.rb
+++ b/lib/chef/knife/bootstrap/train_connector.rb
@@ -148,6 +148,7 @@ class Chef
# @return NilClass
def upload_file_content!(content, remote_path)
t = Tempfile.new("chef-content")
+ t.binmode
t << content
t.close
upload_file!(t.path, remote_path)
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index 5ff5d96aa0..739428d5e3 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -18,6 +18,7 @@
require_relative "../knife"
require_relative "../util/path_helper"
+require_relative "../dist"
class Chef
class Knife
@@ -116,7 +117,7 @@ class Chef
if config[:initial]
@new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", default: Etc.getlogin)
@admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", default: "admin")
- @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", default: "/etc/chef-server/admin.pem")
+ @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", default: "#{Chef::Dist::SERVER_CONF_DIR}/admin.pem")
@admin_client_key = File.expand_path(@admin_client_key)
else
@new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", default: Etc.getlogin)
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index 997ebd5f28..fbe56031cb 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -158,11 +158,11 @@ class Chef
end
if encrypted_data_bag_secret
- client_rb << %Q{encrypted_data_bag_secret "/etc/chef/encrypted_data_bag_secret"\n}
+ client_rb << %Q{encrypted_data_bag_secret "#{Chef::Dist::CONF_DIR}/encrypted_data_bag_secret"\n}
end
unless trusted_certs.empty?
- client_rb << %Q{trusted_certs_dir "/etc/chef/trusted_certs"\n}
+ client_rb << %Q{trusted_certs_dir "#{Chef::Dist::CONF_DIR}/trusted_certs"\n}
end
if Chef::Config[:fips]
@@ -175,7 +175,7 @@ class Chef
def start_chef
# If the user doesn't have a client path configure, let bash use the PATH for what it was designed for
client_path = @chef_config[:chef_client_path] || "#{Chef::Dist::CLIENT}"
- s = "#{client_path} -j /etc/chef/first-boot.json"
+ s = "#{client_path} -j #{Chef::Dist::CONF_DIR}/first-boot.json"
if @config[:verbosity] && @config[:verbosity] >= 3
s << " -l trace"
elsif @config[:verbosity] && @config[:verbosity] >= 2
@@ -226,7 +226,7 @@ class Chef
content = ""
if @chef_config[:trusted_certs_dir]
Dir.glob(File.join(Chef::Util::PathHelper.escape_glob_dir(@chef_config[:trusted_certs_dir]), "*.{crt,pem}")).each do |cert|
- content << "cat > /etc/chef/trusted_certs/#{File.basename(cert)} <<'EOP'\n" +
+ content << "cat > #{Chef::Dist::CONF_DIR}/trusted_certs/#{File.basename(cert)} <<'EOP'\n" +
IO.read(File.expand_path(cert)) + "\nEOP\n"
end
end
@@ -240,7 +240,7 @@ class Chef
root.find do |f|
relative = f.relative_path_from(root)
if f != root
- file_on_node = "/etc/chef/client.d/#{relative}"
+ file_on_node = "#{Chef::Dist::CONF_DIR}/client.d/#{relative}"
if f.directory?
content << "mkdir #{file_on_node}\n"
else
diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb
index 0e37a29787..cc7f8d7e84 100644
--- a/lib/chef/resource/breakpoint.rb
+++ b/lib/chef/resource/breakpoint.rb
@@ -25,7 +25,7 @@ class Chef
provides :breakpoint, target_mode: true
resource_name :breakpoint
- description "Use the breakpoint resource to add breakpoints to recipes. Run the chef-shell in #{Chef::Dist::CLIENT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{Chef::Dist::CLIENT} during an actual #{Chef::Dist::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
+ description "Use the breakpoint resource to add breakpoints to recipes. Run the #{Chef::Dist::SHELL} in #{Chef::Dist::CLIENT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{Chef::Dist::CLIENT} during an actual #{Chef::Dist::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
introduced "12.0"
default_action :break
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index f8a8dfdca2..d81b2eb910 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -206,17 +206,17 @@ module Shell
@footer
end
- banner("chef-shell #{Chef::VERSION}\n\nUsage: chef-shell [NAMED_CONF] (OPTIONS)")
+ banner("#{Chef::Dist::SHELL} #{Chef::VERSION}\n\nUsage: #{Chef::Dist::SHELL} [NAMED_CONF] (OPTIONS)")
footer(<<~FOOTER)
- When no CONFIG is specified, chef-shell attempts to load a default configuration file:
- * If a NAMED_CONF is given, chef-shell will load ~/.chef/NAMED_CONF/chef_shell.rb
- * If no NAMED_CONF is given chef-shell will load ~/.chef/chef_shell.rb if it exists
- * If no chef_shell.rb can be found, chef-shell falls back to load:
- /etc/chef/client.rb if -z option is given.
- /etc/chef/solo.rb if --solo-legacy-mode option is given.
- .chef/config.rb if -s option is given.
- .chef/knife.rb if -s option is given.
+ When no CONFIG is specified, #{Chef::Dist::SHELL} attempts to load a default configuration file:
+ * If a NAMED_CONF is given, #{Chef::Dist::SHELL} will load ~/#{Chef::Dist::USER_CONF_DIR}/NAMED_CONF/#{Chef::Dist::SHELL_CONF}
+ * If no NAMED_CONF is given #{Chef::Dist::SHELL} will load ~/#{Chef::Dist::USER_CONF_DIR}/#{Chef::Dist::SHELL_CONF} if it exists
+ * If no #{Chef::Dist::SHELL_CONF} can be found, #{Chef::Dist::SHELL} falls back to load:
+ #{Chef::Dist::CONF_DIR}/client.rb if -z option is given.
+ #{Chef::Dist::CONF_DIR}/solo.rb if --solo-legacy-mode option is given.
+ #{Chef::Dist::USER_CONF_DIR}/config.rb if -s option is given.
+ #{Chef::Dist::USER_CONF_DIR}/knife.rb if -s option is given.
FOOTER
option :config_file,
@@ -330,18 +330,18 @@ module Shell
config[:config_file]
elsif environment
Shell.env = environment
- config_file_to_try = ::File.join(dot_chef_dir, environment, "chef_shell.rb")
+ config_file_to_try = ::File.join(dot_chef_dir, environment, Chef::Dist::SHELL_CONF)
unless ::File.exist?(config_file_to_try)
- puts "could not find chef-shell config for environment #{environment} at #{config_file_to_try}"
+ puts "could not find #{Chef::Dist::SHELL} config for environment #{environment} at #{config_file_to_try}"
exit 1
end
config_file_to_try
- elsif dot_chef_dir && ::File.exist?(File.join(dot_chef_dir, "chef_shell.rb"))
- File.join(dot_chef_dir, "chef_shell.rb")
+ elsif dot_chef_dir && ::File.exist?(File.join(dot_chef_dir, Chef::Dist::SHELL_CONF))
+ File.join(dot_chef_dir, Chef::Dist::SHELL_CONF)
elsif config[:solo_legacy_shell]
- Chef::Config.platform_specific_path("/etc/chef/solo.rb")
+ Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/solo.rb")
elsif config[:client]
- Chef::Config.platform_specific_path("/etc/chef/client.rb")
+ Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/client.rb")
elsif config[:solo_shell]
Chef::WorkstationConfigLoader.new(nil, Chef::Log).config_location
else
diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb
index e520704231..5260832e91 100644
--- a/lib/chef/shell/ext.rb
+++ b/lib/chef/shell/ext.rb
@@ -69,7 +69,7 @@ module Shell
def help_banner
banner = []
banner << ""
- banner << "chef-shell Help"
+ banner << "#{Chef::Dist::SHELL} Help"
banner << "".ljust(80, "=")
banner << "| " + "Command".ljust(25) + "| " + "Description"
banner << "".ljust(80, "=")
@@ -194,7 +194,7 @@ module Shell
explain(<<~E)
## SUMMARY ##
When called with no argument, +help+ prints a table of all
- chef-shell commands. When called with an argument COMMAND, +help+
+ #{Chef::Dist::SHELL} commands. When called with an argument COMMAND, +help+
prints a detailed explanation of the command if available, or the
description if no explanation is available.
E
@@ -210,7 +210,7 @@ module Shell
desc "prints information about chef"
def version
- puts "This is the chef-shell.\n" +
+ puts "This is the #{Chef::Dist::SHELL}.\n" +
" Chef Version: #{::Chef::VERSION}\n" +
" https://www.chef.io/\n" +
" https://docs.chef.io/"
@@ -311,9 +311,9 @@ module Shell
new_node = edit(existing_node)
## EDITOR SELECTION ##
- chef-shell looks for an editor using the following logic
+ #{Chef::Dist::SHELL} looks for an editor using the following logic
1. Looks for an EDITOR set by Shell.editor = "EDITOR"
- 2. Looks for an EDITOR configured in your chef-shell config file
+ 2. Looks for an EDITOR configured in your #{Chef::Dist::SHELL} config file
3. Uses the value of the EDITOR environment variable
E
def edit(object)
@@ -322,7 +322,7 @@ module Shell
return :failburger
end
- filename = "chef-shell-edit-#{object.class.name}-"
+ filename = "#{Chef::Dist::SHELL}-edit-#{object.class.name}-"
if object.respond_to?(:name)
filename += object.name
elsif object.respond_to?(:id)
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index 10cd4c81aa..d17d212d18 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -28,6 +28,7 @@ require_relative "../run_list/run_list_expansion"
require_relative "../formatters/base"
require_relative "../formatters/doc"
require_relative "../formatters/minimal"
+require_relative "../dist"
module Shell
class ShellSession
@@ -87,7 +88,7 @@ module Shell
end
def save_node
- raise "Not Supported! #{self.class.name} doesn't support #save_node, maybe you need to run chef-shell in client mode?"
+ raise "Not Supported! #{self.class.name} doesn't support #save_node, maybe you need to run #{Chef::Dist::SHELL} in client mode?"
end
def rebuild_context
diff --git a/lib/chef/train_transport.rb b/lib/chef/train_transport.rb
index 95b5018960..fdb4b5305a 100644
--- a/lib/chef/train_transport.rb
+++ b/lib/chef/train_transport.rb
@@ -17,6 +17,7 @@
require "chef-config/mixin/credentials"
require "train"
+require_relative "dist"
class Chef
class TrainTransport
@@ -76,8 +77,8 @@ class Chef
credentials_file =
if tm_config.credentials_file && File.exist?(tm_config.credentials_file)
tm_config.credentials_file
- elsif File.exist?(Chef::Config.platform_specific_path("/etc/chef/#{profile}/credentials"))
- Chef::Config.platform_specific_path("/etc/chef/#{profile}/credentials")
+ elsif File.exist?(Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/#{profile}/credentials"))
+ Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/#{profile}/credentials")
else
super
end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 7f053dd044..cb4eae5fc8 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.1.0")
+ VERSION = Chef::VersionString.new("15.1.3")
end
#
diff --git a/scripts/bk_tests/bk_dokken_install.sh b/scripts/bk_tests/bk_dokken_install.sh
new file mode 100755
index 0000000000..3dd03deecf
--- /dev/null
+++ b/scripts/bk_tests/bk_dokken_install.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Install omnibus-toolchain for git bundler and gem
+curl -fsSL https://chef.io/chef/install.sh | sudo bash -s -- -P omnibus-toolchain
+
+# Set Environment Variables
+export BUNDLE_GEMFILE=$PWD/kitchen-tests/Gemfile
+export FORCE_FFI_YAJL=ext
+export CHEF_LICENSE="accept-silent"
+export PATH=/opt/asdf/bin:/opt/asdf/shims:/opt/omnibus-toolchain/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+# Install Dev tools
+sudo yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel iptables
+sudo zypper install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel iptables
+
+# Install ASDF software manager
+echo "--- Installing ASDF software version manager from master"
+sudo /opt/omnibus-toolchain/embedded/bin/git clone https://github.com/asdf-vm/asdf.git /opt/asdf
+. /opt/asdf/asdf.sh
+. /opt/asdf/completions/asdf.bash
+
+echo "--- Installing Ruby ASDF plugin"
+/opt/asdf/bin/asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
+
+echo "--- Installing Ruby 2.5.5"
+/opt/asdf/bin/asdf install ruby 2.5.5
+/opt/asdf/bin/asdf global ruby 2.5.5
+
+# Update Gems
+gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
+gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2) --force --no-document
+sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
+ruby --version
+which bundle
+bundle install --jobs=3 --retry=3 --path=vendor/bundle \ No newline at end of file
diff --git a/scripts/bk_tests/bk_install.sh b/scripts/bk_tests/bk_install.sh
index de74af151c..e8fefc2d02 100755
--- a/scripts/bk_tests/bk_install.sh
+++ b/scripts/bk_tests/bk_install.sh
@@ -1,3 +1,5 @@
+apt-get update -y && apt-get install -y net-tools iproute2
+touch /etc/network/interfaces
gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
gem --version
gem uninstall bundler -a -x || true
diff --git a/scripts/bk_tests/bk_linux_exec.sh b/scripts/bk_tests/bk_linux_exec.sh
new file mode 100755
index 0000000000..fee73aa6bb
--- /dev/null
+++ b/scripts/bk_tests/bk_linux_exec.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Enable IPv6 in docker
+sudo systemctl stop docker
+echo "Enabling IPv6 in Docker config"
+dockerd_config="/etc/docker/daemon.json"
+sudo echo "$(jq '. + {"ipv6": true, "fixed-cidr-v6": "2001:2019:6002::/80", "ip-forward": false}' $dockerd_config)" > $dockerd_config
+sudo systemctl start docker
+
+# Verify Docker Is Running
+docker version
+sudo service docker status
+
+# Install C and C++
+sudo yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel
+
+# Install omnibus-toolchain for git bundler and gem
+curl -fsSL https://chef.io/chef/install.sh | sudo bash -s -- -P omnibus-toolchain
+
+# Set Environment Variables
+export BUNDLE_GEMFILE=$PWD/kitchen-tests/Gemfile
+export FORCE_FFI_YAJL=ext
+export CHEF_LICENSE="accept-silent"
+export PATH=$PATH:~/.asdf/shims:/opt/asdf/bin:/opt/asdf/shims:/opt/omnibus-toolchain/embedded/bin
+
+# Install ASDF software manager
+echo "--- Installing ASDF software version manager from master"
+sudo git clone https://github.com/asdf-vm/asdf.git /opt/asdf
+. /opt/asdf/asdf.sh
+. /opt/asdf/completions/asdf.bash
+
+echo "--- Installing Ruby ASDF plugin"
+/opt/asdf/bin/asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
+
+echo "--- Installing Ruby 2.5.5"
+/opt/asdf/bin/asdf install ruby 2.5.5
+/opt/asdf/bin/asdf global ruby 2.5.5
+
+# Update Gems
+gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
+gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2) --force --no-document
+sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
+ruby --version
+which bundle
+bundle install --jobs=3 --retry=3 --path=vendor/bundle \ No newline at end of file
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index c52a4c0694..10ebcaf8b6 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -53,7 +53,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, external: inclu
end
def fetch_first_interface_name
- shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2").stdout.strip
+ shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2 |cut -d'@' -f 1").stdout.strip
end
# **Caution: any updates to core interfaces can be risky.
diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb
index 6600a65c9f..ff48d69527 100644
--- a/spec/integration/client/exit_code_spec.rb
+++ b/spec/integration/client/exit_code_spec.rb
@@ -21,7 +21,7 @@ describe "chef-client" do
# machine that has omnibus chef installed. In that case we need to ensure
# we're running `chef-client` from the source tree and not the external one.
# cf. CHEF-4914
- let(:chef_client) { "bundle exec chef-client --no-fork --minimal-ohai" }
+ let(:chef_client) { "bundle exec #{Chef::Dist::CLIENT} --no-fork --minimal-ohai" }
let(:critical_env_vars) { %w{PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") }
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index 385a192648..c3c559c65b 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -171,6 +171,7 @@ describe Chef::Knife::Bootstrap::TrainConnector do
expect(File.read(local_path)).to eq "test data"
expect(remote_path).to eq "/target/path"
end
+ expect_any_instance_of(Tempfile).to receive(:binmode)
subject.upload_file_content!("test data", "/target/path")
end
end
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index f92af74284..b04269e3df 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -1,6 +1,7 @@
#
# Author:: Ian Meyer (<ianmmeyer@gmail.com>)
# Copyright:: Copyright 2010-2016, Ian Meyer
+# Copyright:: Copyright 2010-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -1684,20 +1685,87 @@ describe Chef::Knife::Bootstrap do
end
context "when a deprecated CLI flag is given on the CLI" do
- let(:bootstrap_cli_options) { %w{--ssh-user sshuser} }
- it "maps the key value to the new key and points the human to the new flag" do
- expect(knife.ui).to receive(:warn).with(/You provided --ssh-user. This flag is deprecated. Please use '--connection-user USERNAME' instead./)
- knife.verify_deprecated_flags!
- expect(knife.config[:connection_user]).to eq "sshuser"
+ context "with flag containing only long argument" do
+ context "when given with no other options" do
+ let(:bootstrap_cli_options) { %w{--winrm-transport XXX} }
+ it "maps the key value to the new key and points the human to the new flag" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-transport. This flag is deprecated. Please use '--winrm-ssl' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:winrm_ssl]).to eq "XXX"
+ end
+ end
+ context "when given along with valid flag" do
+ let(:bootstrap_cli_options) { %w{--winrm-transport XXX --connection-user user-a} }
+ it "maps the key value to the new key and points the human to the new flag" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-transport. This flag is deprecated. Please use '--winrm-ssl' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:winrm_ssl]).to eq "XXX"
+ expect(knife.config[:connection_user]).to eq "user-a"
+ end
+ end
+ context "when given along with its replacement" do
+ let(:bootstrap_cli_options) { %w{--winrm-transport XXX --winrm-ssl YYY} }
+ it "informs the human that both are provided and exits" do
+ expect(knife.ui).to receive(:error).with(/You provided both --winrm-ssl and --winrm-transport.*Please use.*/m)
+ expect { knife.verify_deprecated_flags! }.to raise_error SystemExit
+ end
+ end
end
- end
- context "when a deprecated CLI flag is given on the CLI, along with its replacement" do
- let(:bootstrap_cli_options) { %w{--connection-user a --ssh-user b} }
+ context "with flag also contains short argument" do
+ context "when given as short arg" do
+ context "with no other options" do
+ let(:bootstrap_cli_options) { %w{-x user-a} }
+ it "maps the key value to the new key and display information with both long and short arguments" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-user(or -x). This flag is deprecated. Please use '--connection-user USERNAME(or -U USERNAME)' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:connection_user]).to eq "user-a"
+ end
+ end
+ context "along with valid flag" do
+ let(:bootstrap_cli_options) { %w{-x user-a --connection-password XXX} }
+ it "maps the key value to the new key and display information with both long and short arguments" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-user(or -x). This flag is deprecated. Please use '--connection-user USERNAME(or -U USERNAME)' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:connection_user]).to eq "user-a"
+ expect(knife.config[:connection_password]).to eq "XXX"
+ end
+ end
+ context "along with its replacement" do
+ let(:bootstrap_cli_options) { %w{-x user-a --connection-user user-b} }
+ it "informs the human that both are provided and exits" do
+ expect(knife.ui).to receive(:error).with("You provided both --connection-user(or -U) and --winrm-user(or -x).\n\nPlease use one or the other, but note that\n--winrm-user USERNAME is deprecated.\n")
+ expect { knife.verify_deprecated_flags! }.to raise_error SystemExit
+ end
+ end
+ end
- it "informs the human that both are provided and exits" do
- expect(knife.ui).to receive(:error).with(/You provided both --connection-user and --ssh-user.*Please use.*/m)
- expect { knife.verify_deprecated_flags! }.to raise_error SystemExit
+ context "when given as long arg" do
+ context "with no other options" do
+ let(:bootstrap_cli_options) { %w{--winrm-user user-a} }
+ it "maps the key value to the new key and display information with both long and short arguments" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-user(or -x). This flag is deprecated. Please use '--connection-user USERNAME(or -U USERNAME)' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:connection_user]).to eq "user-a"
+ end
+ end
+ context "along with valid flag" do
+ let(:bootstrap_cli_options) { %w{--winrm-user user-a --connection-password XXX} }
+ it "maps the key value to the new key and display information with both long and short arguments" do
+ expect(knife.ui).to receive(:warn).with("You provided --winrm-user(or -x). This flag is deprecated. Please use '--connection-user USERNAME(or -U USERNAME)' instead.")
+ knife.verify_deprecated_flags!
+ expect(knife.config[:connection_user]).to eq "user-a"
+ expect(knife.config[:connection_password]).to eq "XXX"
+ end
+ end
+ context "along with its replacement" do
+ let(:bootstrap_cli_options) { %w{--winrm-user user-a --connection-user user-b} }
+ it "informs the human that both are provided and exits" do
+ expect(knife.ui).to receive(:error).with("You provided both --connection-user(or -U) and --winrm-user(or -x).\n\nPlease use one or the other, but note that\n--winrm-user USERNAME is deprecated.\n")
+ expect { knife.verify_deprecated_flags! }.to raise_error SystemExit
+ end
+ end
+ end
end
end