plugins/guests/arch/cap/configure_networks.rb in vagrant-unbundled-1.8.5.2 vs plugins/guests/arch/cap/configure_networks.rb in vagrant-unbundled-1.9.1.1
- old
+ new
@@ -10,14 +10,13 @@
class ConfigureNetworks
include Vagrant::Util
def self.configure_networks(machine, networks)
comm = machine.communicate
+ commands = []
- commands = ["set -e"]
interfaces = machine.guest.capability(:network_interfaces)
-
networks.each.with_index do |network, i|
network[:device] = interfaces[network[:interface]]
# Arch expects netmasks to be in the "24" or "64", but users may
# specify IPV4 netmasks like "255.255.255.0". This magic converts
@@ -40,18 +39,18 @@
comm.upload(f.path, remote_path)
end
commands << <<-EOH.gsub(/^ {14}/, '')
# Configure #{network[:device]}
- mv '#{remote_path}' '/etc/netctl/#{network[:device]}'
- ip link set '#{network[:device]}' down
- netctl restart '#{network[:device]}'
+ mv '#{remote_path}' '/etc/netctl/#{network[:device]}' &&
+ ip link set '#{network[:device]}' down &&
+ netctl restart '#{network[:device]}' &&
netctl enable '#{network[:device]}'
EOH
end
# Run all the network modification commands in one communicator call.
- comm.sudo(commands.join("\n"))
+ comm.sudo(commands.join(" && \n"))
end
end
end
end
end