刀,独奏和保险库 - data_bag_item.rb:129:在`from_hash':未定义的方法`删除' for nil:NilClass(NoMethodError)

时间:2016-03-03 00:43:59

标签: chef chef-vault

我正在使用厨师独奏。如何使用独奏处理厨师保险库的刀?我下面贴的上厨师论坛,但那些Opscode公司反应迟钝伤感地说。

 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>'

这是我的knife.rb文件

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' ]

1 个答案:

答案 0 :(得分:1)

看起来它在solo和客户端之间的API不匹配。 Chef Vault code正在检查在客户端模式下项目不存在时会抛出的两个异常,而不是单独模式下相同的异常。更具体地说,DataBagItem.load中的独立代码路径没有足够的错误检查。解决方法是在磁盘上创建仅$name_keys的{​​{1}}项,以便至少可以加载。