Update command builder now that provisioning_path has moved to runtime
This commit is contained in:
parent
a822bb2aa6
commit
40b94afeb5
|
@ -1,7 +1,7 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Chef
|
module Chef
|
||||||
class CommandBuilder
|
class CommandBuilder
|
||||||
def initialize(config, client_type, is_windows=false, is_ui_colored=false)
|
def initialize(config, client_type, is_windows = false, is_ui_colored = false)
|
||||||
@client_type = client_type
|
@client_type = client_type
|
||||||
@config = config
|
@config = config
|
||||||
@is_windows = is_windows
|
@is_windows = is_windows
|
||||||
|
@ -25,7 +25,10 @@ module VagrantPlugins
|
||||||
def chef_binary_path
|
def chef_binary_path
|
||||||
binary_path = "chef-#{@client_type}"
|
binary_path = "chef-#{@client_type}"
|
||||||
if @config.binary_path
|
if @config.binary_path
|
||||||
binary_path = guest_friendly_path(File.join(@config.binary_path, binary_path))
|
binary_path = File.join(@config.binary_path, binary_path)
|
||||||
|
if windows?
|
||||||
|
binary_path = windows_friendly_path(binary_path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
binary_path
|
binary_path
|
||||||
end
|
end
|
||||||
|
@ -34,19 +37,32 @@ module VagrantPlugins
|
||||||
chef_arguments = "-c #{provisioning_path("#{@client_type}.rb")}"
|
chef_arguments = "-c #{provisioning_path("#{@client_type}.rb")}"
|
||||||
chef_arguments << " -j #{provisioning_path("dna.json")}"
|
chef_arguments << " -j #{provisioning_path("dna.json")}"
|
||||||
chef_arguments << " #{@config.arguments}" if @config.arguments
|
chef_arguments << " #{@config.arguments}" if @config.arguments
|
||||||
chef_arguments << " --no-color" unless @is_ui_colored
|
chef_arguments << " --no-color" unless color?
|
||||||
chef_arguments.strip
|
chef_arguments.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def provisioning_path(file)
|
def provisioning_path(file)
|
||||||
guest_friendly_path(File.join(@config.provisioning_path, file))
|
if windows?
|
||||||
|
path = @config.provisioning_path || "C:/vagrant-chef"
|
||||||
|
return windows_friendly_path(File.join(path, file))
|
||||||
|
else
|
||||||
|
path = @config.provisioning_path || "/tmp/vagrant-chef"
|
||||||
|
return File.join(path, file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def guest_friendly_path(path)
|
def windows_friendly_path(path)
|
||||||
return path unless @is_windows
|
path = path.gsub("/", "\\")
|
||||||
path.gsub!("/", "\\")
|
|
||||||
path = "c:#{path}" if path.start_with?("\\")
|
path = "c:#{path}" if path.start_with?("\\")
|
||||||
path
|
return path
|
||||||
|
end
|
||||||
|
|
||||||
|
def windows?
|
||||||
|
!!@is_windows
|
||||||
|
end
|
||||||
|
|
||||||
|
def color?
|
||||||
|
!!@is_ui_colored
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue