summaryrefslogtreecommitdiff
path: root/lib/chef/knife/bootstrap.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-09-16 09:37:17 -0700
committertyler-ball <tyleraball@gmail.com>2014-09-29 08:31:08 -0700
commit32310137000ca0983f3952eb3febb08c93c84bdc (patch)
tree4e7dc15e572bd94eb740d500da64b488826586e0 /lib/chef/knife/bootstrap.rb
parente121b47679cb38fe8a1571405d9f8f8969266122 (diff)
downloadchef-32310137000ca0983f3952eb3febb08c93c84bdc.tar.gz
Finishing UX spec - storing CL options in different config values so we can correctly validate, updating bootstrap to use shared module
Diffstat (limited to 'lib/chef/knife/bootstrap.rb')
-rw-r--r--lib/chef/knife/bootstrap.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 36a0fc1e47..6d628f0224 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -17,11 +17,13 @@
#
require 'chef/knife'
+require 'chef/knife/data_bag_secret_options'
require 'erubis'
class Chef
class Knife
class Bootstrap < Knife
+ include DataBagSecretOptions
deps do
require 'chef/knife/core/bootstrap_context'
@@ -157,17 +159,6 @@ class Chef
Chef::Config[:knife][:hints][name] = path ? Chef::JSONCompat.parse(::File.read(path)) : Hash.new
}
- option :secret,
- :short => "-s SECRET",
- :long => "--secret ",
- :description => "The secret key to use to encrypt data bag item values",
- :proc => Proc.new { |s| Chef::Config[:knife][:secret] = s }
-
- option :secret_file,
- :long => "--secret-file SECRET_FILE",
- :description => "A file containing the secret key to use to encrypt data bag item values",
- :proc => Proc.new { |sf| Chef::Config[:knife][:secret_file] = sf }
-
option :bootstrap_url,
:long => "--bootstrap-url URL",
:description => "URL to a custom installation script",
@@ -248,7 +239,8 @@ class Chef
def render_template
template_file = find_template
template = IO.read(template_file).chomp
- context = Knife::Core::BootstrapContext.new(config, config[:run_list], Chef::Config)
+ secret = encryption_secret_provided?(false) ? read_secret : nil
+ context = Knife::Core::BootstrapContext.new(config, config[:run_list], Chef::Config, secret)
Erubis::Eruby.new(template).evaluate(context)
end