Commit Graph

3284 Commits

Author SHA1 Message Date
Bjorn Brala c075c026be Keyboard language setting made my comment bad 2016-10-19 20:56:52 +02:00
Bjorn Brala 055bed5918 removed an extra echo and added proper error message when there is incompatibilities. Appearantly importing into a compressed folder wont work and will result in an error. 2016-10-19 20:55:56 +02:00
Chris Roberts fa2a9105f0 provisioners/salt: Synchronize config defaults with documentation 2016-10-17 10:11:39 -07:00
Brian Retford 418064519d Move dynamic memory settings into conditional block 2016-10-14 18:53:44 -07:00
Jake Ballard 803fff7f03 Fix issue with missing slash in paths
It was failing to create files below the machines\default\hyperv folder, rather it was creating folders named 'hypervSnapshots', 'hypervVirtual Hard Disks', and 'hypervVirtual Machines'. This was causing the files to not be removed when destroying the vm, and an error when subsequently bringing it up again.
2016-10-11 15:31:28 -05:00
Chris Roberts b9ea9a2ac2 Merge pull request #7887 from chrisroberts/guests/linux-detection
Guests/linux detection
2016-10-11 12:55:52 -07:00
Chris Roberts 9d61d7c61b Merge pull request #7818 from rswarts/vz7flavor
Add Virtuozzo Linux 7 to list of RHEL flavors
2016-10-11 10:35:20 -07:00
Chris Roberts d0549d6e11 guests/linux: Provide common linux detection style
Defines a common and generic linux detection strategy which can be
subclassed and easily reused by providing a custom detection constant.
2016-10-11 07:50:34 -07:00
Reto Gantenbein 6050b13f43 Make Debian guest detection more reliable
/etc/issue is far from being a reliable source for OS detection as it
can be changed by a user without affecting any OS functionality. As
newer Debian systems run systemd by default, check for /etc/os-release
and fallback to lsb_release for older Debian versions. Check #7625 for
a similar issue. Even lsb_release is not manatory, therefore keep the
current code of parsing /etc/issue to avoid regressions.
2016-10-11 07:49:35 -07:00
Gilles Cornu a55590b84f
provisioners/ansible_local: Change binary detection
- Remove `ansible-galaxy` detection, since this command was introduced
  in Ansible 1.4.2 (December 2013). Checking for `ansible-playbook`
  presence should therefore be enough for any "modern" Ansible setup.
- Look for the command defined by the new `playbook_command` option.

