959 Commits

Author SHA1 Message Date
Jeff Bonhag
d4acdd06ec
Fix #11373: Check all interfaces for port collisions
This commit changes the behavior of the port check to check all possible
IPv4 network interfaces when the host IP is `nil` or `0.0.0.0`. This
means that if the desired port is available on any network interfaces, a
forward from 0.0.0.0 will use that interface.

If the port is open (in use) on all interfaces, then it's treated as a
collision and will either throw an error or auto-correct the port, based
on the Vagrantfile configuration.
2020-03-13 16:30:01 -04:00
Chris Roberts
98f0ec6ab7 Dynamically apply hooks to actions prior to execution
Removes dynamic calls of before/after hooks and replaces it with
proper lookups for hooks defined for the action to run. If hooks
are found for an action, the action is placed in a new builder
and the hooks are applied. The new stack is extracted, finalized,
and then executed.
2020-03-03 16:23:31 -08:00
Brian Cain
9150d3db7b
Always cleanup disks even if no disks in Vagrantfile 2020-02-10 12:58:11 -08:00
Brian Cain
eff3d47f82
Add cleanup_disks test 2020-02-10 12:58:11 -08:00
Brian Cain
ca26afa299
Don't write disk_meta file if no disks to configure 2020-02-10 12:58:11 -08:00
Brian Cain
6ba621ac92
Add ability to cleanup and close mediums for a guest 2020-02-10 12:58:11 -08:00
Brian Cain
ad798c2c12
Pass in disk meta file for cleanup_disks 2020-02-10 12:58:11 -08:00
Brian Cain
cc8ed8a616
Add cleanup_disks action 2020-02-10 12:58:11 -08:00
Brian Cain
5bf8d2363e
Update logger message 2020-02-10 12:58:11 -08:00
Brian Cain
ec350861cd
Write down metadata for disk configs after configuring disks 2020-02-10 12:58:11 -08:00
Brian Cain
6855dd8c74
Check name config option with respond_to?
Prior to this commit, the check used to look for the config option
`name` in a provisioner config would accidentally create a "DummyConfig"
based on how vagrant handles missing config options. This commit fixes
that by instead using the `respond_to?` method to check for the
existance of the config option name.
2020-01-07 11:10:02 -08:00
Brian Cain
711270b90a
Fixes #11287: Set top level provisioner name if set in provisioner
config

