Commit Graph

3758 Commits

Author SHA1 Message Date
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
a55a53e6a4.
2019-12-20 13:10:11 -05:00
Jeff Bonhag ade076cabb
Fixes #11236: Windows port detection (#11244)
This reverts commit 81553263ab.

This fixes a regression with Windows port detection which led to port
collisions not being fixed on `vagrant up`.

PR #8517 changed `IsPortOpen#is_port_open?` to rescue
Errno::EADDRNOTAVAIL, but when we merged it into master, there was code
in `HandleForwardedPortCollisions#port_check` that depended on that
error bubbling up.
2019-12-19 14:46:13 -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 61ee42976b
Merge pull request #11262 from briancain/return-if-no-disk-config
Return if no disk config
2019-12-17 13:55:08 -08:00
Brian Cain de61b307aa
Only run disk action if disk config present 2019-12-17 10:45:33 -08:00
Jeff Bonhag d7a5f74897
Fixes #11128: Error if machine folder inaccessible (#11239)
This commit catches the Errno::EPERM raised by the operating system if
the machine folder is inaccessible and displays it as a more friendly
error message.

This can be an issue on macOS Catalina if virtual machine files are kept
in a special directory (Documents/Downloads/Desktop) that Vagrant's
embedded Ruby is not allowed to access.
2019-12-17 12:41:12 -05: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 2e324a4971
Add conversion method for shortcut size in disk config 2019-11-22 14:40:23 -08:00
Brian Cain 271cf8a603
Begin to add Numeric class helper for converting size strings 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 0e68f02dc9
Fixes #11163: Get latest version for provider (#11192)
This commit changes the behavior of `vagrant box outdated --global` so
it gets the latest version for the current machine's provider, rather
than the latest version for any provider.
2019-11-13 17:33:15 -05:00
Brian Cain 39ea1af5ab
Merge pull request #11183 from briancain/fixup/include-errors-in-checksum-util
Fixes #11179: Ensure Vagrant::Errors are loaded in file_checksum util
2019-11-12 09:06:49 -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
Brian Cain 44c6f655be
Fixes #11179: Ensure Vagrant::Errors are loaded in file_checksum util
Prior to this commit, the file_checksum class used the `Vagrant::Errors`
class as if it were apart of the Vagrant module. However, since the
file_checksum class is an interface and not part of the Vagrant module,
it doesn't have access to that Error class like other Vagrant modules.
This commit fixes that by ensuring the `"vagrant/errors"` class is
loaded, and that the proper namespace is used.
2019-11-07 09:22:17 -08:00
Chris Roberts 318dca294a Ensure empty message values are properly formatted 2019-10-15 08:54:24 -07:00
Chris Roberts 783f5fc65d Update UI to properly retain newlines when adding prefix
When using a Prefixed UI instance prevent new line characters from
being removed when adding prefix formatting to output messages.

Fixes #11044
2019-10-14 16:56:40 -07:00
Chris Roberts 13654dcc37 Update box checksum logic to use that supplied from FileChecksum 2019-10-08 11:23:48 -07:00
Chris Roberts 9ee5ce4817 Remove checksum from downloader and replace with FileChecksum
Remove checksum implementation within the Util::Downloader and
relocate it into the FileChecksum helper class. Update Downloader
to use FileChecksum.
2019-10-08 11:23:48 -07:00
Chris Roberts 7fb81bcea1 Add support for other checksum types 2019-10-08 11:23:48 -07:00
Brian Cain ace67ccdeb
Remove platform require since it is no longer required in file 2019-09-10 13:28:37 -07:00
Brian Cain a22acba467
Simplify line and path checks for exception handling in config loading 2019-09-10 13:27:23 -07:00
Brian Cain ccf99d8c0c
Fixes #11022: Show proper path & letter drive on exceptions for windows
Prior to this commit, vagrant was not grabbing all of the tokens on
Windows for showing the full drive because the ruby api for it behaves
differenly on windows compared to other platforms. This commit changes
that by ensuring the letter drive is attached to the path when showing
an exception.
2019-09-06 13:37:38 -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 7fbe8bcabc Fix plugin discovery loading when no data directory is available
If the local data directory is unavailable, there will be no local
file to use within the plugin manager. Check for local file before
returning result, otherwise just return an empty hash.
2019-06-21 11:15:39 -07:00
Chris Roberts 7c6b2963c3
Merge pull request #10911 from chrisroberts/f-plugin-loading
Support loading machine configuration without provider validation
2019-06-20 11:23:10 -07:00
Zhongcheng Lao caae214bf7 Fix provider name not work when specified
Provider name should be symbol in guess_provider.
2019-06-17 08:22:50 +08:00
Chris Roberts 9bae0a7094 Support loading machine configuration without provider validation
Allow Vagrantfile#machine_config to load properly when the requested
provider may not be currently available. Update the Environment to
utilize this when searching for plugin information to properly allow
box provided Vagrantfiles to define required plugins.
2019-06-14 11:50:06 -07:00
Chris Roberts bbd75ef25a
Merge pull request #10896 from chrisroberts/f-plugin-constraints
Properly generate dependency instance when multiple constraints provided
2019-06-05 14:01:48 -07:00
Chris Roberts b90d01377e
Merge pull request #10894 from chrisroberts/e-deps-system
Handle strict dependency enforcement when installed within system
2019-06-05 14:00:07 -07:00
Chris Roberts 2507b68045
Merge pull request #10891 from chrisroberts/f-trigger-multithread
Update trigger abort behavior when running parallel actions
2019-06-05 13:58:44 -07:00
Chris Roberts f5f89f72b7
Merge pull request #10889 from chrisroberts/f-local-plugins-boxfile
Support loading plugin information from nested Vagrantfiles
2019-06-05 13:56:29 -07:00