Related to GH-7881 and GH-7536
2016-10-10 23:24:19 +02:00
Gilles Cornu b1ddc98e17
Merge pull request #7881 (Add playbook_command option)
Note that error messages were not adapted, and only mention
a generic "Ansible Software" when executed commands are failing.
We assume that people using the `playbook_command` option are
advanced users that will know all the components to be considered.
2016-10-10 23:18:24 +02:00
Gilles Cornu 26e8bdc1f1
Merge pull request #7536 2016-10-10 23:03:00 +02: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 7eb1091a71 Merge pull request #7874 from chrisroberts/enhancement/cast-box-version
config/vm: cast box version to string before string operations
2016-10-10 10:57:53 -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
Bjorn Brala 42efd5c198 Make the Virtual Hard Disks directory if importing from XML to keep it consistant across config types 2016-10-09 21:10:56 +02:00
Daniel Gonzalez 58f2b0c8c7 Make ansible-playbook command configurable
The ansible-playbook command is currently hardcoded for the ansible and
ansible_local provisioners. This patch adds the config option
playbook_command to allow the user to change the command.
2016-10-09 20:48:50 +02:00
Bjorn Brala 8744caebcf Small typo in options 2016-10-09 20:39:17 +02:00
Bjorn Brala 7b03bf335b Whitespace 2016-10-08 16:44:24 +02:00
Bjorn Brala debe50957b Refactor the import script to fully use Compare-VM for creating the new VM.
Implemented the differencing disk for vmcx.
This means the disk is now copied by Hyper-V (Powershell) instead of Ruby for new machines.
This does mean EFI Firmware now does work for machines since it is quite a feep copy. Compare-VM will report incompatibilities should they be found.
2016-10-08 16:38:42 +02:00
Chris Roberts d178631ff9 Generic white space strip from command strings 2016-10-07 17:30:27 -07:00
Chris Roberts 703513bd0f Revert "Fix incorrect ssh-config output when '--host' is defined"
This reverts commit c77326438b.
2016-10-07 16:50:12 -07:00
Chris Roberts bb60fdd790 Merge pull request #7877 from guessi/fix_7728_incorrect-ssh-config-output
Fix incorrect ssh-config output when '--host' is defined
2016-10-07 15:19:18 -07:00
Chris Roberts 33b13dffbe Merge pull request #7873 from markpeek/markpeek-photon-netmask
Fix typo (netmast => netmask) for Photon guest #7808
2016-10-07 15:15:26 -07:00
Mark Peek 4bf32e3f6d Fix typo (netmast => netmask) for Photon guest #7808 2016-10-07 12:32:21 -07:00
Bjorn Brala a77da314e5 Only check for .vmcx if there is no XML found to not risk breaking older vagrant boxes that added an XML file manually 2016-10-07 20:38:05 +02:00
guessi c77326438b Fix incorrect ssh-config output when '--host' is defined
Fixes: #7728
Signed-off-by: guessi <guessi@gmail.com>
2016-10-07 23:47:56 +08:00
Björn Brala 6ed612e93b Move package_setup_files to general lib to minimize code duplication 2016-10-07 17:31:15 +02:00
Chris Roberts 26b3a303d2 config/vm: cast box version to string before string operations 2016-10-06 16:16:59 -07:00
Chris Roberts 8291c56fd2 Merge pull request #7688 from hunterboerner/7597-docker-interactive-flag
Remove --interactive flag from Docker command
2016-10-06 15:41:58 -07:00
Chris Roberts b738aaac0f Merge pull request #7813 from rudineirk/fix-non-upstart-linux
Fix non upstart linux nfs mounts
2016-10-06 12:59:23 -07:00
Björn Brala a4d41d0a0e Move code for set-folders for packing VirtualBox to general 2016-10-06 15:07:13 +02:00
Bjorn Brala 5877e8fe22 Sart refactor duplicate classes 2016-10-06 08:55:59 +02:00
Bjorn Brala 8619267cd9 Fix getting mac address from the driver. 2016-10-06 08:29:05 +02:00
Bjorn Brala 5d0de9486e Remove some logging from the package action. 2016-10-06 08:28:52 +02:00
Theron Boerner 391c5be08e Remove --interactive flag from Docker command
See: GH-7597. Due to the childprocess gem setting STDIN to a pipe,
Docker will fail as it requires STDIN to be a TTY if run with
--interactive.
2016-10-05 14:38:20 -05:00
Bjorn Brala 0970a5a67b Generate metadata.json in root of package. 2016-10-05 14:42:46 +02:00
Bjorn Brala be2e9e79aa FIrst draft of packaging of Hyper-V boxes. Need to refactor the package_* files since right now they are copies of the virtualbox versions, might just put them in general. 2016-10-05 13:48:48 +02:00
Chris Roberts a384276431 Merge pull request #7751 from wakeful/fix-centos7-do-not-prompt-before-overwriting
Fix CentOS7 network config - do not prompt before overwriting
2016-10-04 17:31:42 -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
David Wittman 00c7b1e005
Fix minion_id config for salt provisioner
Changes introduced in #7207 removed the logic to handle the
`minion_id` configuration. This commit addresses that regression
by including the `--id #{@config.minion_id}` flag everywhere that
`--local` is used (as it had done before).

I'm not totally in love with the `get_masterless` abstraction here,
so if someone has a better suggestion I'll happily change it.

Fixes #7454
2016-10-04 16:46:36 -05:00
Bjorn Brala 133e2a7b0f Broke Path argument in mini refactor. 2016-10-04 20:06:10 +02:00
Bjorn Brala 2fc93277fd change argument to vm_config_file so it isn't the same as variable in powershell script. 2016-10-02 18:45:51 +02:00
Bjorn Brala 1ec1cf8177 Update Hyper-V import command and the driver to check for configuration type and call the correct import script. 2016-10-02 16:10:58 +02:00
Bjorn Brala b041c1955c Add support for vmcx files, new binary format for Hyper-V configurations. 2016-10-02 16:10:16 +02:00
Chris Roberts f72cd286c1 Merge pull request #7831 from mwrock/nano
Use the cmd shell to check winrm availability to fix `vagrant up --no-provision` on nano
2016-09-30 16:16:42 -07:00
Chris Roberts 2e6b23c8fd Merge pull request #7848 from chrisroberts/fix/eth-first-predictable
guests/linux: Place ethernet devices at start of device list
2016-09-30 14:50:08 -07:00
Chris Roberts 0300df09fb guests/linux: Update constant name, freeze constant values 2016-09-30 12:11:54 -07:00
Chris Roberts 6e6b35f1c5 Merge pull request #7712 from mwrock/executor
fix #7489 preventing winrm connection leakage
2016-09-30 09:10:42 -07:00
Chris Roberts 9f468d2626 guests/linux: Place ethernet devices at start of device list 2016-09-29 15:33:29 -07:00
Matt Wrock c5e1a6d8c0 use the cmd shell to check winrm availability 2016-09-26 14:07:11 -07:00
Rutger Swarts 2ecbc241c3 Add Virtuozzo Linux 7 to list of RHEL flavors 2016-09-23 10:45:16 +02:00
Gilles Cornu e8cf9bb168
provisioners/ansible: review pull request #7752
- Honour `ssh.proxy_command` setting (even when the Docker provider is
  used via a proxy host). Silly configurations may lead to silly
  behaviors, but let's apply the settings...
- Remove condition on `provider_config.connect_via_ssh`, which is
  a provider specific parameter (from vagrant-libvirt provider).
- Add a simple unit test
2016-09-21 23:40:20 +02:00
Dmitry Vasilets a1d78edaf8
changes after review 2016-09-21 23:40:15 +02:00
Dmitry Vasilets a943f67da1
support ansible for remote servers and vm 2016-09-21 23:39:43 +02:00
Rudinei Goi Roecker 8b8c961935 Fix non upstart linux nfs mounts 2016-09-20 17:57:54 -03:00
AJ 2e723ea308 added general restart for network - to prevent IP address dropping on interfaces 2016-08-23 21:02:11 +01:00
AJ 1c4e7ee068 assuming a scenario - vagrant up -> power off -> vagrant up
vagrant will stuck on the network configuration

DEBUG ssh: stdout: mv: overwrite '/etc/sysconfig/network-scripts/ifcfg-eth0'?
DEBUG ssh: Sending SSH keep-alive...
2016-08-23 20:58:15 +01:00
Chris Roberts c59723e595 Merge pull request #7740 from chrisroberts/nfs/v4
Add NFSv4 warning and information
2016-08-19 10:19:34 -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 5e44e308a5 Merge pull request #7725 from chrisroberts/fix/package-machine-dir
Machine data directory for base box package
2016-08-19 09:48:38 -07:00
Chris Roberts bbac718925 Add NFSv4 warning and information 2016-08-19 09:33:36 -07:00
Chris Roberts dd6ad2fbf3 guests/linux: only use effective group ID when appropriate 2016-08-17 06:53:26 -07:00
Chris Roberts f577ca3d23 commands/package: provide machine data directory for base box 2016-08-17 06:49:12 -07:00
Chris Roberts 185a7dfc2e guests/rsync do not chown files excluded from sync 2016-08-16 15:13:19 -07:00
Matt Wrock 64828f1ed3 fix #7489 preventing winrm connection leakage 2016-08-13 07:49:08 -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 155c78ea93 communicators/ssh: Filter command stdout output 2016-08-11 13:26:56 -07:00
Chris Roberts 9e26e31a6b Add generated private key options to rsync command 2016-08-11 13:00:37 -07:00
Chris Roberts ee185f4b9e Set private_key_path and log_level within hash construction 2016-08-11 12:13:11 -07:00
Chris Roberts 7ba4f2087b Include LogLevel option within ssh command setup 2016-08-11 12:12:45 -07:00
Zack Train cb70749bd8 redux of pr 7398 for ssh-agent key fix 2016-08-11 11:48:10 -07:00
Chris Roberts 6cdab917de guests/dragonflybsd: add detection for DragonFly BSD 2016-08-10 09:14:08 -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
Chris Roberts 666d5e6391 guests/bsd: remove darwin matching 2016-08-10 09:10:56 -07:00
Charlie Sharpsteen 4144b45122 Fix RDP connections on OS X
Changes introduced in 982af05 caused the RDP configuration file to be written
with all settings on one line instead of one setting per line. The Microsoft
Remote Desktop client for OS X rejects these configuration files as being
malformed. This patch restores the configuration to one line per setting and
adds tests to guard against regression.
2016-08-09 14:04:50 -07:00
tfanning d350fd0d28 Resolve whitespace 2016-07-26 13:56:20 +01:00
tfanning 344fc0ea7b Implement auto_start_action and auto_stop_action 2016-07-26 13:41:01 +01: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
Seth Vargo a732b355d2 Merge pull request #7632 from mitchellh/sethvargo/ubuntu_detect
guests/ubuntu: Revert detection
2016-07-23 15:18:53 -04:00
Seth Vargo 00fa49191d
guests/ubuntu: Revert detection
- Semi-reverts GH-7524
- Fixes GH-7625
2016-07-23 15:02:11 -04:00
Alexander Kurilo 73cc633b02
Detect NFS server by service name on Arch
Fixes #7629.
nfs-server.service seems to load kernel modules it needs itself, while nfsd appears in `/proc/filesystems` only after the kernel module has been loaded, so vagrant fails to detect NFS server until it's started first time after the system has booted. This checks if the NFS service actually exists and hopes that it'll figure the stuff out itself.

`list-unit-files` is utilized rather than `list-units` because systemd seems to not list units that are disabled: https://lists.fedoraproject.org/pipermail/devel/2011-November/159117.html
2016-07-23 13:09:23 +03:00
hendrenj 855643e9a5 s/bsd/linux/ 2016-07-19 11:45:03 -06:00
hendrenj a6760dd8e7 fixes #7610 2016-07-19 11:22:35 -06:00
Seth Vargo 571747be5e
Ensure space after last arg 2016-07-18 23:39:08 -04:00
Colin Shea b31b240c8c
Support installing synced folder clients on arch 2016-07-18 22:33:04 -04:00
Seth Vargo 8a5cf3b81a Merge pull request #7012 from penguincoder/rsync-command-quoting
translate windows path
2016-07-18 22:05:39 -04:00
Seth Vargo 30692fc857 Merge pull request #7524 from nishidayuya/fix_ubuntu_guest_detection
A more reliable way to detect Ubuntu
2016-07-18 22:01:11 -04:00
Seth Vargo 7868421a21
guests/openbsd: Fix hostname setting 2016-07-18 21:13:00 -04:00
Seth Vargo 1e0d7bb652
guests/ubuntu: Use debians change_host_name functionality 2016-07-18 21:13:00 -04:00
Seth Vargo 7f1947fec2
folders/rsync: Shellescape guest paths
This allows users to have spaces or other special characters in
destination paths on the guest.
2016-07-18 21:13:00 -04:00
Seth Vargo 1c0d0b8b9d
guests/linux: Style update for choose_addressable_ip 2016-07-18 21:12:59 -04:00
Seth Vargo e2becda89d
guests/gentoo: Use shared cap for listing network interfaces 2016-07-18 21:12:59 -04:00
Seth Vargo 8fe47b79c2
guests/gentoo: Exit on hostname error 2016-07-18 21:12:59 -04:00
Seth Vargo 72dcf610f7
guests/freebsd: Escape guest path in rsync folders 2016-07-18 21:12:59 -04:00
Seth Vargo 3b2ffae400
guests/bsd: Print a very descriptive error when mounting vbox folders
BSD-based guests do not support VirtualBox shared folders. This is a
common source of confusion in Vagrant. This new error clearly explains
that this is not a bug in Vagrant and provides instructions on how to 
disable them.
2016-07-18 21:12:58 -04:00
Seth Vargo c4a0a86ee0
guests/debian: Do not restart networking
Restarting networking causes Vagrant to disconnect and fail.
2016-07-18 21:12:58 -04:00
Seth Vargo d1a071d403
guests/darwin: Shellescape guest path for rsync 2016-07-18 21:12:58 -04:00
Seth Vargo 619c7a5b26
guests/darwin: Exit on error setting hostname 2016-07-18 21:12:58 -04:00
Seth Vargo 7e88266999
guests/linux: Properly escape and retry vbox shared folder mounting 2016-07-18 21:12:57 -04:00
Seth Vargo 4aaa600bd6
guests/linux: Centralize public_key logic 2016-07-18 21:12:57 -04:00
Seth Vargo cb2f3a697f
guests/debian: Do not check if rsync is installed before installing
This is already done via the rsync_installed capability.
2016-07-18 21:12:57 -04:00
Seth Vargo 76bab1932e
guests/debian: Use set -e when configuring networks 2016-07-18 21:12:57 -04:00
Seth Vargo 7a7256b3ab
guests/debian: Exit on error when configuring hostname 2016-07-18 21:12:56 -04:00
Seth Vargo 9134172ce6
guests/debian: Move NFS into same file 2016-07-18 21:12:56 -04:00
Seth Vargo 0af02fc78c
guests/atomic: Ensure error exit when setting hostname 2016-07-18 21:12:56 -04: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 627091de35
guests/linux: reorg 2016-07-18 21:12:55 -04:00
Seth Vargo 9ea13105c0
guests/arch: Ensure exit on configure networks fail 2016-07-18 21:12:55 -04:00
Seth Vargo e69211ab22
guests/arch: Add NFS capabilities 2016-07-18 21:12:55 -04:00
Seth Vargo cf9a8e3c0a
guests/arch: Ensure exit on error setting hostname 2016-07-18 21:12:55 -04:00
Seth Vargo 084d62b5a6
guests/fedora: Move as a child of redhat
Fedora should have been a child of redhat for awhile now...
2016-07-18 21:12:54 -04:00
Seth Vargo 336cb3319c
guests/rhel: Use FQDN for hostname
Refs: https://lukas.zapletalovi.com/2011/12/setting-hostname-properly-in-fedora-and.html
2016-07-18 21:12:54 -04:00
Seth Vargo cf91bcf029
guests: Always search for FQDN without sudo 2016-07-18 21:12:54 -04:00
Seth Vargo 8f3b6511f2
guests/linux: Add shared cap for listing network interfaces 2016-07-18 21:12:54 -04:00
Seth Vargo b621cc44fb
guests/rhel: Switch to predicable network interface names 2016-07-18 21:12:53 -04:00
Seth Vargo 4664930e06
guests/ubuntu: Use short hostname
Fixes GH-7488
2016-07-18 21:12:53 -04:00
Seth Vargo caafb936f0
guests/gentoo: Use predictable network interface names 2016-07-18 21:12:53 -04:00
Seth Vargo ea9b28f9b6
guests/freebsd: Check FQDN for hostname 2016-07-18 21:12:52 -04:00
Seth Vargo 57774601d9
guests/fedora: Fix indentation on configure hostname 2016-07-18 21:12:52 -04:00
Seth Vargo 87d2b7fec8
guests/debian: Set hostname to short value
Refs GH-7488
2016-07-18 21:12:52 -04:00
Seth Vargo 5a372a9942
guests/bsd: Do not use -h to shutdown 2016-07-18 21:12:52 -04:00
Seth Vargo bbcddb6499
guests/atomic: Search for FQDN hostname 2016-07-18 21:12:51 -04:00
Seth Vargo 10b12ce393
guests/arch: Search for FQDN hostname 2016-07-18 21:12:51 -04:00
Seth Vargo 3eebff5bf3
guests/funtoo: Behave like a gentoo guest 2016-07-18 21:12:51 -04:00
Indrek Ardel b57b0e0d48 Add VirtualBox 5.1 driver 2016-07-13 15:34:25 +03:00
Hanno Heinrichs 10775a3b4a More robust Ansible detection for local Ansible provisioner 2016-06-30 12:58:36 +02:00
Yuya.Nishida 05782f1d0e A more reliable way to detect Ubuntu
lsb_release command is included in lsb-release package. Sometimes this is
not installed; ex: Docker official Ubuntu image.
/etc/os-release is included in base-files package,
so this is more reliable than lsb_release.
2016-06-28 01:57:35 +09:00
Seth Vargo 49f2a0e7e9 Merge pull request #7487 from codekaizen/master
Fixing version check and catch statement in get_vm_status
2016-06-19 17:15:44 -04:00
Seth Vargo bfc951ee20 Merge pull request #7492 from mitchellh/sethvargo/linux_nfs
guests/linux: Ensure NFS retries when mounting
2016-06-19 14:39:39 -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 177b7784dd
guests/darwin: Allow ipv6 static networks 2016-06-19 12:01:52 -04:00
Rory Plaire d3859a33aa Fixing version check and catch statement in get_vm_status
Use the version of Hyper-V instead of Powershell to determine which
exception is thrown by Get-VM. Also fixing an invalid catch statement,
since Powershell can not use variables to match thrown exceptions in
catch.
2016-06-18 17:13:24 -07:00
Seth Vargo 2cbc819298 Merge pull request #7484 from mitchellh/sethvargo/bsd_halt
guests/bsd: Centralize logic for halting guests
2016-06-18 15:12:09 -04:00
Seth Vargo 07e6d0e707
guests/bsd: Centralize logic for halting guests 2016-06-18 15:06:20 -04:00
Seth Vargo 3f27af7e95
core: Provide a way to globally disable box update checking
This adds a new environmental variable `VAGRANT_BOX_UPDATE_CHECK_DISABLE`,
which instructs Vagrant to not check for box updates when running
regular Vagrant commands. This behaves the same as the existing
`config.vm.box_update_check` configuration option, but can be set
globally. Vagrantfile-supplied options will take precedence.

