Parallelise the copying of /etc/hosts.
This commit is contained in:
1 parent
e7676979ee
commit
51128a6705
1 file changed
+9
-2
+9
-2
@@ -81,6 +81,12 @@ EOF
|
|||||||
ssh -t $name sudo docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter
|
ssh -t $name sudo docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copy_hosts {
|
||||||
|
hostname=$1
|
||||||
|
hosts=$2
|
||||||
|
cat $hosts | ssh -t "$hostname" "sudo -- sh -c \"cat >>/etc/hosts\""
|
||||||
|
}
|
||||||
|
|
||||||
# Create new set of VMs
|
# Create new set of VMs
|
||||||
function setup {
|
function setup {
|
||||||
destroy
|
destroy
|
||||||
@@ -105,10 +111,11 @@ function setup {
|
|||||||
sudo sh -c "echo \"$(external_ip $json $name) $hostname\" >>/etc/hosts"
|
sudo sh -c "echo \"$(external_ip $json $name) $hostname\" >>/etc/hosts"
|
||||||
try_connect $hostname
|
try_connect $hostname
|
||||||
|
|
||||||
# Copy the /etc/hosts we built over
|
copy_hosts $hostname $hosts &
|
||||||
cat $hosts | ssh -t "$hostname" "sudo -- sh -c \"cat >>/etc/hosts\""
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
rm $hosts $json
|
rm $hosts $json
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user