Commit 29fff115 authored by Volker Hilsheimer's avatar Volker Hilsheimer

Consolidate all merging into the loader

Give mutagen sync points unique names as well so that they don't
override each other in vagrant.
parent 7d228c38
......@@ -247,35 +247,25 @@ Vagrant.configure("2") do |config|
end
# folder sharing, taking guest OS and provider specific quirks into account
default_shares = $settings["defaults"]["shared_folders"]
default_shares = [default_shares] unless default_shares.kind_of?(Array)
machine_shares = machine["shared_folders"]
machine_shares = [machine_shares] unless machine_shares.kind_of?(Array)
shares = default_shares + machine_shares
if shares.include?("disabled")
box.vm.synced_folder ".", "/minicoin", disabled: true
else
share_folders(box, machine, shares)
shares = machine["shared_folders"]
unless shares.nil?
if shares.include?("disabled")
box.vm.synced_folder ".", "/minicoin", disabled: true
else
share_folders(box, machine, shares)
end
end
# Definition of provisioning steps
default_roles = $settings["defaults"]["roles"]
default_roles = [default_roles] unless default_roles.kind_of?(Array)
machine_roles = machine["roles"]
machine_roles = [machine_roles] unless machine_roles.kind_of?(Array)
# add_role modifies, so make a deep copy of default_roles
roles = Marshal.load(Marshal.dump(default_roles))
roles.concat(machine_roles)
machine["roles"] = roles
roles.each do |role|
begin
add_role(box, role, name) unless role.nil?
rescue => e
puts "==> #{name}: Error when adding role #{role}:"
puts " #{e}"
roles = machine["roles"]
unless roles.nil?
roles.each do |role|
begin
add_role(box, role.dup, name) unless role.nil?
rescue => e
puts "==> #{name}: Error when adding role #{role}:"
puts " #{e}"
end
end
end
......
......@@ -75,15 +75,22 @@ def load_urls(yaml, user_yaml)
yaml["urls"] = $urls
end
def load_boxes(yaml, user_yaml)
def load_boxes(yaml, user_yaml, include_defaults)
machines = yaml["machines"]
defaults = yaml["settings"]["defaults"]
unless defaults.nil?
defaults.each do |setting, value|
next if setting == "roles" || setting == "shared_folders"
machines.each do |machine|
machine[setting] = value if machine[setting].nil?
if include_defaults
defaults = yaml["settings"]["defaults"]
unless defaults.nil?
defaults.each do |setting, value|
# make deep copies
default_value = value.dup
machines.each do |machine|
if machine[setting].kind_of?(Array)
machine[setting].concat(default_value)
elsif machine[setting].nil?
machine[setting] = default_value
end
end
end
end
end
......@@ -156,8 +163,8 @@ def load_minicoin()
load_settings(yaml, user_yaml)
load_settings(yaml, local_yaml)
machines = load_boxes(yaml, user_yaml)
machines = load_boxes(yaml, local_yaml)
machines = load_boxes(yaml, user_yaml, true)
machines = load_boxes(yaml, local_yaml, false)
load_urls(yaml, user_yaml)
load_urls(yaml, local_yaml)
......
......@@ -63,7 +63,7 @@ def mutagen_host_to_guest(box, name, alphas, betas)
end
end
end
box.vm.provision "mutagen:sync_create #{sync}",
box.vm.provision "mutagen:sync_create #{alpha}",
type: :local_command,
code: mutagen_create
sync += 1
......
......@@ -18,8 +18,9 @@ def load_testmachines()
test_output = load_includes(test_output, root)
user_output = load_includes(user_output, root)
load_boxes(test_output, user_output)
load_settings(test_output, user_output)
load_boxes(test_output, user_output, true)
load_urls(test_output, user_output)
return test_output
......
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