Fixes GH-7479
2016-06-18 14:46:46 -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 079acb42cd
guests/bsd: Centralize logic for public key management 2016-06-17 21:36:28 -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
Seth Vargo b29864f450
Use symbols for defining guest capabilities 2016-06-17 19:55:04 -04:00
Seth Vargo add40534de
Use strip instead of chomp 2016-06-16 15:32:11 -04:00
Seth Vargo 23b34bb6c0 Merge pull request #7456 from jonnywilliamson/patch-1
Append newline to each key added
2016-06-16 21:28:33 +02:00
Jonathan d1be7ae84a Better method for string concatenation
Never developed in Ruby before. I have only just discovered that apparently `<<` is a better method of string concatenation.
2016-06-16 11:59:11 +01:00
Jonathan 2720ed3d2c Apply new line before shell to system
Having looked at the code again this seems like a more straightforward way of fixing the bug.
2016-06-16 11:47:47 +01:00
James Wilson 358ad8f18f Use ip instead of deprecated ifconfig for Red Hat/CentOS guests 2016-06-16 10:06:58 +01:00
Jonathan f7f46ba47d Append newline to each key added
The change to this file 10 days ago removed a newline character at the end of each key added to it. This mean that when another key was added, it continued on the same line as the one before and thus wasn't being detected when an ssh connection came in with a key file.

