I am using chef solo. How do I deal with knife with chef vault using solo? I posted the below on chef forum but those at opscode are unresponsive sad to say.
knife vault create secrets database '{"username": "root", "password": "mypassword"}' --mode solo -VV
INFO: Using configuration from /home/ubuntu/workspace/zen-chef/chef-repo/knife.rb
/usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/data_bag_item.rb:129:in `from_hash': undefined method `delete' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/data_bag_item.rb:161:in `load'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-vault-2.8.0/lib/chef-vault/item_keys.rb:116:in `load'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-vault-2.8.0/lib/chef-vault/item.rb:73:in `load_keys'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-vault-2.8.0/lib/chef-vault/item.rb:265:in `load'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-vault-2.8.0/lib/chef/knife/vault_create.rb:58:in `run'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/knife.rb:416:in `block in run_with_pretty_exceptions'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:in `with_server_connectivity'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/knife.rb:415:in `run_with_pretty_exceptions'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/knife.rb:214:in `run'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/lib/chef/application/knife.rb:148:in `run'
from /usr/local/lib/ruby/gems/2.3.0/gems/chef-12.7.2/bin/knife:25:in `<top (required)>'
from /usr/local/bin/knife:23:in `load'
from /usr/local/bin/knife:23:in `<main>'
Here is my knife.rb file
current_dir = File.dirname(__FILE__)
user = ENV['OPSCODE_USER'] || ENV['USER']
root = File.absolute_path(File.dirname(__FILE__))
chef_repo_path rootroot = File.absolute_path(File.dirname(__FILE__))
chef_repo_path root
log_level :debug
log_location STDOUT
node_name `hostname`
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path [ "#{root}/cookbooks","#{root}/site-cookbooks","#{root}/berks-cookbooks" ]
cookbook_copyright 'Zen'
cookbook_license 'apachev2'
cookbook_email 'test'
environment_path "../#{current_dir}/environments"
data_bag_path '../../zen-settings'
knife[:vault_admins] = [ 'test' ]
Looks like it's a mismatch in the APIs between solo and client. The Chef Vault code is checking for two exceptions that would be thrown if the item didn't exist when in client mode, but not that one which is the same thing in solo mode. More specifically there isn't enough error checking in
DataBagItem.loadfor the solo code path. A workaround would be to create the$name_keysitem on disk with just{}so it has something to load at least.