Commit Graph

77 Commits

Author SHA1 Message Date
Seth Vargo 4418efd4a4
guests/general: Use require_relative in tests 2016-06-06 12:24:07 -04:00
Seth Vargo dc3b9c84da
guests/debian: Do not use shared helper, fix tests 2016-06-06 12:21:50 -04:00
Seth Vargo 9cbf45be59
guests/suse: Add tests for network_scripts_dir 2016-06-06 11:58:42 -04:00
Seth Vargo c98deee116
guests/suse: Add tests for halt 2016-06-06 11:58:42 -04:00
Seth Vargo c9f21a1852
guests/suse: Configure rsync in one command 2016-06-06 11:58:42 -04:00
Seth Vargo c259032f80
guests/suse: Install NFS client in one command 2016-06-06 11:58:42 -04:00
Seth Vargo 94af771b71
guests/suse: Configure networks in one command
This also uses the new predictable network naming.
2016-06-06 11:58:41 -04:00
Seth Vargo b091f4fe82
guests/suse: Change host name in one command 2016-06-06 11:58:41 -04:00
Seth Vargo 0bdf6f5ad4
guests/slackware: Configure networks in one command
This also switches to using new predictable naming for networks.
2016-06-06 11:58:40 -04:00
Seth Vargo a7bbb484ad
guests/slackware: Configure hostname in one command 2016-06-06 11:58:40 -04:00
Seth Vargo 96a1cdf08f
guests/redhat: Add tests for network_scripts_dir 2016-06-06 11:58:39 -04:00
Seth Vargo 60d2f4e1b4
guests/redhat: Install RedHat in one command 2016-06-06 11:58:39 -04:00
Seth Vargo 3098c13869
guests/redhat: Configure NFS in one command
Previously this was very complicated trying to flip between Ruby and
bash. This commit uses a single bash command that decides between yum
and dnf in the script itself.
2016-06-06 11:58:38 -04:00
Seth Vargo e09d342284
guests/redhat: Add tests for flavor 2016-06-06 11:58:38 -04:00
Seth Vargo cc26c46066
guests/redhat: Configure networks in one command
This commit also switches to using predictable network names.
2016-06-06 11:58:38 -04:00
Seth Vargo b91c167b19
guests/redhat: Change host name in one command 2016-06-06 11:58:38 -04:00
Seth Vargo 8c28361f16
guests/pld: Add tests for network scripts dir 2016-06-06 11:58:37 -04:00
Seth Vargo cf989d1534
guests/pld: Add tests for flavor 2016-06-06 11:58:37 -04:00
Seth Vargo 9702abb5c4
guests/pld: Change host name in one command 2016-06-06 11:58:36 -04:00
Seth Vargo 0002c003b3
guests/photon: Improve docker tests 2016-06-06 11:58:36 -04:00
Seth Vargo 9040ecafeb
guests/photon: Configure networks in one command
This also removes code that was completely unused during network
configuration.
2016-06-06 11:58:36 -04:00
Seth Vargo 2e943428a9
guests/photon: Change host name in one command 2016-06-06 11:58:35 -04:00
Seth Vargo d7bc7c2267
guests/omnios: Add rsync_install functionality 2016-06-06 11:58:34 -04:00
Seth Vargo c441732c59
guests/omnios: Update NFS folder mounting in one command 2016-06-06 11:58:34 -04:00
Seth Vargo 95972c1527
guests/omnios: Set hostname in one command 2016-06-06 11:58:34 -04:00
Seth Vargo 6b1749a6fb
guests/linux: Add tests for port 2016-06-06 11:58:32 -04:00
Seth Vargo 3e2374ad38
guests/linux: Add tests for nfs_client_installed 2016-06-06 11:58:32 -04:00
Seth Vargo 837713c2d1
guests/linux: Mount NFS in one command 2016-06-06 11:58:32 -04:00
Seth Vargo e2b7e28082
guests/linux: Update insert_public_key cap to be one command 2016-06-06 11:58:32 -04:00
Seth Vargo 0bd6d73a7f
guests/linux: Add tests for halt capability 2016-06-06 11:58:31 -04:00
Seth Vargo d4159e4208
guests/linux: Add tests for choosing addressable IP 2016-06-06 11:58:31 -04:00
Seth Vargo cf74347980
guests/freebsd: Install rsync in one command 2016-06-06 11:58:30 -04:00
Seth Vargo de64bd03de
guests/freebsd: Mount NFS folders in a single command 2016-06-06 11:58:30 -04:00
Seth Vargo bf51f6a71d
guests/freebsd: Insert public key in one command 2016-06-06 11:58:30 -04:00
Seth Vargo 7806223020
guests/freebsd: Add tests to halt capability 2016-06-06 11:58:30 -04:00
Seth Vargo 2b08151977
guests/freebsd: Configure predictable networks in a single command
This commit refactors the freebsd networking to:

1. Use predictable network naming
2. Properly handle DHCP vs static networks on up and reload [GH-5852]
3. Perform all networking configuration in a single command to prevent
   partial configuration.
2016-06-06 11:58:29 -04:00
Seth Vargo a444110993
guests/freebsd: Configure hostname in a single command
This updates freebsd to set the hostname in a single command and prepend
the hostname to the /etc/hosts file.
2016-06-06 11:58:29 -04:00
Seth Vargo dbb2d99278
guests/debian: Update guest capabilities
This updates the guest capabilities to run in as few communicator
commands as possible. Additionally, it fixes a number of issues around
hostname and idempotency.

This patch was tested against:

- puphpet/debian75-x64
- debian/jessie64
- debian/wheezy64

with custom networking, custom hostname, and rsync shared folders.
2016-06-06 11:58:28 -04:00
Seth Vargo dc883aa46f
guests/darwin: Add tests for get_addressable_ip_addr 2016-06-06 11:58:27 -04:00
Seth Vargo 5683a3b8ca
guests/darwin: Configure hostname in a single command 2016-06-06 11:58:27 -04:00
Seth Vargo 3ca048a8fa
guests/coreos: Configure networks in one command
This commit configures all the network devices in a single command.
2016-06-06 11:58:26 -04:00
Seth Vargo fee0545b23
guests/coreos: Do not use sudo for looking up hostname 2016-06-06 11:58:26 -04:00
Seth Vargo 50690dab12
guests/atomic: Add tests for docker capability
This commit adds missing test coverage for the Docker capability on
atomic guests.
2016-06-06 11:58:25 -04:00
Seth Vargo 4f0c3474f2
guests/atomic: Update hostname capability
This commit does a few things:

1. Make the hostname update idempotent with `grep -w`
2. Add the given hostname to `/etc/hosts` as recommended by the docs
3. Add missing tests
2016-06-06 11:58:25 -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 41d61120a5
guests/arch: Change hostname in one command
This commit updates the procedure for changing the hostname on arch
guests to occur in a single command. Previously, setting the hostname
and adding the value of the hostname to the /etc/hosts file was done in
two different uploads. This reduces the cycle to a single upload, making
provisioning a bit faster.

Additionally, this changes the behavior of the /etc/hosts file to:

1. Not remove localhost as an alias of 127.0.0.1
2. Prepend our custom hostname before localhost

The resulting /etc/hosts file will look something like:

127.0.0.1 my-host.example.com my-host
127.0.0.1 localhost.mydomain localhost

Tested against `terrywang/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 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
Mitchell Hashimoto 2875928b76 remove failing test that was brittle 2015-11-23 12:11:48 -08:00
Francesco c66df8cd2c Updating the test to see the changes to the mount pass parameter 2015-06-08 09:48:21 +01:00
Seth Vargo 6309847420 Merge pull request #5512 from johnsonj/issue_3620
For SMB on Linux guests, specify the user's domain as a separate parameter
2015-05-31 20:19:08 -07:00