With regards to https://github.com/mitchellh/vagrant/issues/7455 this is an (ugly) fix.

I'm sure someone knows a better command to concat a file and a string and append it to the `authorized_keys` file. But this does fix the problem.
2016-06-15 23:56:22 +01:00
Eugene Zamriy eaa4e11c62 Add CloudLinux 7 to RHEL 7 flavors. 2016-06-12 16:51:55 +03:00
Seth Vargo cb1749b375
8 network adapters, always 2016-06-11 20:00:16 +02: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
Gilles Cornu a7dfc73b85 provisioners/ansible: honor galaxy_roles_path when running ansible-playbook
This commit include the following changes:
- systematically set ANSIBLE_ROLES_PATH environment variable when
  galaxy_roles_path is defined.
- slightly refactor to introduce the concept of "provisioning working
  directory" (possible usage in the future for resolving GH-7195)
- fix a bug in ansible-galaxy execution by the ansible_local provisioner
  if the paths contains blank characters.

Fix #7269
2016-06-11 07:28:05 +02:00
Seth Vargo 45e71eca15 Revert "Set max_network_adapters to 36 for Virtualbox" 2016-06-11 01:04:58 +02:00
Gilles Cornu 6ee8bb6a84 provisioners/ansible_local: Fix Fedora/RedHat "default" installation mode
With bb9dba56ac, I introduced a pitiful
regression in "rpm-based" Ansible installation (via yum or dnf).

This fix is part of GH-6654
2016-06-09 19:16:47 +02:00
Gilles Cornu 6ee69e3150 Merge pull request #7190 from electrofelix/ansible-parallel-race
Fix a race condition in the concurrent generations of the ansible inventory file, while running `vagrant up --parallel`.

Closes GH-6526
2016-06-09 14:56:03 +02:00
Gilles Cornu eb1e8f8673 provisioners/ansible(both): apply ruby 2.x style
Use Ruby 2.0 syntax for named parameters and hash entries.
2016-06-08 23:53:58 +02:00
Gilles Cornu d57b7201c4 provisioners/ansible_local: align code style
Remove parenthesis to all "machine.communicate." method calls in the
"cap/guest" files...
2016-06-08 23:53:58 +02:00
Gilles Cornu bb9dba56ac provisioners/ansible_local: add "pip" install_mode
These changes have been validated against the following guest systems:
- Debian 7 and 8
- Ubuntu 12.04, 14.04 and 16.04
- Fedora 21 and 23
- CentOS 7
- OracleLinux 7
- Scientific Linux 7

At the moment, the pip setup (via get-pip.py script) is not working for
RHEL6-like systems (CentOS 6.6, OracleLinux 6.5, Scientific Linux 6),
because Python 2.6 has been deprecated and is no longer supported by
Python core team. I consider this limitation with low priority in
Vagrant context.

The `:pip` install_mode is currently not implemented for the following
platforms:
- OpenSUSE
- ArchLinux
- FreeBSD

Known Issue: By using get-pip.py script, any previous pip installation
will be most probably overrided. This could be an issue for Python
developers who would prefer to keep their base box setup untouched. In
future iteration, it could be possible to choose to reinstall/upgrade
pip or not. issue for Python developers who would prefer to keep their
base box setup untouched. In future iteration, it could be possible to
choose to reinstall/upgrade pip or not.

Resolve GH-6654

