Commit Graph

156 Commits

Author SHA1 Message Date
Chris Roberts 67f3c8b48c guests/redhat: Force NetworkManager to reload device configurations
When configuring network devices force NetworkManager to reload new
configuration files as they appear. This prevents NetworkManager from
attempting to continue managing devices on initial start up.
2016-10-25 07:45:38 -07:00
Chris Roberts fb4e4320b2 Remove `set -e` usage for better shell compatibility 2016-10-24 10:30:08 -07:00
Chris Roberts 07ce1c6930 Merge pull request #7866 from chrisroberts/guest-linux/network-interfaces-sorting
guests/linux: Update network interface sorting implementation
2016-10-10 10:59:52 -07:00
Chris Roberts a8970281ce guests/linux: Properly sort interface name types
Add failing networking interface list sorting test with example
provided by #7883. Update sorting logic to properly handle different
types and differing array lengths.

Fixes #7883
2016-10-10 10:22:19 -07:00
Mark Peek 4bf32e3f6d Fix typo (netmast => netmask) for Photon guest #7808 2016-10-07 12:32:21 -07:00
Chris Roberts e2b18fc65d guests/linux: Update network interface sorting implementation
Always pull ordered ethernet devices to the head of the list. Ensure
aliases are not included.
2016-10-04 17:25:00 -07:00
Chris Roberts 0300df09fb guests/linux: Update constant name, freeze constant values 2016-09-30 12:11:54 -07:00
Chris Roberts 9f468d2626 guests/linux: Place ethernet devices at start of device list 2016-09-29 15:33:29 -07:00
Chris Roberts a7537a6be0 Merge pull request #7726 from chrisroberts/fix/rsync-exclude
Ignore files excluded from sync on chown
2016-08-19 09:58:31 -07:00
Chris Roberts dd6ad2fbf3 guests/linux: only use effective group ID when appropriate 2016-08-17 06:53:26 -07:00
Chris Roberts 185a7dfc2e guests/rsync do not chown files excluded from sync 2016-08-16 15:13:19 -07:00
Chris Roberts dd91269491 guests: Prevent ssh disconnect from causing error on halt 2016-08-12 13:25:39 -07:00
Chris Roberts ce3329e184 guests/linux: Always order discovered network interfaces 2016-08-12 10:31:41 -07:00
Chris Roberts 571659a5d1 guests/openbsd: include -h option on shutdown
For OpenBSD versions prior to 5.7 the `-h` option _must_ be provided
to the `shutdown` command when `-p` is used. Later versions no longer
require the `-h` option but still allow it for compatibility.

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.8?rev=1.40&content-type=text/x-cvsweb-markup
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.c?rev=1.40&content-type=text/x-cvsweb-markup
2016-08-10 09:14:08 -07:00
Jose Luis Duran 820607bbf6 Fix `authorized_keys` permissions for BSDs
This is an extension of a6760dd8e7,
applied to BSD guests.

Related to #7610
2016-07-25 18:25:58 -03:00
hendrenj 41063204ca added unit tests for .remove_public_key method in VagrantPlugins::GuestLinux::Cap 2016-07-19 11:45:46 -06:00
Colin Shea b31b240c8c
Support installing synced folder clients on arch 2016-07-18 22:33:04 -04:00
Seth Vargo 1849990517
Fix tests 2016-07-18 21:31:25 -04:00
Seth Vargo 8f3b6511f2
guests/linux: Add shared cap for listing network interfaces 2016-07-18 21:12:54 -04:00
Seth Vargo 66cbe7b41e
Fix failing tests 2016-07-18 21:12:53 -04:00
Seth Vargo 851eff1288
guests/linux: Ensure NFS retries when mounting
Fixes GH-7443
2016-06-19 14:34:33 -04:00
Seth Vargo 07e6d0e707
guests/bsd: Centralize logic for halting guests 2016-06-18 15:06:20 -04:00
Satoshi Matsumoto de9abc8f72
guests/redhat: fix network configuration in CentOS 5
ip command is not on PATH by default in CentOS 5 so call it with the full path.
2016-06-18 14:14:25 -04:00
Seth Vargo 6284a9ac50
guests/bsd: Move NFS mounting logic into shared
A number of the BSD guests used very old mounting options or just
ignored some parameters entirely. This fixes that.

- Closes #7474
- Fixes #7466
2016-06-17 21:04:23 -04:00
Seth Vargo 0c268f7b3f
guests/bsd: Add shared BSD guest for common behavior 2016-06-17 20:16:36 -04:00
James Wilson 358ad8f18f Use ip instead of deprecated ifconfig for Red Hat/CentOS guests 2016-06-16 10:06:58 +01:00
Eugene Zamriy eaa4e11c62 Add CloudLinux 7 to RHEL 7 flavors. 2016-06-12 16:51:55 +03:00
Torsten Juergeleit 754c1eebe5 fixes #6220 - adds check for communicator type and executes the mount script as encoded command via powershell from within 'sh' for communicator != winrm 2016-06-11 16:40:25 +02:00
Seth Vargo c8ceb06f6d
guests/amazon: Initial addition
Fixes GH-7254
2016-06-06 18:22:34 -04:00
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
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