Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

remove ~ in path when cooking on a windows host to prevent the creati… #462

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/chef/knife/solo_cook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ def validate!
end

def provisioning_path
# TODO ~ will likely break on cmd.exe based windows sessions
config_value(:provisioning_path, '~/chef-solo')
if windows_node?
config_value(:provisioning_path, 'chef-solo')
else
config_value(:provisioning_path, '~/chef-solo')
end
end

def sync_kitchen
Expand Down
10 changes: 10 additions & 0 deletions test/solo_cook_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,15 @@ def test_passes_override_runlist_to_chef_solo
assert_chef_solo_option "--override-runlist=sandbox::default", "-o sandbox::default"
end

def test_removes_tilde_on_windows_node
in_kitchen do
cmd = command("somehost")
cmd.unstub(:windows_node?)
cmd.stubs(:windows_node? => true)
assert_equal 'chef-solo', cmd.provisioning_path
end
end

# Asserts that the chef_solo_option is passed to chef-solo iff cook_option
# is specified for the cook command
def assert_chef_solo_option(cook_option, chef_solo_option)
Expand All @@ -368,6 +377,7 @@ def command(*args)
cmd.stubs(:run_portable_mkdir_p)
cmd.stubs(:rsync)
cmd.stubs(:stream_command).returns(SuccessfulResult.new)
cmd.stubs(:windows_node? => false)
cmd
end
end