Commit Graph

3022 Commits

Author SHA1 Message Date
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
Luca Invernizzi d8c56be510
Restart docker container if newer image build is available. 2016-05-29 14:38:18 -04:00
Gilles Cornu 8190fba872 provisoners/ansible: improve config test coverage
Changes:

- Add "config" unit tests for `ansible_local` (guest)
- Share some "config" examples between both ansible provisioners
- Move `config_host.rb` specific examples to `config/host.rb`
- Add a requirement to "../helpers" in `config/guest.rb` in order to be
  able to run the related unit tests

References:

- This is the first part of GH-6633 resolution
- This change is a handy prerequisite for GH-6570

Not addressed yet:

- FIXME (guest.rb): Some test-double stubs are currently not working as
  expected, and the related checks are commented out for the moment
  (no idea why, but this is not urgent to be fixed because of GH-7335
  rejection. See also GH-6984)
- FIXME (shared.rb): The guest-based config should actually NOT return
  an error when the extra_vars file cannot be found, but only display a
  a warning (similarly to the changes done for GH-6763, see 4e451c6)
2016-05-29 17:01:37 +02:00
Seth Vargo e2fadbcf08
Add a log message when the VM master is missing 2016-05-29 01:19:56 -04:00
Seth Vargo 1e7c8e8d6c
Use LF instead of CRLF 2016-05-29 01:18:24 -04:00
Seth Vargo d3d88f5d91 Merge pull request #7126 from jjulien/iss_6742
Fixed linked clone failure when master VM is missing
2016-05-29 01:14:04 -04:00
Seth Vargo 07389ffc04
Update command help to show id too 2016-05-29 01:06:51 -04:00
Seth Vargo 61adbf77d4 Merge pull request #7287 from KierranM/win-ssh-forward
[#7202] Always forward SSH on Windows
2016-05-29 00:58:18 -04:00
Seth Vargo b11f8cbd1b Merge pull request #7293 from ericpulvino/master
Set max_network_adapters to 36 for Virtualbox
2016-05-29 00:55:44 -04:00
Seth Vargo 982af05178
Add a note about why we will always leak RDP tmpfiles 2016-05-28 23:53:20 -04:00
Seth Vargo f95eb124d5
Use Util::Tempfile in Chef provisioner
This also fixes some Windowsisms
2016-05-28 23:22:35 -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
Seth Vargo 3d2390fc94
Give a unique, prefixed name to all tempfiles
This commit basically grepped the code base for all uses of Dir.mktmpdir
and Tempfile.new/open and ensures the value is unique within the
code base and also prefixed with `vagrant-`.

Previously, most invocations of these commands simply used "vagrant",
thus making them indistinguishable when trying to identify leaks.
2016-05-28 23:22:34 -04:00
Seth Vargo cee6e6c7bc
Fix file leaking in bundler 2016-05-28 17:01:59 -04:00
Seth Vargo fc8e97cd89
Style 2016-05-27 19:08:49 -04:00
Seth Vargo 01369342db Merge pull request #5670 from agdula/master
add RDP auto login with password
2016-05-27 19:08:10 -04:00
Ray Ruvinskiy e42f346b1d
Make `start` action run provisioners if VM is running
Previously, there was no one gesture that would start a VM if it was not
running and run the appropriate provisioners regardless of its original
state. `vagrant up` did nothing if the VM was running, while
`vagrant provision` did nothing if the VM was not running.

Change the semantics of `vagrant up`, via the start actions of the providers,
to go through the provisioning logic even if the VM is already running.
The semantics of `run: "once"` vs `run: "always"` are respected.

Tested with the VirtualBox provider but not the others.

Resolves #4421
2016-05-27 19:00:33 -04:00
Seth Vargo 68329817ad Merge pull request #7290 from phyber/fix/master/prepare_nfs_settings_machine_ip_fix
prepare_nfs_settings: Try harder to get all machine IPs.
2016-05-27 18:38:03 -04:00
Seth Vargo 8c11b537ba
Allow Mac/Windows users to use Docker native 2016-05-27 17:36:07 -04:00
Seth Vargo db1f98ffd6 Merge pull request #7298 from till/t/docker-for-mac-beta
Change: disable the linux switch (Docker for Mac/Windows, etc.)
2016-05-27 17:25:13 -04:00
Seth Vargo 171434bbf9 Merge pull request #7353 from mitchellh/sethvargo/package_preflight
Move pre-flight package validation to middleware
2016-05-27 17:16:40 -04:00
Seth Vargo f313c89d74 Merge pull request #7059 from markpeek/markpeek-no-provision-on-resume
Do not ignore the sentinal file when running resume
2016-05-27 17:07:41 -04:00
Seth Vargo efdb148f61
Move pre-flight package validation to middleware
This commit separates the scratch and output directory creation from the
main package middleware into its own PackageSetupFolders middleware.
Additionally, the validation that ensures an output file does not exist
is moved into a validation function that can be shared across multiple
methods.

This refactor permits a pre-flight check to ensure box packaging would
be successful before actually stopping the VM.

Fixes GH-7351
2016-05-27 17:07:04 -04:00
Seth Vargo 08550b6888 Merge pull request #7108 from jtopper/fix_hyperv_status_exception
HyperV: Reinstate compatibility with PowerShell 4
2016-05-20 10:46:01 -04:00
Seth Vargo b384ff98a5
Trailing comma 2016-05-19 11:35:53 -04:00
Thom May 693d4dd5f1
Support Chef Solo local + legacy modes
Signed-off-by: Thom May <thom@may.lt>
2016-05-19 15:27:17 +01:00
Jon Topper 0a7c20a93a Determine status behaviour based on PS version 2016-05-13 17:50:24 +01:00
Jon Topper df4caf0757 Add snapshots to Hyper-V driver 2016-05-13 16:58:08 +01:00
David O'Rourke 985f1d4dda prepare_nfs_settings: Fix add_ips_to_env!, spec test passes again. 2016-05-10 11:16:21 +01:00
till 647bd6114c Change: disable the linux switch (Docker for Mac/Windows, etc.) 2016-05-08 21:35:12 +02:00
Eric Pulvino 45e52e3bf1 Updated ./plugins/providers/virtualbox/driver/base.rb file, set max_network_adapters to 36 for Virtualbox so all 36 adapters are cleared prior to programming interfaces. This fix is per issue 7286 --> https://github.com/mitchellh/vagrant/issues/7286 2016-05-08 00:11:22 -04:00
David O'Rourke ed708645b2 prepare_nfs_settings: Try harder to get all machine IPs.
Vagrant was not behaving correctly in configurations where there was
a static IP on a VirtualBox `intnet` interface and a DHCP `:hostonly`
interface configured.

Since `machine_ip` attempted to get static addresses `||` dynamic
addresses, it would simply use the static machine address and
continue.

This commit corrects this behaviour by collecting all static and
dynamic addresses into the `machine_ip` array instead of just one or
the other.

The result of this is a correctly generated `/etc/exports` on the
host machine, allowing NFS mounts to work correctly in this type of
environment.
2016-05-05 14:41:03 +01:00
Kierran McPherson 3bff55034a kernel/v2: Reimplement 8655d21 to always forward SSH
Fixes #7202
Always forwards SSH even if WinRM is set
2016-05-04 17:26:44 +12:00
penz d29acc8982 Do not let NFS systemctl status use a pager
Call it with "--no-pager"
Without it, if the user has a pager (more/less/etc.) configured and
call vagrant up with NFS shares, systemctl would use the pager, and
that would probably require an unnecessary key press from the user.
2016-04-28 13:28:37 -03:00
Gilles Cornu cf908d35e0 provisioners/ansible_local: Run galaxy from `provisioning_path` directory
Since it is now possible to specify some Galaxy settings in an
`ansible.cfg` file, it makes sense to run `ansible-galaxy` from the
same working directory as `ansible-playbook` execution does.

See http://docs.ansible.com/ansible/intro_configuration.html#galaxy-settings
2016-04-24 00:26:59 +02:00
Gilles Cornu b6a3f0e8f1 Merge pull request #7103 from mitchellh/gildegoma/fix-6726
ansible_local: use double quoting for 'extra-vars', 'limit' and 'start-at-task' options (except if defined via `raw_arguments` option)
2016-04-21 00:29:43 +02:00
Gilles Cornu b2286388f0 provisioners/ansible: add basic config validators
With this change, the `raw_arguments` and `raw_ssh_args` options are:
- STILL automatically converted as an Array when they are set a String
  (no behaviour change)
- rejected if they are not of Array data type otherwise

Additional Notes:
- the 'as_array' tiny helper has been removed since it was no longer
  used.
- there is for now no deeper validation (i.e. verifying that the Array
  elements are only *String* objects)
2016-04-20 23:54:19 +02:00
Gilles Cornu ab036ddd0b provisioners/ansible: don't format raw_arguments
With cb80286a4a, the helper function
stringify_ansible_playbook_command was also applied on the
`raw_arguments` content, which is not wanted. Given that users have used
the `raw_arguments` option as a workaround to avoid the bug GH-6726,
this new change ensure that any `--extra-vars` option passed as a raw
argument won't be additonally enquoted by the ansible_local
provisioner.

This change also improves the ansible remote provisioner verbose output,
but has no impact on its behaviour, which was already correct.

Note that this refactoring introduces some code duplications that are not
very elegant (see ansible_playbook_command_for_shell_execution in
host.rb and execute_ansible_playbook_from_host in base.rb). I hope we
can find a better implementation later, but it is good enough for now
since all these parts are covered by corresponding unit tests (the
`ansible_local` stuff being tested via the verbose output of the ansible
remote provisioner).
2016-04-20 23:50:42 +02:00
Seth Vargo 6c01aaf6ab Merge pull request #7090 from mac2000/master
hyperv differencing disk
2016-04-17 23:14:29 +05:30
Seth Vargo 2d0943b0ad Print a warning when token and envvar are set
Fixes GH-7206
2016-04-08 10:16:10 -04:00
Michael Sarahan 72e9f0fe10 move masterless config to apply to all platforms 2016-04-05 10:24:47 -05:00
Darragh Bailey cae0bfdf9d provisioners/ansible: Replace inventory file instead of modify
When updating the inventory, write to a temp file and replace the
original once writing is complete, to allow for an atomic replacement
of the contents.

Ensures that ansible reading an inventory file will get either the old
or new contents, but never the truncated version of the file that
appears should you open it with 'w' mode set to replace the contents.

Solves the 'provided hosts list is empty' error, which is emitted by
ansible should it manage to be reading the inventory file just as it
was truncated, but before the new contents were flushed to disk.

Partially-Fixes: #6526
2016-03-31 17:44:20 +01:00
Seth Vargo 0505771481 Do not return an error if ifdown fails
Ubuntu versions prior to 16.04 always returned a successful exit status,
even if one tried to down an interface that does not exist. This
behavior changed in Ubuntu 16.04 to return an error. This commit
preserves the old behavior.

Fixes GH-7155
2016-03-20 18:21:03 +02:00
Seth Vargo 76e7a980a8 Use a hash for directory lookups 2016-03-17 20:48:08 -05:00
Phivos Stylianides a27e7e106a push via sftp issue when file parent directory does not exist
Overcomes exception Net::SFTP::StatusException (2, "no such file") when using: "vagrant push" via sftp and a file parent directory does not exist. Function "upload" does not create the directory before uploading a file ('mkdir: true' seems to have no effect as zero directories are created while files are uploaded normally).
2016-03-17 20:46:47 -05:00
Seth Vargo 8319f159b6 Use hostname if no node_name is set
Fixes GH-7063
2016-03-17 20:15:11 -05:00
Seth Vargo d565c2f07e Check both stderr and stdout
Different vbox versions print this to different streams, so check both
just to be sure
2016-03-17 10:52:10 -04:00
Seth Vargo 5b336949b5 Merge pull request #7050 from md55/snapshots-in-virtualbox41
Adds snapshot commands in VirtualBox 4.1
2016-03-17 10:48:03 -04:00
John Julien e0ecda961c Fixed linked clone failure when master VM is missing
If the master VM is removed, but the master_id file exists, Vagrant
would still attempt to clone using the master_id rather then
importing re-importing first.

Fixes #6742
2016-03-09 19:33:47 -06:00
Lars Christensen a6565199ff Restart network after reconfiguration
Fixes #7119.
2016-03-08 16:24:24 +01:00
Seth Vargo c6c9942e2e Merge pull request #7104 from altexdim/fix_centos_networks
Fixed centos 7 networks if using more than 3 ethernet adapters.
2016-03-07 11:30:26 -05:00
Altex 9e9909536c fix 2016-03-07 19:25:57 +03:00
Altex e998d6b0f4 Fixed centos 7 networks if using more than 3 ethernet adapters. 2016-03-05 22:25:59 +03:00
Gilles Cornu 47c0833277 ansible_local: use double quotes instead of single quotes
Before this minor change, the '--limit' and '--start-at-task'
ansible-playbook command line arguments were enclosed into single
quotes. Using double quotes adds a bit more flexibility, especially
about the task name referred by `start_at_task` option.

It also aligns with the handling of the '--extra-vars' parameter
(see cb80286).
2016-03-05 17:25:54 +01:00
Gilles Cornu cb80286a4a ansible_local: put json extra-vars in double quotes
Without this change, the JSON string generated from the `extra_vars`
Ruby hash is passed without enclosing quotes and is then not parseable
by the ansible-playbook command when exectuted in a usual shell context.

In this changeset, the ansible (remote) unit test coverage is improved
to cover both usage of `extra_vars` (ansible_local unit tests are still
missing).

Additional Notes:

 - Double quotes are favored to single quotes in order to allow usage of
   any character for the variable values. For this reason additional
   escaping is appended to JSON-inner double quotes and backslashes.

 - This problem was not affecting the `ansible` remote provisioner
   (which is running the ansible-playbook command via the childprocess
   Ruby library). But with this change, the `verbose` output will also
   now be correct for a copy-paste reuse.

 - After this change, all the "--extra-vars" arguments (also a var
   file passed with the @-syntax or anything coming via the
   `raw_arguments` option) are "blindly" and systematically enclosed
   in double quoted and double-escaped.
   This is not optimal and can potentially break with peculiar values
   (e.g. a double quote character (") cannot be used in a json value
   when using `raw_arguments`). That said, I think that the current
   solution is a reasonable trade-off, since the official `extra_vars`
   option should now be able to cover a great majority of use cases.

Fix #6726
2016-03-05 17:24:28 +01:00
Matt Wrock 508492faae fixes #7098 only specifying Hyper-V generation if the parameter is supported 2016-03-04 23:42:17 -08:00
Paul Hinze 32519b226c Merge pull request #6879 from jtopper/allow_no_delete_snapshot_on_pop
Add missing features to snapshot restore/pop
2016-03-04 11:40:54 -06:00
Jon Topper a7008ef5ec Fix up style nit. 2016-03-04 17:35:54 +00:00
Andres Montalban 492ba40fd1 [MOD] Change the way FreeBSD network interfaces are configured. Fixes #5852 2016-03-01 19:28:09 -03:00
Marchenko Alexandr 51d7c98d49 hyperv differencing disk 2016-03-01 17:23:38 +02:00
Seth Vargo fbd765acc1 Do not interpolate in SMB linux heredoc
Fixes GH-6906
2016-02-29 07:19:45 -05:00
Kamjar Gerami fc6bc723f7 #7074 - fixes does not allow provisioning when container name is specifed - since recent versions of Docker stores it's full container ID we no longer need to use the short version 2016-02-28 13:00:35 +01:00