diff options
author | Marc Chamberland <chamberland.marc@gmail.com> | 2020-05-15 16:44:22 -0400 |
---|---|---|
committer | Marc Chamberland <chamberland.marc@gmail.com> | 2020-05-16 11:48:51 -0400 |
commit | 8c75291f3f70bfb25547369eb9cf9a50cf74433d (patch) | |
tree | e49fa5424f2c84586c809b09125b97e59a5ded96 | |
parent | b84d384a058d2159c610771beccfe7728c28a688 (diff) | |
download | chef-8c75291f3f70bfb25547369eb9cf9a50cf74433d.tar.gz |
fix windows bootstrap; replicate https://github.com/chef/chef/pull/9839 by Chad Jessup
This fixes bootstrapping on Windows. All credit goes to Chad Jessup <chad.jessup@gmail.com>
but since the original PR was left without DCO I'm replicating it here, with valid DCO.
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
-rw-r--r-- | lib/chef/knife/core/windows_bootstrap_context.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/core/windows_bootstrap_context_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb index e05409f6c4..2ef9f16499 100644 --- a/lib/chef/knife/core/windows_bootstrap_context.rb +++ b/lib/chef/knife/core/windows_bootstrap_context.rb @@ -160,7 +160,7 @@ class Chef def start_chef bootstrap_environment_option = bootstrap_environment.nil? ? "" : " -E #{bootstrap_environment}" - start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\bin;#{ChefConfig::Config.c_opscode_dir}\\#{ChefConfig::Dist::DIR_SUFFIX}\\embedded\\bin\;%PATH%\"\n" + start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\bin;#{ChefConfig::Config.c_opscode_dir}\\embedded\\bin\;%PATH%\"\n" start_chef << "#{Chef::Dist::CLIENT} -c #{ChefConfig::Config.etc_chef_dir(true)}/client.rb -j #{ChefConfig::Config.etc_chef_dir(true)}/first-boot.json#{bootstrap_environment_option}\n" end diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb index 656b05b905..e0ca7f17ab 100644 --- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb +++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb @@ -181,6 +181,12 @@ describe Chef::Knife::Core::WindowsBootstrapContext do end end + describe "#start_chef" do + it "returns the expected string" do + expect(bootstrap_context.start_chef).to match(%r{SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;C:\/opscode\/chef\\bin;C:\/opscode\/chef\\embedded\\bin\;%PATH%\"\n}) + end + end + describe "msi_url" do context "when msi_url config option is not set" do let(:config) { { channel: "stable" } } |