New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method "locate_config_file" with chef 12 / chefdk 0.3.5 #25

Closed
cheaprbytheduzn opened this Issue Nov 26, 2014 · 8 comments

Comments

Projects
None yet
6 participants
@cheaprbytheduzn

cheaprbytheduzn commented Nov 26, 2014

Upon upgrading from chefdk 0.2.0 to 0.3.5, knife block broke down emitting:

Exception: NoMethodError: undefined method `locate_config_file' for Chef::Knife:Class

The 0.3.5 version of:
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-11.6.2/lib/chef/knife.rb

does indeed have changes to locate_config_file from the comparable 0.2.0 which no doubt has implicatations for knife-block's own get_config_file / locate_config_file logic.

There were a few intervening releases from 0.2.0 to 0.3.5 that I did not use.

Chefdk 0.3.5 has no problems with the knife-block gem removed and knife-block works fine when installed with 0.2.0.

To workaround the problem, I donwgraded to 0.2.0 for now.

@solarce

This comment has been minimized.

Contributor

solarce commented Dec 9, 2014

I'm encountering this when Chef 12 is installed via rubygems

✘  [10:51:14]  bburton@althalus  ~/code/lookout/sr71_local_bootstrap   master ●  knife block list -VV
WARNING: No knife configuration file found
/Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:16:in `get_config_file': undefined method `locate_config_file' for Chef::Knife:Class (NoMet
hodError)
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:38:in `chef_config_base'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:75:in `check_block_setup'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:142:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:417:in `block in run_with_pretty_exceptions'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/local_mode.rb:38:in `with_server_connectivity'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:416:in `run_with_pretty_exceptions'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:213:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/application/knife.rb:139:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/bin/knife:25:in `<top (required)>'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/knife:23:in `load'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/knife:23:in `<main>'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/ruby_executable_hooks:15:in `eval'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/ruby_executable_hooks:15:in `<main>'

You can reproduce with:

rvm use ruby-2.1.2@chef12 --create
rvm use ruby-2.1.2@chef12
gem install chef knife-block
knife block list
 [11:10:58]  bburton@althalus  ~/code/lookout/sr71_local_bootstrap   master ●  knife block list -VV
WARNING: No knife configuration file found
/Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:16:in `get_config_file': undefined method `locate_config_file' for Chef::Knife:Class (NoMet
hodError)
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:38:in `chef_config_base'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:75:in `check_block_setup'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/knife-block-0.1.1/lib/chef/knife/block.rb:142:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:417:in `block in run_with_pretty_exceptions'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/local_mode.rb:38:in `with_server_connectivity'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:416:in `run_with_pretty_exceptions'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/knife.rb:213:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/lib/chef/application/knife.rb:139:in `run'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/gems/chef-12.0.0/bin/knife:25:in `<top (required)>'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/knife:23:in `load'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/knife:23:in `<main>'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/ruby_executable_hooks:15:in `eval'
        from /Users/bburton/.rvm/gems/ruby-2.1.2@chef12/bin/ruby_executable_hooks:15:in `<main>'
@cheeseplus

This comment has been minimized.

cheeseplus commented Dec 9, 2014

Just confirming this in both Chef 12 gem install and ChefDK 0.3.5

@solarce

This comment has been minimized.

Contributor

solarce commented Dec 9, 2014

I suspect it's the version matching in https://github.com/greenandsecure/knife-block/blob/master/lib/chef/knife/block.rb#L13-L21 but I'm too much of a ruby n00b to know how to test a fix, off-hand

@solarce solarce changed the title from Undefined method "locate_config_file" with chefdk 0.3.5 to Undefined method "locate_config_file" with chef 12 / chefdk 0.3.5 Dec 10, 2014

@clintoncwolfe

This comment has been minimized.

clintoncwolfe commented Jan 9, 2015

#26 is a proposed fix for this

@onlyhavecans

This comment has been minimized.

Contributor

onlyhavecans commented Feb 3, 2015

This is also broken in chefdk 0.4.0 which is not too surprising.

@ikurochkin

This comment has been minimized.

ikurochkin commented Feb 26, 2015

+1

@solarce

This comment has been minimized.

Contributor

solarce commented Mar 1, 2015

We should have this fixed up soon, got a couple PRs to get merged, but we're close!

@solarce

This comment has been minimized.

Contributor

solarce commented Mar 8, 2015

Fixes for this got merged in #37.

@solarce solarce closed this Mar 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment