jkeiser / knife-essentials

Knife commands to treat the Chef server like a filesystem
Apache License 2.0
81 stars 26 forks source link

knife deps fails ungracefully on missing cookbook #75

Closed yoniLavi closed 11 years ago

yoniLavi commented 11 years ago

Running knife deps foo -VV when foo is either missing or is a non-chef directory causes the following exception:

$ knife deps foo -VV
DEBUG: Using configuration from /home/yoni/chef-repo/.chef/knife.rb
DEBUG: No chefignore file found at /home/yoni/chef-repo/cookbooks/chefignore no files will be ignored
/home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:71:in `get_dependencies': undefined method `chef_object' for #<ChefFS::FileSystem::NonexistentFSObject:0x00000002a67910> (NoMethodError)
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:48:in `print_flattened_dependencies'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:40:in `block (2 levels) in run'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef_fs/file_system.rb:34:in `call'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef_fs/file_system.rb:34:in `list'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef_fs/file_system.rb:46:in `list'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef_fs/file_system.rb:46:in `list'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:36:in `block in run'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:35:in `each'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/knife-essentials-0.8.1/lib/chef/knife/deps_essentials.rb:35:in `run'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/chef-10.16.4/lib/chef/knife.rb:408:in `run_with_pretty_exceptions'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/chef-10.16.4/lib/chef/knife.rb:168:in `run'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/chef-10.16.4/lib/chef/application/knife.rb:123:in `run'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/gems/chef-10.16.4/bin/knife:25:in `<top (required)>'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/bin/knife:19:in `load'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/bin/knife:19:in `<main>'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/yoni/.rvm/gems/ruby-1.9.3-p194@chef/bin/ruby_noexec_wrapper:14:in `<main>'

I originally encountered the exception in the middle of a long dependency chain, when after printing many correct dependencies, the command crashed on a cookbook that was accidentally deleted.

jkeiser commented 11 years ago

Fixed in bb71ad9e4f1b54f4f8ca6635229d97b8ba9c410d (0.8.2 released with this fix, among others)

jkeiser commented 11 years ago

Thanks tons for the report :)

yoniLavi commented 11 years ago

Thanks for your work on this, I really appreciate the new tools.

On Fri, Jan 4, 2013 at 7:44 PM, John Keiser notifications@github.comwrote:

Thanks tons for the report :)

— Reply to this email directly or view it on GitHubhttps://github.com/jkeiser/knife-essentials/issues/75#issuecomment-11892165.

Yoni Yalovitsky. Fewbytes. http://fewbytes.com/ Tel: +972 54 7873387