Prior to this commit, if a user had configured a provisioner that had a
config with a `name` option, it would not properly set the top level
provisioner classes name config option which would lead to some
understanibly confusing results when trying to `--provision-with`. This
commit fixes that by checking to see if the top level name isn't set,
look to see if that provisioners config defines a name, and use that
instead.
2020-01-06 11:10:28 -08:00
Jeff Bonhag
7fb7dd8608
Enable WinSSH shell for vagrant ssh -c (#11258)
This commit changes the behavior of the builtin SSHRun action to use a Windows
shell if the WinSSH communicator is active.  This allows for running one-off SSH
commands with Windows Command Prompt or PowerShell.  By default, this will not
allocate a TTY for any SSH commands.

Example usage:

```
vagrant ssh -c 'dir "c:\program files"'
```

Updates docs to reflect a change made in
a55a53e6a46438d5093487f83248f01ddece4534.
2019-12-20 13:10:11 -05:00
Chris Roberts
80c05460ab Call hooks before and after each action if they are available 2019-12-18 13:11:30 -08:00
Brian Cain
de61b307aa
Only run disk action if disk config present 2019-12-17 10:45:33 -08:00
Brian Cain
bcf4d5a210
Fixes #11228: Allow to force check for box updates
Prior to this commit, if a user had recently checked for updates, there
was no way to force Vagrant to re-check without manually deleting a
state file in the local `.vagrant` data dir. This commit fixes that by
giving users the ability to force check for updates for a given box with
a flag to the `vagrant box outdated` command.
2019-12-03 11:42:55 -08:00
Brian Cain
f979d40436
Add warning if machines provider does not support disk configuration 2019-11-22 14:40:23 -08:00
Brian Cain
8ad810b5b6
Check and call into provider capability :configure_disks 2019-11-22 14:40:23 -08:00
Brian Cain
54c3e28a45
Add comment for potential hook into provider configuring disk 2019-11-22 14:40:23 -08:00
Brian Cain
83fea21ff1
Simplify builtin disk action 2019-11-22 14:40:23 -08:00
Brian Cain
d6df83103e
Add todo for attaching and configuring disk for a given provider 2019-11-22 14:40:23 -08:00
Brian Cain
cef1bd47b3
Add initial disk builtin action 2019-11-22 14:40:23 -08:00
Brian Cain
8adffc830a
Add builtin disk action 2019-11-22 14:40:23 -08:00
Brian Cain
efd3a62ffe
Fixes #11207: Do not validate checksums if options are empty string
Prior to this commit, if Vagrant received checksum options from Vagrant
Cloud that were simply empty strings, it would try to validate its
checksum with those options. This commit fixes that by ignoring empty
string values.
2019-11-21 09:56:58 -08:00
Jeff Bonhag
a39a7ae794
Fixes #10741: Check if update is available locally (#11188)
This commit checks the local box collection to see if the latest box
update has already been downloaded.  If it has, Vagrant will display the
destroy/recreate message instead of the "run vagrant update" message.
2019-11-12 11:41:10 -05:00
Chris Roberts
13654dcc37 Update box checksum logic to use that supplied from FileChecksum 2019-10-08 11:23:48 -07:00
Brian Cain
f74239bed9
Merge pull request #11043 from briancain/provisioner-enhancements
Introduce new Provisioner options: before and after
2019-09-06 08:52:40 -07:00
Brian Cain
e19f54457d
Fixes #10908: Preserve in-use boxes when force flag is used with prune
Prior to this commit, `vagrant box prune --force` would not prompt a
user to prune Vagrant boxes, even if that box was in use. There was no
way to prune boxes, ignore the prompt, but keep in-use boxes. This
commit adds a new flag that can be combined with `--force`, that will
keep in-use boxes but prune older boxes without prompting the user.
2019-09-04 15:54:11 -07:00
Brian Cain
7b0dc8d528
Update provisioner enhancements from pull request feedback 2019-08-29 13:50:22 -07:00
Brian Cain
160ee09da2
Cleanup sorting method for provisioner sorting 2019-08-28 14:32:51 -07:00
Brian Cain
c1f0bd638d
Insert _at_ index, rather than before
Inserting at the right index places new item *before* the index, so no
need to decrement and then insert, since `insert` takes care of shifting
down elements of the array.
2019-08-28 14:11:25 -07:00
Brian Cain
271d427c57
Fix bug in :each provisioner sorting
Ensure each provisioners are properly inserted into the final
provisioner array
2019-08-27 14:28:06 -07:00
Brian Cain
c189e4d255
Redo how each provisioners are sorted 2019-08-26 16:05:02 -07:00
Brian Cain
28ef368881
Begin to add tests for mixin provisioner 2019-08-26 12:03:36 -07:00
Brian Cain
ef82c0a5bc
Move return earlier 2019-08-22 12:01:19 -07:00
Brian Cain
be5964a1db
Add basic provisioner sorting 2019-08-21 14:44:16 -07:00
Brian Cain
6777493c46
Include before/after options in final provision hash 2019-08-20 11:31:00 -07:00
Chris Roberts
5b94bbb49b Scrub folder configuration data when persisting to disk
Before writing synced folder configuration data to the local
data directory run content through the credential scrubber to
remove any sensitive content before write.
2019-04-25 10:31:48 -07:00
Brian Cain
ee985f9f7f
Fix typo in UI Prefix for trigger UI 2019-03-21 10:11:38 -07:00
Chris Roberts
c0eaac791d Write metadata file to box contents during package
If the provider does not include a metadata.json file prior to
compressing the box, determine current provider and write
metadata.json file before compressing.
2019-02-28 15:31:49 -08:00
Chris Roberts
7e47602e3d Wrap output in thread when being called from within trap-context
This prevents a ThreadError exception being raised on sigint which
resulted in a stacktrace being dumped.
2019-02-12 16:06:16 -08:00
Brian Cain
08214ec90f
Ensure action param is a symbol, and if nil return to do nothing 2019-02-01 13:34:15 -08:00
Brian Cain
6ac23f1a15
Add fire trigger test for cli class 2019-02-01 13:34:15 -08:00
Brian Cain
071d8b09cd
Add machine for hook and action triggers 2019-02-01 13:34:15 -08:00
Brian Cain
5e4850a0d2
Use name instead of class 2019-02-01 13:34:15 -08:00
Brian Cain
ae0960f2da
Add comment to wardens finalize_action method 2019-02-01 13:34:15 -08:00
Brian Cain
ebacb96626
Update docs for action trigger actions 2019-02-01 13:34:15 -08:00
Brian Cain
fefb702359
Introduce type and command triggers
This commit introduces some basic functionality for typed triggers:

- command
- action

Command triggers are triggers that will run before or after a given
sub-command.

Action triggers are for running triggers before or after internal
actions for Vagrant. This could be before or after a provision step,
before or after synced folders, or networking, etc.
2019-02-01 13:34:15 -08:00
Brian Cain
c55363412e
Fixes #10339: Show box version during outdated check
This commit updates the output Vagrant displays when checking if a box
is out of date by adding the version.
2019-01-08 10:31:10 -08:00
Chris Roberts
976320ec06 Limit automatic box outdated checks to once per hour 2018-11-01 09:45:11 -07:00