Commit graph

623 commits

Author SHA1 Message Date
Chris Roberts
6db640fb14 Adjust vbox hostonly config for ipv6
Check the type when an ipv6 address is being used. If the type does not
have a `6` suffix, append it.
2023-09-11 17:48:02 -07:00
Chris Roberts
f4142705ab
Merge pull request #13241 from lordgurke/fix-vagrant-13226-wrong-filename
Remove duplicate appending of "6" to network type
2023-09-11 17:45:34 -07:00
Chris Roberts
eb5aaed72d
Merge pull request #13259 from chrisroberts/remove-exps
Remove experimental checks
2023-09-11 17:31:58 -07:00
Chris Roberts
513be177d3 Remove experimental checks
Removes experimental checks on existing experimental features.
2023-09-08 14:15:34 -07:00
Chris Roberts
e958c6183a Adds initial HCP config support
Adds initial basic support for HCP based configuration in vagrant-go.
The initalization process has been updated to remove Vagrantfile parsing
from the client, moving it to the runner using init jobs for the basis
and the project (if there is one). Detection is done on the file based
on extension for Ruby based parsing or HCP based parsing.

Current HCP parsing is extremely simple and currently just a base to
build off. Config components will be able to implement an `Init`
function to handle receiving configuration data from a non-native source
file. This will be extended to include a default approach for injecting
defined data in the future.

Some cleanup was done in the state around validations. Some logging
adjustments were applied on the Ruby side for better behavior
consistency.

VirtualBox provider now caches locale detection to prevent multiple
checks every time the driver is initialized.
2023-09-07 17:26:10 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
Max
8ecfe32021
Remove duplicate appending of "6" to network type
To distinct between IPv4 and IPv6 configuration, a "6" was added to the network configuration type if an IPv6 address should be configured. This is now duplicate, as with pull 13024 the same thing is already done prior, thus leading to a duplicate "6" at the end of the network config type, i.e. "static66".
2023-07-30 17:33:58 +02:00
Chris Roberts
8e98c5ff1c Update locale preference for the virtualbox driver
Update the locale preference list to prefer UTF-8 variations of `C` when
available.
2023-05-17 11:59:05 -07:00
Chris Roberts
d53d8e61bc Fix LANG value used for VirtualBox driver
The VirtualBox driver sets the LANG env var to prevent localized output
being returned when executing CLI commands. If the `locale` command is
present, do a best effort lookup to determine the properly value to use
for the LANG environment variable.
2023-05-15 11:01:29 -07:00
sophia
38e6e86d80 Removes check for hyperv being enabled when verifying virtualbox
is usable on windows. Virtualbox has supported running with hyperv
since version 6.0.0 https://www.virtualbox.org/wiki/Changelog-6.0.
(Virtualbox 6.0 is currently EOL) So, this check is no longer
required.
2023-02-17 11:38:28 -08:00
sophia
28574348b9 Read only machine port forward info
In the VM config file port forward information is captured in the
Snapshot defition as well as the VM definition. This causes duplicates
in port forward entries if the file is queried for all available
network adapters. Querying the VM config file for the the Network
Adapters only part of the Machine definition resolves this and
yields the most up to date port forward info.
2023-01-12 12:02:00 -08:00
Chris Roberts
516ac4b0ab Set address type when not provided
When an address is provided and the type has not been explicitly
provided, parse the address and automatically set the type.
2022-12-09 13:22:37 -08:00
Chris Roberts
5cbf66b93c Update log output to warn 2022-12-08 11:14:46 -08:00
Chris Roberts
32aef6c48c Rescue address errors and adjust host address
Rescue any address errors logging them and ignoring the address. Update
how the host address is determined based on the network configuration.
Host address will be either the lowest address assignable via dhcp
configuration or first address available within the configured subnet.
2022-11-21 14:07:29 -08:00
Chris Roberts
8549450cff
Merge pull request #12994 from chrisroberts/vbox-locale
Force LANG when executing commands
2022-11-14 13:27:48 -08:00
Chris Roberts
d8de3016ea
Merge pull request #12992 from chrisroberts/vbox-networks-nfs
VirtualBox read networks support with hostonlynets
2022-11-14 12:14:03 -08:00
Chris Roberts
f7e5a9d199 Force LANG when executing commands
This forces the LANG enviroment variable to be set to `"C"` when
executing VBoxManage commands. Doing this prevents localization of
output which causes failures of the VirtualBox driver when scanning
for information.
2022-11-14 10:45:47 -08:00
Chris Roberts
9e4047533d Customize #read_network_interfaces for hostonlynetworks
Adds an override for the #read_network_interfaces when hostonlynetworks
are in use to properly identify the hostonly network information from
the guest. This also adjusts the IP provided for the network to be
the first in the subnet.
2022-11-14 10:45:33 -08:00
Chris Roberts
cbddfbd028 Handle missing machine folder value
If the value of the machine folder can not be found in the
system properties, report a user friendly error message and
include relevant information in the logs for debugging.
2022-11-14 10:45:10 -08:00
Chris Roberts
c0c4b80dcb Pass all options to host only network creation 2022-11-03 17:20:54 -07:00
Chris Roberts
c8a71882d3 Disable hostonly ip validation for vbox 7 on darwin 2022-11-03 17:18:10 -07:00
Chris Roberts
3604bacc19 Update virtualbox driver for hostonlynets support 2022-11-03 17:18:10 -07:00
Chris Roberts
60ec1943ea Fix file formatting 2022-11-03 11:55:50 -07:00
Chris Roberts
e7e1badbdc Add support for VirtualBox 7.0 2022-10-14 15:58:00 -07:00
Paul Hinze
eacb798a71
Fix action hooks running twice in destroy_on_error scenarios
The "destroy_on_error" functionality for `vagrant up` is implemented in
the `recover()` action chain, and works by firing off a destroy action
from inside that chain.