Resolve GH-7167 as the `version` option is now considered to select the
version of Ansible to be installed.
2016-06-08 23:53:58 +02:00
Renat Zaripov d490d0a846 Fix operation name in help message 2016-06-08 15:05:09 +03:00
Seth Vargo 43538f68a4
Simpler 2016-06-06 19:47:25 -04:00
Seth Vargo da9306fa27 Merge pull request #6838 from arBmind/Rsync_commandline_output
Add shell quotes to the reported rsync command line to make it readable.
2016-06-06 19:46:42 -04:00
Bartłomiej Piotrowski 919f3ee4e4
Remove sysvinit else clauses in NFS for Arch Linux
Currently the code tries to detect if Arch uses systemd via checking
comm= of PID 1. As access to proc filesystem might be restricted due to
hideproc set and systemd is default for all Arch Linux installations
since October 2012, let's just ditch that check.
2016-06-06 19:34:45 -04:00
Seth Vargo d45dc0c9d9 Merge pull request #7207 from msarahan/salt_masterless_rework
Salt: move masterless config to apply to all platforms
2016-06-06 19:28:29 -04:00
Seth Vargo 63bbbc0335 Merge pull request #7372 from nicolasvan/virtualbox-race-condition-on-vmexists
Make virtualbox vm_exists? more resilient to VirtualBox transient failures
2016-06-06 19:19:22 -04:00
Seth Vargo 01e91882f0 Merge pull request #7270 from lpenz/nfspager
Do not let NFS systemctl status use a pager
2016-06-06 19:11:41 -04:00
Seth Vargo 073e65abf0 Merge pull request #7387 from phyber/fix/master/prepare_nfs_settings_scoped_hash_overrides_fix
Fix/master/prepare_nfs_settings scoped hash overrides fix
2016-06-06 18:41:13 -04:00
Seth Vargo c8ceb06f6d
guests/amazon: Initial addition
Fixes GH-7254
2016-06-06 18:22:34 -04:00
Seth Vargo e925f3793a
provisioners/chef: Install in one command 2016-06-06 18:22:17 -04:00
Seth Vargo 61d2a50a54
guests/linux: Fix compatibility with dash shell 2016-06-06 12:59:51 -04:00
Seth Vargo 07155ee62f
guests/ubuntu: Use require_relative in plugin 2016-06-06 11:58:44 -04:00
Seth Vargo fe9c506c4d
guests/ubuntu: Remove require vagrant from guest 2016-06-06 11:58:44 -04:00
Seth Vargo 155aa8cf1d
guests/ubuntu: Change host name in one command
This also removes the dependency on the debian hostname setting.
2016-06-06 11:58:44 -04:00
Seth Vargo dd2e76472b
guests/trisquel: Use require_relative in plugin 2016-06-06 11:58:43 -04:00
Seth Vargo bbf245b46e
guests/trisquel: Do not require vagrant in guest 2016-06-06 11:58:43 -04:00
Seth Vargo d2e937585d
guests/suse: Use require_relative in plugin 2016-06-06 11:58:43 -04:00
Seth Vargo f531480673
guests/suse: Do not require vagrant in guest 2016-06-06 11:58:43 -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 fb90c67a49
guests/smartos: Remove deprecated options 2016-06-06 11:58:41 -04:00
Seth Vargo fe4fa9dfce
guests/slackware: Use require_relative 2016-06-06 11:58:41 -04:00
Seth Vargo ece972406d
guests/slackware: Do not require vagrant 2016-06-06 11:58:40 -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 c12b413c2e
guests/redhat: Use require_relative in redhat plugin 2016-06-06 11:58:39 -04:00
Seth Vargo aaedc48425
guests/redhat: Do not require vagrant in guest 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 665534e620
guests/pld: Use require_relative 2016-06-06 11:58:37 -04:00
Seth Vargo 15cac4fd21
guests/pld: Do not require vagrant in guest 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 5e5a91956c
guests/photon: Use require_relative and double quotes 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 a9fb66b3e3
guests/omnios: Use require_relative 2016-06-06 11:58:35 -04:00
Seth Vargo 9812102196
guests/omnios: Do not require vagrant in guest 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 90b62a0943
guests/mint: Use require_relative in plugin 2016-06-06 11:58:34 -04:00
Seth Vargo 9976b2a515
guests/mint: Do not require vagrant in guest 2016-06-06 11:58:33 -04:00
Seth Vargo 337e3d79d8
guests/linux: Use require_relative in plugin 2016-06-06 11:58:33 -04:00
Seth Vargo b643031b05
guests/linux: Do not require vagrant in guest 2016-06-06 11:58:33 -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 d4159e4208
guests/linux: Add tests for choosing addressable IP 2016-06-06 11:58:31 -04:00
Seth Vargo d07cb9d75e
guests/freebsd: Use require_relative 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 8c095ef172
guests/fedora: Configure hostname in one command 2016-06-06 11:58:29 -04:00
Seth Vargo d9b8352a58
guests/debian: Use predictable naming for network configuration 2016-06-06 11:58:28 -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 a3d45bb7e0
guests/darwin: Use require_relative in plugin defn 2016-06-06 11:58:28 -04:00
Seth Vargo 428d6b56e8
guests/darwin: Require vagrant 2016-06-06 11:58:28 -04:00
Seth Vargo 499e4afba8
guests/darwin: Upload public key instead of trying to shellescape 2016-06-06 11:58:27 -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 249cda879d
guests/coreos: Use require_relative in plugin defn 2016-06-06 11:58:27 -04:00
Seth Vargo 7906718347
guests/coreos: Require "vagrant" 2016-06-06 11:58:26 -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 0b2804fbb0
guests/atomic: Use require_relative in plugin defn 2016-06-06 11:58:25 -04:00
Seth Vargo 31e02cddf5
guests/atomic: Do not use sudo when checking hostname
The `hostname` command does not require root to execute
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 3a9ac19f7e
guests/arch: Use require_relative in plugin defn 2016-06-06 11:58:24 -04:00
Seth Vargo cb0e77692c
guests/arch: Do not use sudo when checking hostname
The `hostname` command does not require root to execute
2016-06-06 11:58:24 -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 b3cabe0180 Merge pull request #7379 from mitchellh/sethvargo/update_uniq
core/boxes: Do not update the same box twice
2016-06-04 21:22:06 +02:00
David O'Rourke 60fd777806 prepare_nfs_settings: Use scoped hash override when reading static IPs. 2016-06-03 15:19:23 +01:00
Gilles Cornu a7ee56459b provisioners/ansible(both): fix ansible config files presence checks
With this change, the presence of Ansible configuration files (like
playbook file, inventory path, galaxy role file, etc.) is no longer
performed by the `config` classes, but by the `provisioner` classes
(at the beginning of the provision command).

