chef-workstation icon indicating copy to clipboard operation
chef-workstation copied to clipboard

chef push fails with new go changes

Open tas50 opened this issue 2 years ago • 4 comments

 ✘  ~  /opt/chef-workstation/bin/chef push -h
[40150, #<Thread:0x000000015a07bc68 run>, #<NameError: uninitialized constant Gem::BundlerVersionFinder>, ["/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/dependency.rb:280:in `matching_specs'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2559:in `block in traverse'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `each'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `traverse'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1033:in `block in find_in_unresolved_tree'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `each'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `find_in_unresolved_tree'", "<internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:114:in `require'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/dependency.rb:280:in `matching_specs'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2559:in `block in traverse'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `each'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `traverse'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1033:in `block in find_in_unresolved_tree'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `each'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `find_in_unresolved_tree'", "<internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:114:in `require'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:236:in `finish_resolve'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:303:in `block in activate_bin_path'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `synchronize'", "/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `activate_bin_path'", "/opt/homebrew/lib/ruby/gems/3.0.0/bin/chef-cli:23:in `<main>'"]]
<internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:167:in `ensure in require': CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before false -> after true (RuntimeError)
	from <internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:167:in `require'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:236:in `finish_resolve'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:303:in `block in activate_bin_path'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `synchronize'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `activate_bin_path'
	from /opt/homebrew/lib/ruby/gems/3.0.0/bin/chef-cli:23:in `<main>'
/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/dependency.rb:280:in `matching_specs': uninitialized constant Gem::BundlerVersionFinder (NameError)
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2559:in `block in traverse'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `each'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `traverse'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1033:in `block in find_in_unresolved_tree'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `each'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `find_in_unresolved_tree'
	from <internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:114:in `require'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/dependency.rb:280:in `matching_specs'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2559:in `block in traverse'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `each'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:2557:in `traverse'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1033:in `block in find_in_unresolved_tree'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `each'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/specification.rb:1032:in `find_in_unresolved_tree'
	from <internal:/opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:114:in `require'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:236:in `finish_resolve'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:303:in `block in activate_bin_path'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `synchronize'
	from /opt/homebrew/Cellar/ruby/3.0.2_1/lib/ruby/3.0.0/rubygems.rb:301:in `activate_bin_path'
	from /opt/homebrew/lib/ruby/gems/3.0.0/bin/chef-cli:23:in `<main>'

tas50 avatar Nov 11 '21 15:11 tas50

Hi @tas50 could you please share the OS & version? i tried running the command in cloned chef-workstation repo and saw this error.

mcblrvkarve:chef-workstation vkarve$ chef push -h
/opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/dependency.rb:313:in to_specs': Could not find 'bundler' (1.17.2) required by your /Users/vkarve/Documents/GitHub/chef-workstation/Gemfile.lock. (Gem::MissingSpecVersionError)
To update to the latest version installed on your system, run bundle update --bundler.
To install the missing version, run gem install bundler:1.17.2
Checked in 'GEM_PATH=/Users/vkarve/.chefdk/gem/ruby/3.0.0:/opt/chef-workstation/embedded/lib/ruby/gems/3.0.0' , execute gem env for more information
	from /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/dependency.rb:323:in to_spec'
	from /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb:62:in gem'
	from /usr/local/bin/chef-cli:366:in <main>'

vkarve-chef avatar Nov 15 '21 10:11 vkarve-chef

macOS 12.1

 ~  chef -v
Chef Workstation version: 21.11.683
Chef Infra Client version: 17.7.29
Chef InSpec version: 4.49.0
Chef CLI version: 5.4.2
Chef Habitat version: 1.6.420
Test Kitchen version: 3.1.1
Cookstyle version: 7.25.9

Ruby is provided by homebrew

 ~  which ruby
/opt/homebrew/opt/ruby/bin/ruby

This is a common setup where workstation is not a default ruby.

tas50 avatar Nov 15 '21 20:11 tas50

well with workstation ruby, rbenv ruby and homebrew ruby things worked fine for me with mac os 11 but when i upgraded to mac os 12.0.1 along with homebrew ruby (for both stable chef and development chef build)

i got this error

chef -v
Chef Workstation version: 21.11.679
Chef Infra Client version: 17.7.29
Chef InSpec version: 4.49.0
Chef CLI version: 5.4.2
Chef Habitat version: 1.6.420
Test Kitchen version: 3.1.1
Cookstyle version: 7.25.9

➜ ~

➜  ~ chef push -h
/usr/local/Cellar/ruby/3.0.3/lib/ruby/3.0.0/rubygems.rb:278:in `find_spec_for_exe': can't find gem chef-cli (>= 0.a) with executable chef-cli (Gem::GemNotFoundException)
	from /usr/local/Cellar/ruby/3.0.3/lib/ruby/3.0.0/rubygems.rb:297:in `activate_bin_path'
	from /usr/local/lib/ruby/gems/3.0.0/bin/chef-cli:23:in `<main>'
➜  ~ whcih ruby
zsh: command not found: whcih
➜  ~ which ruby
/usr/local/opt/ruby/bin/ruby
➜  ~ ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]

To me it looks more like homebrew ruby and mac os 12 issue, and in your case @tas50 it looks like you are on Mac m1 chip.

i5pranay93 avatar Dec 02 '21 08:12 i5pranay93

also if i use chef-cli it works fine

 bin /opt/chef-workstation/bin/chef-cli push -h
Usage: chef push POLICY_GROUP [ POLICY_FILE ] [options]

`chef push` Uploads an existing Policyfile.lock.json to a Chef Infra Server, along
with all the cookbooks contained in the policy lock. The policy lock is applied
to a specific POLICY_GROUP, which is a set of nodes that share the same
run_list and cookbooks.

See our detailed README for more information:

https://docs.chef.io/policyfile/

Options:

        --chef-license ACCEPTANCE    Accept the license for this product and any contained products ('accept', 'accept-no-persist', or 'accept-silent')
    -c, --config CONFIG_FILE         Path to configuration file
    -D, --debug                      Enable stacktraces and other debug output
    -h, --help                       Show this message
    -v, --version                    Show Chef Workstation version

➜  bin /opt/chef-workstation/bin/chef push -h
/usr/local/Cellar/ruby/3.0.3/lib/ruby/3.0.0/rubygems.rb:278:in `find_spec_for_exe': can't find gem chef-cli (>= 0.a) with executable chef-cli (Gem::GemNotFoundException)
	from /usr/local/Cellar/ruby/3.0.3/lib/ruby/3.0.0/rubygems.rb:297:in `activate_bin_path'
	from /usr/local/lib/ruby/gems/3.0.0/bin/chef-cli:23:in `<main>'

i5pranay93 avatar Dec 02 '21 09:12 i5pranay93