Commit Graph

25 Commits

Author SHA1 Message Date
Satoshi Matsumoto 829b995225
guests/arch: fix configuring multiple network interfaces fails 2017-01-02 15:32:23 +09:00
Chris Roberts fb4e4320b2 Remove `set -e` usage for better shell compatibility 2016-10-24 10:30:08 -07:00
Seth Vargo ccc40eb19d
guests/arch: compute netmask
Arch expects /24 for netmask, but users usually specify as a netmask
block like 255.255.255.0. This automatically converts it.
2016-07-18 21:12:56 -04:00
Seth Vargo 9ea13105c0
guests/arch: Ensure exit on configure networks fail 2016-07-18 21:12:55 -04:00
Seth Vargo 8f3b6511f2
guests/linux: Add shared cap for listing network interfaces 2016-07-18 21:12:54 -04:00
Seth Vargo d77ad5c941
guests/arch: Configure networks in one command
This commit updates the procedure for configuring arch networks to occur
in a single command. Previously, each network was configured
independently. If, for some reason, one of the networks destroyed the
SSH connection, the box would be irrecoverable. This commit does not
alleviate that behavior, but attempts to mitigate it by running all
network-related configuration commands in a single communicator (SSH)
session.

The new procedure looks like this:

1. Upload a temp file to /tmp/vagrant-network-id... for each interface
  on the guest.
2. Compile a commands array (of bash) to execute after all network
  configurations have been uploaded.
3. Concatenate all the commands together in a single communicator
  session.

This was tested against `terrywant/archlinux` using the following Vagrantfile:

```ruby
Vagrant.configure(2) do |config|
  config.vm.box = "terrywang/archlinux"
  config.vm.hostname = "banana-ramama.example.com"

  config.vm.network "private_network", type: "dhcp"

  config.vm.network "private_network", ip: "33.33.33.10"

  config.vm.provision "file", source: "Vagrantfile", destination: "/tmp/vf"
  config.vm.provision "shell", inline: "echo hi"
end
```
2016-06-06 11:58:24 -04:00
Seth Vargo 49ce775b53
Prefix tempfiles with vagrant- 2016-05-31 00:18:16 -04:00
Seth Vargo 7014aa3bab
Remove custom tempfile class
This is not actually providing any additional utility and also causes
namespace conflicts with people trying to use the real Tempfile class.
2016-05-30 23:21:47 -04:00
Seth Vargo 5a4f345363
Use Util::Tempfile when configuring networks
This fixes a fairly large tempfile leak. Vagrant uses a template
renderer to write network configuration files locally to disk. Then,
that temporarily file is uploaded to the remote host and moved into
place. Since Vagrant is such a short-lived process, GC never came along
and cleaned up those tempfiles, resulting in many temporary files being
created through regular Vagrant usage.

The Util::Tempfile class uses a block to ensure the temporary file is
deleted when the block finishes. This API required small tweaks to the
usage, but provides more safety to ensure the files are deleted.
2016-05-28 23:22:34 -04:00
Lars Christensen a6565199ff Restart network after reconfiguration
Fixes #7119.
2016-03-08 16:24:24 +01:00
Mitchell Hashimoto 4988298b0b guests/arch: configure networks should enable device [GH-5737] 2015-11-19 11:39:04 -08:00
Douézan-Grard Guillaume 9d1834a3c9 Fix line breaks 2014-12-13 21:08:31 +01:00
SilverWyrda 384fd3ba98 Delegate cleaning to arch box packagers 2014-09-06 06:44:24 +02:00
SilverWyrda 10090bf4dc Add support for predictable network interfaces names 2014-09-06 04:56:01 +02:00
Kalman Hazins bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Mattox Beckman 17a3dff77f This is a followup to issue #2591.
Arch linux will rename its eth0 device unless an empty file is placed in `/etc/udev/rules.d/`.
In order for the new rules to take effect, we need call `udevadm control --reload`.
2014-03-25 20:44:42 -05:00
Matt Alexander edeb5f0e9f Add the symlink back that disabled renaming of network interface names 2013-12-07 14:59:40 -06:00
Matt Alexander df67d2b44f Run "ip link set [eth1] down" before running "netctl start [eth1]" in Arch guest network configuration 2013-12-07 14:22:19 -06:00
me 2a75c34d62 systemctl wasn't a good idea 2013-12-05 16:01:44 +01:00
me 158d82ea39 Avoid udev rule masking and configure ifaces with sed instead. 2013-12-05 15:16:59 +01:00
Fabio Rehm 2d4a3994ea Merge pull request #1734 from frankshearar/arch-configure-network-needs-template
No TemplateRenderer for arch's configure_networks
2013-07-16 18:20:46 -07:00
Alper Kanat dbfce678bf fixed networking issues of Arch Linux with netctl changes 2013-05-24 00:19:31 +03:00
Frank Shearar 2eb97b518c You need to include the module to use the class without ::s. 2013-05-22 16:29:58 +01:00
Frank Shearar caf4ea722e Import the TemplateRenderer (like the other guests do). 2013-05-14 21:22:19 +01:00
Mitchell Hashimoto 7f33081387 Convert arch to capabilities 2013-04-04 11:39:58 -07:00