-1

我正在使用厨师独奏。如何使用独奏处理带有厨师保险库的刀?我在厨师论坛上发布了以下内容,但 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' ]
4

1 回答 1

1

看起来这是独奏和客户端之间的 API 不匹配。Chef Vault 代码正在检查两个异常,如果该项目在客户端模式下不存在,则会引发两个异常,但在单人模式下则不会。更具体地说,单独代码路径没有足够的错误检查DataBagItem.load$name_keys一种解决方法是在磁盘上创建项目,{}以便它至少可以加载一些内容。

于 2016-03-03T01:36:52.483 回答