summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-10-29 14:06:24 -0700
committerGitHub <noreply@github.com>2020-10-29 14:06:24 -0700
commitddd1300bd14acf024f8fe844c2cef906bddb8a67 (patch)
tree9f62125a7cb4156cbde2e8e53a2dfb2089e97100
parentb0fe0a0772c66514b0f2d2cc15ff55138bc62e30 (diff)
parent39f3e802f1cb534cfed1784f8c141700ee08406a (diff)
downloadchef-ddd1300bd14acf024f8fe844c2cef906bddb8a67.tar.gz
Merge pull request #10577 from chef/secret_file
Signed-off-by: Tim Smith <tsmith@chef.io>
-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?