Skip to content
This repository was archived by the owner on Jul 14, 2021. It is now read-only.

Error using embedded knife/chef-zero when creating environment #159

Closed
christinedraper opened this issue Sep 14, 2014 · 3 comments
Closed
Labels
Type: Bug Doesn't work as expected.

Comments

@christinedraper
Copy link

Not sure this is right place to raise - apologies if not. I'm using chefDK 12.0.0.alpha.1. When I run knife serve and then knife environment create foo or knife role create bar I get an exception thrown on server . When I run using chef-zero, it works OK.

Here's the exception for the knife environment create:

ERROR: internal server error
Response: Exception raised!  #<NoMethodError: undefined method `has_key?' for #<Chef::Environment:0x000000035d47a8>>
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/data_handler/data_handler_base.rb:34:in `block in normalize_hash'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/data_handler/data_handler_base.rb:33:in `each_pair'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/data_handler/data_handler_base.rb:33:in `normalize_hash'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/data_handler/environment_data_handler.rb:9:in `normalize'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb:64:in `minimize'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb:57:in `write'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/file_system/file_system_entry.rb:56:in `create_child'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/file_system/multiplexed_dir.rb:44:in `create_child'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/chef_fs_data_store.rb:70:in `block in create'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/chef_fs_data_store.rb:395:in `with_dir'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.0.alpha.1/lib/chef/chef_fs/chef_fs_data_store.rb:68:in `create'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/data_store/v1_to_v2_adapter.rb:56:in `block in create'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/data_store/v1_to_v2_adapter.rb:168:in `fix_exceptions'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/data_store/v1_to_v2_adapter.rb:55:in `create'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/rest_base.rb:92:in `create_data'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/endpoints/rest_list_endpoint.rb:30:in `post'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/rest_base.rb:29:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/rest_router.rb:23:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-2.2/lib/chef_zero/server.rb:443:in `block in app'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/opt/chefdk/embedded/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/opt/chefdk/embedded/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/opt/chefdk/embedded/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
@danielsdeleo
Copy link
Contributor

I'm seeing a few things here. First, you shouldn't be picking up chef-12.0.0.alpha.1 when you run knife in ChefDK. How is your PATH configured? You should have either /usr/bin/knife or /opt/chefdk/bin/knife first in your PATH.

Second, the stack trace does at first glance look like a bug in Chef 12 alpha. @jkeiser thoughts?

@lamont-granquist
Copy link
Contributor

i'm pretty sure that chef-12 requires chef-zero 3.x, and this is probably solved by installing chef-dk 0.2.2 and/or making sure bin comes before embedded/bin (which would make roughly the fifth time i've seen the PATH bug in the past 2 weeks if that is all it is).

@christinedraper
Copy link
Author

I had /opt/chefdk/embedded/bin first in the path. Changing that to /opt/chefdk/bin now means I pick up chef 11.16. Also, now I try it again, the exception has gone away - even with the old path. Sorry for the bother and thanks for the help! (For the record, I did update chefDK since the original problem... maybe that fixed it)

ksubrama pushed a commit that referenced this issue Jan 11, 2016
Remove the leftover -a in the postrm scripts on centos.
@thommay thommay added Type: Bug Doesn't work as expected. and removed Bug labels Feb 1, 2017
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Doesn't work as expected.
Development

No branches or pull requests

4 participants