Commit 84f4dc46 authored by Volker Hilsheimer's avatar Volker Hilsheimer

Mutagen provisioning: prevent duplicate sync points

If an alpha is already shared with a machine, skip sync point creation.
Also, pass minicoin machine name as label.
parent 50a12dda
......@@ -50,6 +50,7 @@ def mutagen_host_to_guest(box, name, alphas, betas)
privileged: false
sync = 0
alphas.each do |alpha|
alpha = alpha.gsub("~", ENV['HOME'])
beta = betas[sync]
mutagen_create = lambda do |machine|
ssh_info = machine.ssh_info
......@@ -57,9 +58,15 @@ def mutagen_host_to_guest(box, name, alphas, betas)
machine.ui.error("Error setting up mutagen sync to #{machine.ssh_info[:host]}: #{stderr}")
raise "Error setting up mutagen sync: no ssh info available for #{name}!"
else
stdout, stderr, status = Open3.capture3("echo yes | mutagen sync create --sync-mode one-way-replica --ignore-vcs --name minicoin-#{name} #{alpha} vagrant@#{ssh_info[:host]}:#{ssh_info[:port]}:#{beta}")
stdout, stderr, status = Open3.capture3("mutagen sync list minicoin-#{name}")
if (status == 0)
status = -1 unless stdout.include?(alpha)
end
if status != 0
machine.ui.warn("Error setting up mutagen sync to #{machine.ssh_info[:host]}: #{stderr}")
stdout, stderr, status = Open3.capture3("echo yes | mutagen sync create --sync-mode one-way-replica --ignore-vcs --name minicoin-#{name} --label minicoin=#{name} #{alpha} vagrant@#{ssh_info[:host]}:#{ssh_info[:port]}:#{beta}")
if status != 0
machine.ui.warn("Error setting up mutagen sync to #{machine.ssh_info[:host]}: #{stderr}")
end
end
end
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