summaryrefslogtreecommitdiff
path: root/lib/chef/knife/bootstrap/chef_vault_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/knife/bootstrap/chef_vault_handler.rb')
-rw-r--r--lib/chef/knife/bootstrap/chef_vault_handler.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/chef/knife/bootstrap/chef_vault_handler.rb b/lib/chef/knife/bootstrap/chef_vault_handler.rb
index 7007e1403b..e189839857 100644
--- a/lib/chef/knife/bootstrap/chef_vault_handler.rb
+++ b/lib/chef/knife/bootstrap/chef_vault_handler.rb
@@ -21,7 +21,7 @@ class Chef
class ChefVaultHandler
# @return [Hash] knife merged config, typically @config
- attr_accessor :knife_config
+ attr_accessor :config
# @return [Chef::Knife::UI] ui object for output
attr_accessor :ui
@@ -29,11 +29,15 @@ class Chef
# @return [Chef::ApiClient] vault client
attr_reader :client
- # @param knife_config [Hash] knife merged config, typically @config
+ # @param config [Hash] knife merged config, typically @config
# @param ui [Chef::Knife::UI] ui object for output
- def initialize(knife_config: {}, ui: nil)
- @knife_config = knife_config
- @ui = ui
+ def initialize(config: {}, knife_config: nil, ui: nil)
+ @config = config
+ unless knife_config.nil?
+ # the knife_config argument becomes deprecated in Chef-16, don't use it
+ @config = knife_config
+ end
+ @ui = ui
end
# Updates the chef vault items for the newly created client.
@@ -85,17 +89,17 @@ class Chef
# @return [String] string with serialized JSON representing the chef vault items
def bootstrap_vault_json
- knife_config[:bootstrap_vault_json]
+ config[:bootstrap_vault_json]
end
# @return [String] JSON text in a file representing the chef vault items
def bootstrap_vault_file
- knife_config[:bootstrap_vault_file]
+ config[:bootstrap_vault_file]
end
# @return [Hash] Ruby object representing the chef vault items to create
def bootstrap_vault_item
- knife_config[:bootstrap_vault_item]
+ config[:bootstrap_vault_item]
end
# Helper to return a ruby object represeting all the data bags and items