Commit e588223e authored by Volker Hilsheimer's avatar Volker Hilsheimer

Get rid of boxname hack, pass box name explicitly

parent 7daab19d
......@@ -146,7 +146,6 @@ def add_role(box, role, name)
role_params[role] = role_name
end
role_params["boxname"] = name
role_params.each do |key, value|
if value.nil?
next
......@@ -260,7 +259,7 @@ def add_role(box, role, name)
if File.file?(provisioning_file)
require provisioning_file
begin
eval("#{role}_provision(box, role_params)")
eval("#{role}_provision(box, name, role_params)")
activity = true
rescue => error
puts "==> #{name}: Error with #{role} role: #{error}"
......
def azure_provision(box, args)
def azure_provision(box, name, args)
if !args.is_a?(Hash)
raise "Argument error: expecting args to be a hash"
end
box.vm.provider :azure do |azure, override|
args.each do |key, value|
case key
when "boxname"
else
eval("azure.#{key} = \"#{value}\"")
end
eval("azure.#{key} = \"#{value}\"")
end
end
end
def docker_provision(box, role_params)
def docker_provision(box, name, role_params)
detach = true
restart = "always"
name = role_params["docker"]
docker = role_params["docker"]
image = role_params["image"]
cmd = role_params["cmd"]
args = role_params["args"]
......@@ -10,7 +10,7 @@ def docker_provision(box, role_params)
restart = role_params["restart"] unless role_params["restart"].nil?
box.vm.provision "#{name}:docker container",
type: :docker do |docker|
docker.run name,
docker.run docker,
image: image,
cmd: cmd,
auto_assign_name: false,
......
def hostscript_provision(box, args)
def hostscript_provision(box, name, args)
if preprovision = args["preprovision"]
box.trigger.before [:up, :provision] do |trigger|
trigger.name = "postprovisioning hostscript"
......
......@@ -117,8 +117,7 @@ def mutagen_guest_to_host(box, name, alphas, betas)
end
end
def mutagen_provision(box, role_params)
name = role_params["boxname"]
def mutagen_provision(box, name, role_params)
paths = role_params["paths"]
role_params.delete("paths")
......
def script_provision(box, args)
def script_provision(box, name, args)
script = args["script"]
if !script.is_a?(String)
raise "Argument error: expecting a 'script' string"
......
def upload_provision(box, role_params)
def upload_provision(box, name, role_params)
files = role_params["files"]
if !files.is_a?(Hash)
raise "Argument error: expecting a 'files' hash table from source to destination"
......
def virtualbox_provision(box, args)
def virtualbox_provision(box, name, args)
if !args.is_a?(Hash)
raise "Argument error: expecting args to be a hash"
end
......
def vmware_fusion_provision(box, args)
def vmware_fusion_provision(box, name, args)
if !args.is_a?(Hash)
raise "Argument error: expecting args to be a hash"
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment