provisioners/ansible: fix galaxy paths on Windows
Close #6757 and update previous fix for #6740 (#6741). See also these places where the same regexp is used to address similar "Windows cases": -ec85548bd6/plugins/provisioners/chef/provisioner/chef_solo.rb (L99-L103)
-ec85548bd6/plugins/guests/windows/cap/rsync.rb (L6-L9)
This commit is contained in:
parent
d1d493c323
commit
1e38be237e
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
- provisioners/ansible_local: Fix error in `playbook` existence check when
|
- provisioners/ansible_local: Fix errors in absolute paths to playbook or
|
||||||
running on a Windows host [GH-6740]
|
galaxy resources when running on a Windows host [GH-6740, GH-6757]
|
||||||
|
|
||||||
## 1.8.1 (December 21, 2015)
|
## 1.8.1 (December 21, 2015)
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,7 @@ module VagrantPlugins
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def check_path(machine, path, test_args, error_message_key = nil)
|
def check_path(machine, path, test_args, error_message_key = nil)
|
||||||
remote_path = File.expand_path(path, @provisioning_path)
|
remote_path = Helpers::expand_path_in_unix_style(path, @provisioning_path)
|
||||||
|
|
||||||
# Remove drive letter if running on a Windows host
|
|
||||||
remote_path = remote_path.gsub(/^[a-zA-Z]:/, "")
|
|
||||||
|
|
||||||
if machine.communicate.ready? && !machine.communicate.test("test #{test_args} #{remote_path}")
|
if machine.communicate.ready? && !machine.communicate.test("test #{test_args} #{remote_path}")
|
||||||
if error_message_key
|
if error_message_key
|
||||||
|
|
|
@ -25,6 +25,12 @@ module VagrantPlugins
|
||||||
shell_command += shell_arg.join(' ')
|
shell_command += shell_arg.join(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.expand_path_in_unix_style(path, base_dir)
|
||||||
|
# Remove the possible drive letter, which is added
|
||||||
|
# by `File.expand_path` when running on a Windows host
|
||||||
|
File.expand_path(path, base_dir).sub(/^[a-zA-Z]:/, "")
|
||||||
|
end
|
||||||
|
|
||||||
def self.as_list_argument(v)
|
def self.as_list_argument(v)
|
||||||
v.kind_of?(Array) ? v.join(',') : v
|
v.kind_of?(Array) ? v.join(',') : v
|
||||||
end
|
end
|
||||||
|
|
|
@ -179,15 +179,16 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_galaxy_role_file(basedir)
|
def get_galaxy_role_file(base_dir)
|
||||||
File.expand_path(config.galaxy_role_file, basedir)
|
Helpers::expand_path_in_unix_style(config.galaxy_role_file, base_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_galaxy_roles_path(basedir)
|
def get_galaxy_roles_path(base_dir)
|
||||||
if config.galaxy_roles_path
|
if config.galaxy_roles_path
|
||||||
File.expand_path(config.galaxy_roles_path, basedir)
|
Helpers::expand_path_in_unix_style(config.galaxy_roles_path, base_dir)
|
||||||
else
|
else
|
||||||
File.join(Pathname.new(config.playbook).expand_path(basedir).parent, 'roles')
|
playbook_path = Helpers::expand_path_in_unix_style(config.playbook, base_dir)
|
||||||
|
File.join(Pathname.new(playbook_path).parent, 'roles')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue