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 Chef
|
||||
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
|
||||
@config = config
|
||||
@is_windows = is_windows
|
||||
|
@ -25,7 +25,10 @@ module VagrantPlugins
|
|||
def chef_binary_path
|
||||
binary_path = "chef-#{@client_type}"
|
||||
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
|
||||
binary_path
|
||||
end
|
||||
|
@ -34,19 +37,32 @@ module VagrantPlugins
|
|||
chef_arguments = "-c #{provisioning_path("#{@client_type}.rb")}"
|
||||
chef_arguments << " -j #{provisioning_path("dna.json")}"
|
||||
chef_arguments << " #{@config.arguments}" if @config.arguments
|
||||
chef_arguments << " --no-color" unless @is_ui_colored
|
||||
chef_arguments << " --no-color" unless color?
|
||||
chef_arguments.strip
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def guest_friendly_path(path)
|
||||
return path unless @is_windows
|
||||
path.gsub!("/", "\\")
|
||||
def windows_friendly_path(path)
|
||||
path = path.gsub("/", "\\")
|
||||
path = "c:#{path}" if path.start_with?("\\")
|
||||
path
|
||||
return path
|
||||
end
|
||||
|
||||
def windows?
|
||||
!!@is_windows
|
||||
end
|
||||
|
||||
def color?
|
||||
!!@is_ui_colored
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue