diff options
author | mwrock <matt@mattwrock.com> | 2020-10-29 12:56:15 -0700 |
---|---|---|
committer | mwrock <matt@mattwrock.com> | 2020-10-29 12:56:15 -0700 |
commit | c1916dd658f9707d72dff75cbb220fe2e0c24f9b (patch) | |
tree | b7ce8d56b6650a2dc0e4ea84510ecf4e20101857 | |
parent | ef9649e543b6218053fc98208ce884cc81882ce1 (diff) | |
download | chef-secret_file.tar.gz |
fix secret options in windows bootstrapsecret_file
Signed-off-by: mwrock <matt@mattwrock.com>
-rw-r--r-- | lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb | 4 | ||||
-rw-r--r-- | lib/chef/knife/core/windows_bootstrap_context.rb | 10 |
2 files changed, 9 insertions, 5 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..3bbc314458 100644 --- a/lib/chef/knife/core/windows_bootstrap_context.rb +++ b/lib/chef/knife/core/windows_bootstrap_context.rb @@ -49,8 +49,12 @@ class Chef end end + def encrypted_data_bag_secret + escape_and_echo(@secret) + end + def secret - escape_and_echo(config[:secret]) + @secret end def trusted_certs_script @@ -134,8 +138,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? |