This is all well and good, but it copies its existing `env` which has
had `action_name` set for the up action. This was causing action_hooks
for up actions to attach to this destroy action stack.

Setting the action_name explicitly in the env before firing the runner
should correct the behavior. I'm not sure if raw_action_name is used
anywhere but I figured it was better to be consistent vs conservative in
what we change.
2022-04-25 12:26:56 -05:00
sophia
1aabc7c4b5
Add mapper for a Class to String 2022-04-25 12:26:12 -05:00
sophia
04a6f762af
Make synced folder mapping work 2022-04-25 12:26:11 -05:00
sophia
e86dc5958a
Clean up debugging cruft 2022-04-25 12:24:09 -05:00
sophia
5ecb1cdc26
Get/set machine id 2022-04-25 12:24:09 -05:00
Chris Roberts
ac92fd8e1d Access provider driver through machine for version check
Updates the VirtualBox version check for network range validation
    to access the driver via the machine instances provider within the
    passed env.
2021-11-03 09:32:41 -07:00
Chris Roberts
2f9a0ac253 Adjust default range 2021-10-29 09:43:47 -07:00
Chris Roberts
b23095eac5 Remove freeze on version to resolve comparison 2021-10-29 08:47:43 -07:00
Chris Roberts
ae7639ec23 Validate VirtualBox hostonly network range
VirtualBox introduced a restriction on the valid range for hostonly
    networks. When using a version of VirtualBox which includes this
    restriction a check is performed on the defined IP address to validate
    it is within either the default range (as defined in the VirtualBox
    documentation) or the values defined in the network configuration
    file.
2021-10-28 17:12:15 -07:00
Sophia Castellarin
0c653a3d4f
Merge pull request #12211 from soapy1/get-default-dhcp-ip
Get default dhcp ip from a matching host ip
2021-03-08 13:57:46 -06:00
sophia
5d3c37126f Get default dhcp ip from a matching host ip 2021-02-24 15:53:27 -06:00
sophia
b30a87ce6c Extract os friendly mount name for vbox shared folders 2021-02-10 15:25:56 -06:00
Hristo Paskalev
865ffb9965 Added proper exception handling whenever VirtualBox installation is corrupt 2020-10-03 15:37:49 +03:00
sophia
583b3f5332 Persist smb mounts 2020-09-22 16:53:10 -05:00
Dan Duvall
1b0f5120c6 Avoid sorting of controllers with nil boot_priority
Some unsupported storage controllers (e.g. floppy) report a nil
boot_priority which results in a failed sort. Select only supported
storage controllers to avoid that case.
2020-09-01 09:57:55 -07:00
sophia
2a8372a272 Add mount type cap 2020-08-19 15:00:40 -05:00
sophia
7577c11eb6 Persist synced folders in action 2020-08-19 15:00:40 -05:00
sophia
cde39e26ba Make mount options a synced_folder capability 2020-08-19 15:00:40 -05:00
sophia
e7e956ca12 Fix a few deprecation warnings for ruby 2.7 2020-08-10 16:32:54 -05:00
Sophia Castellarin
c17ba03904
Merge pull request #11773 from soapy1/cloud-init-wait-action
Add cloud init wait action
2020-08-06 16:28:45 -05:00
sophia
a1d429a4e8 Raise more descriptive error if cloud init fails 2020-08-06 15:47:36 -05:00
sophia
0a5a940e58 Raise an error if cloud-init is not found on guest 2020-07-29 12:50:50 -05:00
Brian Cain
60ef0d7d9c
Use existing disk structure rather than finding port/device again 2020-07-27 13:46:03 -07:00
Brian Cain
e2c844db74
Properly determine disk recovery
Because Vagrant no longer determines `all_disks` through `vboxmanage
list hdds`, it can't rely on unattached disks existing in `all_disks`.
This commit fixes that by including the results from `list hdds` to
determine if Vagrant needs to reattach a disk created by Vagrant that
failed to be attached previously.
2020-07-27 13:31:28 -07:00
Brian Cain
851422ee55
Ensure extra_disk_data is skipped if nil
This commit skips over adding any extra_disk_data to the storage
controller data structure in case it's nil.
2020-07-24 15:50:23 -07:00
sophia
c48befbe61 Only do cloud init actions on 'vagrant up' 2020-07-17 09:45:51 -05:00