summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-18 09:23:46 -0700
committerGitHub <noreply@github.com>2020-05-18 09:23:46 -0700
commit72e0bcb39fc422886b96117c4f7587750ea30c79 (patch)
treee49fa5424f2c84586c809b09125b97e59a5ded96
parentb84d384a058d2159c610771beccfe7728c28a688 (diff)
parent8c75291f3f70bfb25547369eb9cf9a50cf74433d (diff)
downloadchef-72e0bcb39fc422886b96117c4f7587750ea30c79.tar.gz
Merge pull request #9878 from bobchaos/win_bootstrap_2
fix windows bootstrap; replicate chef/chef/pull/9839 by Chad Jessup
-rw-r--r--lib/chef/knife/core/windows_bootstrap_context.rb2
-rw-r--r--spec/unit/knife/core/windows_bootstrap_context_spec.rb6
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" } }