knife-solo_data_bag
knife-solo_data_bag copied to clipboard
show and edit commands fail with "undefined method 'version' for nil:NilClass"
Create worked fine, but then I couldn't show or edit the data bags.
$ knife -v
Chef: 12.14.60
Sanitized output follows:
$ knife solo --local-mode data bag edit my_project database -c ./solo.rb -VV
INFO: Using configuration from /path/to/project/solo.rb
INFO: Started chef-zero at chefzero://localhost:8889 with repository at /path/to/project
One version per cookbook
/var/lib/gems/2.3.0/gems/knife-solo_data_bag-2.1.0/lib/chef/knife/solo_data_bag_edit.rb:32:in `run': undefined method `version' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/vendor_ruby/chef/knife.rb:430:in `block in run_with_pretty_exceptions'
from /usr/lib/ruby/vendor_ruby/chef/local_mode.rb:44:in `with_server_connectivity'
from /usr/lib/ruby/vendor_ruby/chef/knife.rb:429:in `run_with_pretty_exceptions'
from /usr/lib/ruby/vendor_ruby/chef/knife.rb:219:in `run'
from /usr/lib/ruby/vendor_ruby/chef/application/knife.rb:156:in `run'
from /usr/bin/knife:25:in `<main>'
The solo.rb
file sets some paths to be project-relative:
root = File.absolute_path(File.dirname(__FILE__))
file_cache_path '/var/chef/cache'
cookbook_path root + '/cookbooks'
environment_path root + '/environments'
data_bag_path root + '/data_bags'
This is using chef installed from the Debian stretch repos.
Commenting out the check in the solo_data_bag_edit.rb
or solo_data_bag_show.rb
"fixes" it.