306 Commits

Author SHA1 Message Date
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
Tiago Mendes-Costa
36f89afbdf Added unit test for tinycore change_host_name. 2015-04-22 16:12:46 +02:00
Fabio Rapposelli
90bb760b3b Added tests
Signed-off-by: Fabio Rapposelli <fabio@vmware.com>
2015-04-20 14:56:26 -07:00
Jeff Johnson
9d50f72df3 For SMB on Linux guests, specify the user's domain as a separate parameter to the mount command. This is more reliable than passing user@domain as the username. This is not needed for SMB on Windows guests as they expect the user@domain form.
This does not change how it is configured in the Vagrantfile.

Fixes #3620
2015-03-31 08:16:06 -07:00
Richard Guin
56a6c85e7d Windows rsync needs to create folders before syncing 2015-01-28 13:07:36 -05:00
Shawn Neal
220e4f23b2 Merge pull request #4209 from mwrock/smb_sync
adding smb sync folder implementation for windows guests addressing #3699
2014-10-07 08:19:26 -07:00
Mitchell Hashimoto
41f4ec1e4d guests/redhat: set hostname on EL7 [GH-4352] 2014-08-31 09:58:12 -07:00
Eric Saxby
dd77295533 Ensure rsync_post has find permissions on smartos 2014-08-29 14:17:28 -07:00
Matt Wrock
e64f84491e adding smb sync folder implementation for windows guests addressing #3699 2014-08-11 00:07:21 -07:00
Eric Saxby
0cb7ec2d52 rsync on SmartOS should use pfexec 2014-07-31 14:41:06 -07:00
Shawn Neal
911406ed4a Addressed issues with Windows guest renaming on Win7/8
Removed dependency upon netdom which is not always available on all Windows versions. This implementation that uses PowerShell and WMI should work on all OS and PowerShell versions.

Fixed another issue where host renames would always happen when the hostname was longer than 15 characters. The COMPUTERNAME environment variable only returns the first 15 characters so we no longer use that to check the current host name.
2014-06-25 12:15:01 -07:00
Shawn Neal
d4bd05883d Fixed issue 3987
Reboot the Windows guest after renaming the computer so changes take affect immediately before attempting to provision the box.

- Changed rename from wmic to netdom since netdom seems to work correctly in Windows 2008R2 and newer OSs.
- Fixed Windows guest error translations, the wrong namespace was specified in the yaml file.
2014-06-09 22:46:03 -07:00
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Mitchell Hashimoto
958684fd7e guests/debian: more tests for hostname 2014-05-05 09:31:54 -07:00
Mitchell Hashimoto
8e334d2f24 guests/debian: fix tests 2014-05-05 09:29:23 -07:00
Shawn Neal
f4b67df978 Removed unused halt timeout and check interval settings. 2014-05-01 08:00:41 -07:00
Shawn Neal
309f301a16 Added test to verify Windows symlinks to shares are fixed 2014-04-30 17:36:36 -07:00
Nikhil Benesch
2df36892dd synced_folders/rsync: only chown when necessary [GH-3525]
Run remote rsync as root to guarantee that rsync can write to guestpath.
This obviates the need to chown the guestpath to the SSH user prior to
sync.

This brings a substantial speedup (2x on a moderately-sized shared
folder) and properly triggers filesystem notifications on only the files
changed by a given sync.
2014-04-25 15:00:12 -04:00
Shawn Neal
dbe73e842f Added guest network tests for Windows guests 2014-04-22 14:03:07 -07:00
Shawn Neal
929e41aa5c Backfilled unit tests for Windows guest support
- Fixed typo in helper test
- Removed extraneous machine.config prefix from Windows guest config validation
- Added WinRM communicator unit tests
- Added Windows guest capability unit tests
2014-04-22 11:03:37 -07:00
Mitchell Hashimoto
600d01d792 Merge pull request #3102 from sax/smartos
guests/smartos
2014-03-20 17:50:20 -07:00
Fabio Rehm
54656151cf Convert specs to RSpec 2.14.8 syntax with Transpec
This conversion is done by Transpec 1.10.2 with the following command:
    transpec test/unit/

* 507 conversions
    from: obj.should
      to: expect(obj).to

* 394 conversions
    from: == expected
      to: eq(expected)

* 260 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 85 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 25 conversions
    from: its(:attr) { }
      to: describe '#attr' do subject { super().attr }; it { } end

* 19 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 7 conversions
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 3 conversions
    from: Klass.any_instance.should_receive(:message)
      to: expect_any_instance_of(Klass).to receive(:message)
2014-03-14 12:02:07 -03:00