summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@getchef.com>2019-04-29 16:31:15 -0700
committerGitHub <noreply@github.com>2019-04-29 16:31:15 -0700
commit77f6acce07f7c801c74d638d00b8a0779e55afa3 (patch)
treeca9742994151d1c061048925473738017cdd35e1
parentfb7982e40379221c6c0d36755e081aca7a862301 (diff)
parent688b72f47b4c3a23ca042336ea6c5d1f215ec263 (diff)
downloadchef-77f6acce07f7c801c74d638d00b8a0779e55afa3.tar.gz
Merge pull request #8413 from chef/lcg/remove-binstubs2
Remove chef-* bin files from chef gem
-rwxr-xr-x.expeditor/update_version.sh1
-rw-r--r--.gitignore6
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock7
-rw-r--r--Rakefile7
-rw-r--r--chef-bin/.rspec2
-rw-r--r--chef-bin/Gemfile4
-rw-r--r--chef-bin/LICENSE201
-rw-r--r--chef-bin/Rakefile15
-rwxr-xr-xchef-bin/bin/chef-apply (renamed from bin/chef-apply)0
-rwxr-xr-xchef-bin/bin/chef-client (renamed from bin/chef-client)0
-rwxr-xr-xchef-bin/bin/chef-resource-inspector (renamed from bin/chef-resource-inspector)0
-rwxr-xr-xchef-bin/bin/chef-service-manager (renamed from bin/chef-service-manager)0
-rwxr-xr-xchef-bin/bin/chef-shell (renamed from bin/chef-shell)0
-rwxr-xr-xchef-bin/bin/chef-solo (renamed from bin/chef-solo)0
-rwxr-xr-xchef-bin/bin/chef-windows-service (renamed from bin/chef-windows-service)0
-rw-r--r--chef-bin/chef-bin.gemspec26
-rw-r--r--chef-bin/lib/chef-bin.rb20
-rw-r--r--chef-bin/lib/chef-bin/version.rb34
-rw-r--r--chef.gemspec2
-rw-r--r--kitchen-tests/kitchen.yml2
-rw-r--r--spec/functional/shell_spec.rb5
-rw-r--r--spec/functional/version_spec.rb4
-rw-r--r--spec/integration/client/client_spec.rb22
-rw-r--r--spec/integration/client/exit_code_spec.rb2
-rw-r--r--spec/integration/client/ipv6_spec.rb4
-rw-r--r--spec/integration/recipes/accumulator_spec.rb2
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb2
-rw-r--r--spec/integration/recipes/lwrp_spec.rb2
-rw-r--r--spec/integration/recipes/notifies_spec.rb2
-rw-r--r--spec/integration/recipes/notifying_block_spec.rb4
-rw-r--r--spec/integration/recipes/remote_directory.rb2
-rw-r--r--spec/integration/solo/solo_spec.rb4
33 files changed, 344 insertions, 39 deletions
diff --git a/.expeditor/update_version.sh b/.expeditor/update_version.sh
index e058d06f06..85f7340811 100755
--- a/.expeditor/update_version.sh
+++ b/.expeditor/update_version.sh
@@ -12,6 +12,7 @@
set -evx
sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" chef-config/lib/chef-config/version.rb
+sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" chef-bin/lib/chef-bin/version.rb
sed -i -r "s/VersionString\.new\(\".+\"\)/VersionString.new(\"$(cat VERSION)\")/" lib/chef/version.rb
# Update the version inside Gemfile.lock
diff --git a/.gitignore b/.gitignore
index 200db3afc5..d88442ba7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,9 @@ nodes/
# chef-config
chef-config/.bundle
chef-config/Gemfile.lock
+chef-config/pkg
+
+# chef-bin
+chef-bin/.bundle
+chef-bin/Gemfile.lock
+chef-bin/pkg
diff --git a/Gemfile b/Gemfile
index 6abe88b86e..71a3efd2a8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,6 +11,7 @@ gem "chef", path: "."
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "master"
gem "chef-config", path: File.expand_path("../chef-config", __FILE__) if File.exist?(File.expand_path("../chef-config", __FILE__))
+gem "chef-bin", path: File.expand_path("../chef-bin", __FILE__) if File.exist?(File.expand_path("../chef-bin", __FILE__))
gem "cheffish", "~> 14"
group(:omnibus_package) do
diff --git a/Gemfile.lock b/Gemfile.lock
index 3fa3cd953d..711c777735 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -99,6 +99,12 @@ PATH
wmi-lite (~> 1.0)
PATH
+ remote: chef-bin
+ specs:
+ chef-bin (15.0.237)
+ chef (= 15.0.237)
+
+PATH
remote: chef-config
specs:
chef-config (15.0.239)
@@ -410,6 +416,7 @@ DEPENDENCIES
appbundler
bcrypt_pbkdf
chef!
+ chef-bin!
chef-config!
chef-vault
cheffish (~> 14)
diff --git a/Rakefile b/Rakefile
index e0aac6170f..d9c3c397da 100644
--- a/Rakefile
+++ b/Rakefile
@@ -34,6 +34,13 @@ task install: :super_install
gemspec = Gem.win_platform? ? "chef-universal-mingw32" : "chef"
Bundler::GemHelper.install_tasks name: gemspec
+# this gets appended to the normal bundler install helper
+task :install do
+ chef_bin_path = ::File.join(::File.dirname(__FILE__), "chef-bin")
+ Dir.chdir(chef_bin_path)
+ sh("rake install:force")
+end
+
task :pedant, :chef_zero_spec
task :build_eventlog do
diff --git a/chef-bin/.rspec b/chef-bin/.rspec
new file mode 100644
index 0000000000..eb3ef03653
--- /dev/null
+++ b/chef-bin/.rspec
@@ -0,0 +1,2 @@
+--color
+-fd
diff --git a/chef-bin/Gemfile b/chef-bin/Gemfile
new file mode 100644
index 0000000000..96ab544690
--- /dev/null
+++ b/chef-bin/Gemfile
@@ -0,0 +1,4 @@
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in chef-config.gemspec
+gemspec
diff --git a/chef-bin/LICENSE b/chef-bin/LICENSE
new file mode 100644
index 0000000000..11069edd79
--- /dev/null
+++ b/chef-bin/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/chef-bin/Rakefile b/chef-bin/Rakefile
new file mode 100644
index 0000000000..5626d1bc5d
--- /dev/null
+++ b/chef-bin/Rakefile
@@ -0,0 +1,15 @@
+# we need to force the install in order to overwrite the binstubs from
+# old chef gems.
+
+Bundler::GemHelper.install_tasks
+
+# this is necessary to use to overwrite any chef-14 or earlier era gem which has the bin files in
+# the chef gem itself
+desc "force install the chef-bin gem"
+task "install:force" do
+ sh "gem build -V chef-bin.gemspec"
+ built_gem_path = Dir["chef-bin-*.gem"].sort_by { |f| File.mtime(f) }.last
+ FileUtils.mkdir_p("pkg") unless Dir.exist?("pkg")
+ FileUtils.mv(built_gem_path, "pkg")
+ sh "gem install -f pkg/#{built_gem_path}"
+end
diff --git a/bin/chef-apply b/chef-bin/bin/chef-apply
index ddbdc66907..ddbdc66907 100755
--- a/bin/chef-apply
+++ b/chef-bin/bin/chef-apply
diff --git a/bin/chef-client b/chef-bin/bin/chef-client
index af27d7903d..af27d7903d 100755
--- a/bin/chef-client
+++ b/chef-bin/bin/chef-client
diff --git a/bin/chef-resource-inspector b/chef-bin/bin/chef-resource-inspector
index 6a7eac0c32..6a7eac0c32 100755
--- a/bin/chef-resource-inspector
+++ b/chef-bin/bin/chef-resource-inspector
diff --git a/bin/chef-service-manager b/chef-bin/bin/chef-service-manager
index 9021824fed..9021824fed 100755
--- a/bin/chef-service-manager
+++ b/chef-bin/bin/chef-service-manager
diff --git a/bin/chef-shell b/chef-bin/bin/chef-shell
index 666ce1944c..666ce1944c 100755
--- a/bin/chef-shell
+++ b/chef-bin/bin/chef-shell
diff --git a/bin/chef-solo b/chef-bin/bin/chef-solo
index 06c0452d26..06c0452d26 100755
--- a/bin/chef-solo
+++ b/chef-bin/bin/chef-solo
diff --git a/bin/chef-windows-service b/chef-bin/bin/chef-windows-service
index 646e3b4a93..646e3b4a93 100755
--- a/bin/chef-windows-service
+++ b/chef-bin/bin/chef-windows-service
diff --git a/chef-bin/chef-bin.gemspec b/chef-bin/chef-bin.gemspec
new file mode 100644
index 0000000000..66d14f3f52
--- /dev/null
+++ b/chef-bin/chef-bin.gemspec
@@ -0,0 +1,26 @@
+# coding: utf-8
+lib = File.expand_path("../lib", __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require "chef-bin/version"
+
+Gem::Specification.new do |spec|
+ spec.name = "chef-bin"
+ spec.version = ChefBin::VERSION
+ spec.authors = ["Adam Jacob"]
+ spec.email = ["adam@chef.io"]
+
+ spec.summary = %q{Chef-branded binstubs for chef-client}
+ spec.homepage = "https://github.com/chef/chef"
+ spec.license = "Apache-2.0"
+
+ spec.require_paths = ["lib"]
+
+ spec.add_dependency "chef", "= #{ChefBin::VERSION}"
+ spec.add_development_dependency "rake"
+
+ spec.files = %w{Gemfile Rakefile LICENSE} + Dir.glob("*.gemspec") +
+ Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
+
+ spec.bindir = "bin"
+ spec.executables = %w{ chef-apply chef-client chef-resource-inspector chef-service-manager chef-shell chef-solo chef-windows-service }
+end
diff --git a/chef-bin/lib/chef-bin.rb b/chef-bin/lib/chef-bin.rb
new file mode 100644
index 0000000000..b40bf9fa11
--- /dev/null
+++ b/chef-bin/lib/chef-bin.rb
@@ -0,0 +1,20 @@
+#
+# Copyright:: Copyright 2015-2019, Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module ChefBin
+
+end
diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb
new file mode 100644
index 0000000000..9916e6b5fa
--- /dev/null
+++ b/chef-bin/lib/chef-bin/version.rb
@@ -0,0 +1,34 @@
+# Copyright:: Copyright 2010-2019, Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# NOTE: This file is generated by running `rake version` in the top level of
+# this repo. Do not edit this manually. Edit the VERSION file and run the rake
+# task instead.
+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+module ChefBin
+ CHEFBIN_ROOT = File.expand_path("../..", __FILE__)
+ VERSION = "15.0.237".freeze
+end
+
+#
+# NOTE: the Chef::Version class is defined in version_class.rb
+#
+# NOTE: DO NOT Use the Chef::Version class on ChefConfig::VERSIONs. The
+# Chef::Version class is for _cookbooks_ only, and cannot handle
+# pre-release versions like "10.14.0.rc.2". Please use Rubygem's
+# Gem::Version class instead.
+#
diff --git a/chef.gemspec b/chef.gemspec
index a9d9ded1cd..ebd6d192bb 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
s.add_dependency "bundler", ">= 1.10"
s.bindir = "bin"
- s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply chef-resource-inspector }
+ s.executables = %w{ knife }
s.require_paths = %w{ lib }
s.files = %w{Gemfile Rakefile LICENSE README.md} + Dir.glob("{lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + Dir.glob("*.gemspec")
diff --git a/kitchen-tests/kitchen.yml b/kitchen-tests/kitchen.yml
index 6de7be8ebd..5fe3b8540f 100644
--- a/kitchen-tests/kitchen.yml
+++ b/kitchen-tests/kitchen.yml
@@ -15,7 +15,7 @@ provisioner:
lifecycle:
pre_converge:
- - remote: /opt/chef/embedded/bin/gem install appbundle-updater
+ - 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
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index 3990f1afe0..dd0455fc9e 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2012-2017, Chef Software Inc.
+# Copyright:: Copyright 2012-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -82,8 +82,7 @@ describe Shell do
require "pty"
config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
- path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
- reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}")
+ reader, writer, pid = PTY.spawn("bundle exec chef-shell -c #{config} #{options}")
read_until(reader, "chef (#{Chef::VERSION})>")
yield reader, writer if block_given?
writer.puts('"done"')
diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb
index d968c36e8c..b12d235405 100644
--- a/spec/functional/version_spec.rb
+++ b/spec/functional/version_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Serdar Sutay (<dan@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software Inc.
+# Copyright:: Copyright 2013-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,7 +28,7 @@ describe "Chef Versions" do
binaries.each do |binary|
it "#{binary} version should be sane" do
- expect(shell_out!("ruby #{File.join("bin", binary)} -v", cwd: chef_dir).stdout.chomp).to match(/.*: #{Chef::VERSION}/)
+ expect(shell_out!("bundle exec #{binary} -v", cwd: chef_dir).stdout.chomp).to match(/.*: #{Chef::VERSION}/)
end
end
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 006839be3f..cde25662c1 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -45,10 +45,8 @@ 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) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
- let(:chef_solo) { "ruby '#{chef_dir}/chef-solo' --legacy-mode --minimal-ohai" }
-
- let(:critical_env_vars) { %w{_ORIGINAL_GEM_PATH GEM_PATH GEM_HOME GEM_ROOT BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYLIB RUBYOPT RUBY_ENGINE RUBY_ROOT RUBY_VERSION PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
+ let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" }
when_the_repository "has a cookbook with a no-op recipe" do
before { file "cookbooks/x/recipes/default.rb", "" }
@@ -62,22 +60,6 @@ describe "chef-client" do
shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
end
- it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do
- file "config/client.rb", <<~EOM
- local_mode true
- cookbook_path "#{path_to('cookbooks')}"
- EOM
-
- begin
- result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
- result.error!
- rescue
- Chef::Log.info "Bare invocation will have the following load-path."
- Chef::Log.info shell_out!("env -i #{critical_env_vars} ruby -e 'puts $:'").stdout
- raise
- end
- end
-
it "should complete successfully with --no-listen" do
file "config/client.rb", <<~EOM
local_mode true
diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb
index 2e29502070..6600a65c9f 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) { "ruby '#{chef_dir}/chef-client' --no-fork --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-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/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb
index 04154c296f..b97eb4e8b4 100644
--- a/spec/integration/client/ipv6_spec.rb
+++ b/spec/integration/client/ipv6_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software Inc.
+# Copyright:: Copyright 2013-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -75,7 +75,7 @@ describe "chef-client" do
let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") }
- let(:chef_client_cmd) { %Q{ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} }
+ let(:chef_client_cmd) { %Q{bundle exec chef-client --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} }
after do
FileUtils.rm_rf(cache_path)
diff --git a/spec/integration/recipes/accumulator_spec.rb b/spec/integration/recipes/accumulator_spec.rb
index 65a05fcdc5..d19d8637bb 100644
--- a/spec/integration/recipes/accumulator_spec.rb
+++ b/spec/integration/recipes/accumulator_spec.rb
@@ -16,7 +16,7 @@ describe "Accumulators" 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) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
let(:aliases_temppath) do
t = Tempfile.new("chef_accumulator_test")
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index 2f4ef92f31..6bc857df48 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -16,7 +16,7 @@ describe "LWRPs with inline resources" 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) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
context "with a use_inline_resources provider with 'def action_a' instead of action :a" do
class LwrpInlineResourcesTest < Chef::Resource
diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb
index b5af6978ac..ce2861d43b 100644
--- a/spec/integration/recipes/lwrp_spec.rb
+++ b/spec/integration/recipes/lwrp_spec.rb
@@ -16,7 +16,7 @@ describe "LWRPs" 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) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
when_the_repository "has a cookbook named l-w-r-p" do
before do
diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb
index 0df7aa311f..860a109e4d 100644
--- a/spec/integration/recipes/notifies_spec.rb
+++ b/spec/integration/recipes/notifies_spec.rb
@@ -6,7 +6,7 @@ describe "notifications" do
include Chef::Mixin::ShellOut
let(:chef_dir) { File.expand_path("../../../../bin", __FILE__) }
- let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
when_the_repository "notifies a nameless resource" do
before do
diff --git a/spec/integration/recipes/notifying_block_spec.rb b/spec/integration/recipes/notifying_block_spec.rb
index 6c50854038..753e81dadb 100644
--- a/spec/integration/recipes/notifying_block_spec.rb
+++ b/spec/integration/recipes/notifying_block_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: John Keiser (<jkeiser@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software Inc.
+# Copyright:: Copyright 2013-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@ describe "notifying_block" do
include Chef::Mixin::ShellOut
let(:chef_dir) { File.expand_path("../../../../bin", __FILE__) }
- let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
when_the_repository "notifying_block test one" do
before do
diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb
index a0e3e23ef3..6f67a38fc8 100644
--- a/spec/integration/recipes/remote_directory.rb
+++ b/spec/integration/recipes/remote_directory.rb
@@ -16,7 +16,7 @@ describe Chef::Resource::RemoteDirectory 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) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
+ let(:chef_client) { "bundle exec chef-client --minimal-ohai" }
when_the_repository "has a cookbook with a source_dir with two subdirectories, each with one file and subdir in a different alphabetical order" do
before do
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index efd889c5d0..a098256d36 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -16,7 +16,7 @@ describe "chef-solo" do
let(:cookbook_ancient_100_metadata_rb) { cb_metadata("ancient", "1.0.0") }
- let(:chef_solo) { "ruby bin/chef-solo --legacy-mode --minimal-ohai" }
+ let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" }
when_the_repository "creates nodes" do
let(:nodes_dir) { File.join(@repository_dir, "nodes") }
@@ -26,7 +26,7 @@ describe "chef-solo" do
file "config/solo.rb", <<~EOM
chef_repo_path "#{@repository_dir}"
EOM
- result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir)
+ result = shell_out("bundle exec chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir)
result.error!
end