cparedes / knife-file

Couple of useful utilities for dealing with files (right now, just encrypting/decrypting files)
http://redbluemagenta.com
12 stars 6 forks source link

edit command raises NoMethodError on Chef 10 when used with --secret-file option #4

Closed rhenning closed 10 years ago

rhenning commented 10 years ago

I haven't had much of a chance to dive into this just yet but suspect it's cheesed off about the workaround at https://github.com/opscode/chef/blob/10.32.2/chef/lib/chef/knife/core/object_loader.rb#L88

Diagnostic output is below:

rhenning@mactop:Provisioning$ bundle list | egrep 'chef|knife-file'
  * chef (10.32.2)
  * knife-file (0.3.0)

rhenning@mactop:Provisioning$ cat chef/data_bags/credentials/test.json 
{
  "id": "test",
  "key": "WWfR17dtnDdpNiGH6F1G+Q==\n"
}

rhenning@mactop:Provisioning$ EDITOR=vim bundle exec knife file edit chef/data_bags/credentials/test.json --secret-file ~/.chef/encrypted_data_bag_secret -VV
DEBUG: Using configuration from /Users/rhenning/.chef/knife.rb
/Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/chef-10.32.2/lib/chef/knife/core/object_loader.rb:92:in `object_from_file': undefined method `json_create' for Chef::EncryptedDataBagItem:Class (NoMethodError)
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/knife-file-0.3.0/lib/chef/knife/file_edit.rb:47:in `load_file'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/knife-file-0.3.0/lib/chef/knife/file_edit.rb:70:in `run'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/chef-10.32.2/lib/chef/knife.rb:408:in `run_with_pretty_exceptions'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/chef-10.32.2/lib/chef/knife.rb:168:in `run'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/chef-10.32.2/lib/chef/application/knife.rb:125:in `run'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/chef-10.32.2/bin/knife:25:in `<top (required)>'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/bin/knife:23:in `load'
    from /Users/rhenning/.rbenv/versions/1.9.3-p125/bin/knife:23:in `<main>'
rhenning commented 10 years ago

Closed by https://github.com/cparedes/knife-file/pull/5