summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormwrock <matt@mattwrock.com>2020-10-29 13:38:30 -0700
committermwrock <matt@mattwrock.com>2020-10-29 13:38:30 -0700
commit39f3e802f1cb534cfed1784f8c141700ee08406a (patch)
tree6de65b7cf20289e0ad53998b821134866d4d322e
parentef9649e543b6218053fc98208ce884cc81882ce1 (diff)
downloadchef-39f3e802f1cb534cfed1784f8c141700ee08406a.tar.gz
fix secret options in windows bootstrap
Signed-off-by: mwrock <matt@mattwrock.com>
-rw-r--r--lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb4
-rw-r--r--lib/chef/knife/core/windows_bootstrap_context.rb9
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb b/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb
index 9c8f5972d4..7aa7be49f8 100644
--- a/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb
+++ b/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb
@@ -230,9 +230,9 @@ echo Writing validation key...
echo Validation key written.
@echo on
-<% if @config[:secret] -%>
+<% if secret -%>
> <%= bootstrap_directory %>\encrypted_data_bag_secret (
- <%= secret %>
+ <%= encrypted_data_bag_secret %>
)
<% end -%>
diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb
index ae8d3f37eb..395bc025e0 100644
--- a/lib/chef/knife/core/windows_bootstrap_context.rb
+++ b/lib/chef/knife/core/windows_bootstrap_context.rb
@@ -32,6 +32,7 @@ class Chef
class WindowsBootstrapContext < BootstrapContext
attr_accessor :config
attr_accessor :chef_config
+ attr_accessor :secret
def initialize(config, run_list, chef_config, secret = nil)
@config = config
@@ -49,8 +50,8 @@ class Chef
end
end
- def secret
- escape_and_echo(config[:secret])
+ def encrypted_data_bag_secret
+ escape_and_echo(@secret)
end
def trusted_certs_script
@@ -134,8 +135,8 @@ class Chef
client_rb << %Q{no_proxy "#{config[:bootstrap_no_proxy]}"\n}
end
- if config[:secret]
- client_rb << %Q{encrypted_data_bag_secret "#{ChefConfig::Config.etc_chef_dir(windows: true)}/encrypted_data_bag_secret"\n}
+ if secret
+ client_rb << %Q{encrypted_data_bag_secret "#{ChefConfig::PathHelper.escapepath(ChefConfig::Config.etc_chef_dir(windows: true))}\\\\encrypted_data_bag_secret"\n}
end
unless trusted_certs_script.empty?