This change fixes several issues:

- Resolve #6984 as `provision` method are only executed when remote
  (ssh) communication with the guest machine is possible.
- Resolve #6763 in a better way than 4e451c6 initially did.
- Improve the general provisioner speed since the `config` checks are
  actually triggered by many vagrant actions (e.g. `destroy`,...), and
  can also be triggered multiple times during a vagrant run (e.g. on
  callback request made by the machine provider).

Unlike the former `config`-based checks, the provision action won't
collect all the invalid options, but only report the first invalid
option found and abort the execution.

Some unit tests were not implemented yet to save my scarce "open source
contribution time" for other important issues, but they should be done
at last via GH-6633.
2016-06-01 06:40:23 +02:00
Seth Vargo dab4537682
core/boxes: Do not update the same box twice
Vagrant's environment (which includes the known list of boxes and
versions) is established at the start of the Vagrant run. This means
that box downloads which occur during the run are not contained in the
set until the next run. This causes duplicate box downloads to raise an
error in multi-machine Vagrantfiles.

This commit fixes that issue by pre-processing the machines by provider
and version, creating a unique set of boxes to update.

Fixes GH-6042
2016-05-31 23:08:51 -04:00
Seth Vargo e270e7df27
provider/docker: Add -u flag to exec 2016-05-31 20:05:27 -04:00
Seth Vargo cfac24779c
provider/docker: Separate -i and -t flags for exec 2016-05-31 20:05:27 -04:00
Seth Vargo bf96b3348b
provider/docker: Add docker-exec command
This adds a new core command, `docker-exec`, which allows the user to
exec into an already-running container.

- Fixes #6566
- Fixes #5193
- Fixes #4904
- Fixes #4057
- Fixes #4179
- Fixes #4903
2016-05-31 20:05:26 -04:00
nico.vanelslande 163e1997a6 Make virtualbox vm_exists? more resilient to VirtualBox transient failures.
We know that the vm does not exist if we get VBOX_E_OBJECT_NOT_FOUND.
For any other error, this may well be VirtualBox getting confused and it is probably
worth retrying...
2016-05-31 13:23:56 +01: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 38f23fe001
providers/docker: Allow TCP and UDP ports on same number
This commit changes the way ports are aggregated in the Docker provider.
Previously ports were aggregated by their "number", but that is not a
truly unique representation. Instead, the protocol is now taken into
account when generating the port map.

Fixes GH-5527
2016-05-30 17:23:44 -04:00
Seth Vargo bba1cbc72f
Add --box-version to `vagrant init`
This also adds a test suite for that particular command, updates the
documentation, and adds some examples.

Fixes GH-5004
2016-05-30 15:33:58 -04:00
Seth Vargo d44fcf2d52
Allow customization of keys_only & paranoid SSH
This adds two new SSH configuration options:

- `keys_only`
- `paranoid`

These values were previously hard-coded, but can now be user-specified.

Fixes GH-4275
2016-05-29 18:03:03 -04:00
Seth Vargo aaef5da41d
Use a different info message when image changed 2016-05-29 14:38:18 -04:00