1213 Commits

Author SHA1 Message Date
Chris Roberts
51adb12547 Add architecture support for boxes
Introduce support for handling box architecture. Adds a new
`box_architecture` setting that defaults to `:auto` which will perform
automatic detection of the host system, but can be overridden with a
custom value. Can also be set to `nil` which will result in it fetching
the box flagged with the default architecture within the metadata.

Box collection has been modified to allow existing boxes already
downloaded and unpacked to still function as expected when architecture
information is not available.
2023-09-14 16:15:03 -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
Chris Roberts
8e26495189 Project client and proc mapper fixes
Default the options for default provider so an options value is not
required when calling. The index for the proc lookup should use the key
method, not index.
2023-06-05 17:39:58 -07:00
Chris Roberts
1d991cb253 Rescue not found and return nil for machine box 2023-06-05 14:18:06 -07:00
Chris Roberts
0a20379b1a Enable deprecated key type and host key algorithm
Recent versions of OpenSSH remove support of ssh-rsa key types and host
key algorithms from the default conection configuration. Set options to
enable them and provide a configuration option which can disable them if
required.
2023-05-22 17:09:47 -07:00
Chris Roberts
b0c5852145 Move constants to isolated file to be loaded on-demand
Since the protos are only loaded when the serve command is invoked, move
the constant alias definitions into an isolated file so they are only
loaded when needed by the serve command
2023-05-18 12:02:07 -07:00
Sophia Castellarin
9f9d2fdfcb
Merge pull request #12652 from t2sa/typo
Fix sentense
2023-02-14 12:12:27 -08:00
Chris Roberts
1cd6ac3b31 Isolate loading dependencies for serve command
Only load the dependencies needed for the serve command if the serve
command is being run. This allows Vagrant to properly load on platforms
where some of the dependency libraries may not be available due to
incompatibilities or being EOL.
2022-12-07 15:35:00 -08:00
Derek Ditch
f581778c2c Fixes Google namespace resolution to global space 2022-11-08 08:50:01 -06:00
sophia
49280286ad Strip new lines from error details
The error details message should just be one string without spacing
so the terminal can set a output length. This will allow messages
from Ruby and Go errors to have similar formating.
2022-09-19 15:14:42 -04:00
sophia
add66c4c2a Include message in rpc status error from ruby 2022-09-19 15:14:42 -04:00
sophia
6d4f769c87 Validate provider 2022-09-19 15:14:42 -04:00
sophia
f7cd08b208 Pass terminal output color option from Ruby to terminal plugin 2022-09-14 11:42:52 -04:00
sophia
8bdb5e797d Pass in echo/secret ui input setting 2022-08-30 15:18:21 -05:00
Paul Hinze
7c56c74bb6
Support and honor the "primary" option for Command plugins 2022-07-27 11:36:04 -05:00
Sophia Castellarin
5170d83c21
Merge pull request #325 from hashicorp/load-external-plugin-config
Find type to unany objects when mapping
2022-07-26 14:15:33 -05:00
sophia
c2d8f892ac Find type to unany objects when mapping
find_types works fine until you have a module which has the same name but different case. For example, the VagrantVmware package is HashiCorp::VagrantVMwareDesktop. All the protos are at Hashicorp::Vagrant::… So, you end up with this fun

Object.constants.select { |n| n.to_s.downcase == "hashicorp" }
=> [:HashiCorp, :Hashicorp]

So, when trying to walk down the modules to find the right type to unany to, Vagrant sometimes takes the wrong path (eg. Down the HashiCorp module instead of the Hashicorp module).

This change will keep a list of the parent modules when walking down the module list. This way if a dead end is reached then Vagrant can go a level back and keep searching for the correct class.
2022-07-26 12:22:28 -05:00
Chris Roberts
54502d5d66
Merge pull request #324 from hashicorp/fix-packaged-hang
Fix hanging commands when using packaged installation
2022-07-26 09:12:50 -07:00
Chris Roberts
b917dc466a Implement stop on the ruby internal service 2022-07-25 14:30:45 -07:00
Chris Roberts
fda4aef9c7 Make server instance accessible, return integer value 2022-07-25 14:29:38 -07:00
Paul Hinze
fc76f71ffc
Fix vbox multimachine by setting provider parallel default correctly
Turns out I misinterpreted the behavior of a ruby method with a default
being passed nil so I assumed :parallel was effectively defaulting to
true when it is the opposite.
2022-07-25 15:52:11 -05:00
Sophia Castellarin
fe4956ac83
Merge pull request #314 from hashicorp/ruby-load-global-plugins
Load global ruby plugins
2022-07-25 09:40:00 -05:00
Paul Hinze
9ab94f9971
Fix crashes on Vagrantfiles with provisioners
I forgot to handle nil in the new PluginOptions stuff, and options are
nil for Provisioner plugins.
2022-07-20 17:36:05 -05:00
Paul Hinze
957d0d3779
Bring plugin options back to Ruby for providers and synced folders
This removes the need for the validation workaround for Docker, because
box_updated is once again available in that context.

We don't technically need the SyncedFolder priorities back on the Ruby
side, but wiring them through for symmetry.

Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/183
2022-07-15 12:14:47 -05:00
sophia
5bc7218a70 Load global ruby plugins 2022-07-13 14:08:46 -05:00
Chris Roberts
da9892a62f Use #to_proto on class match, otherwise convert 2022-07-11 15:09:46 -07:00
Chris Roberts
2572d4f62b Include class where error originated 2022-07-11 15:09:21 -07:00
Chris Roberts
e082fd6359 Machine mapper no longer needs to load through environment 2022-07-11 15:09:08 -07:00
Chris Roberts
67895c927e Allow a machine client to load its target 2022-07-11 15:08:53 -07:00
Chris Roberts
d5ec939022 Request target in spec and allow conversion to machine 2022-07-08 16:38:03 -07:00
Chris Roberts
19b4adb3b8 Implement get_value rpc in vagrantfile client 2022-07-08 16:38:02 -07:00
Paul Hinze
ee8883153c
Make Docker provider work again post config refactor
- Allow machine.box to be empty without sadness (depends on
   https://github.com/hashicorp/vagrant-plugin-sdk/pull/182)
 - Get synced folder type from plugin name instead of defaulting to
   :virtualbox
2022-07-08 11:36:27 -05:00
Sophia Castellarin
66a22e5254
Merge pull request #303 from hashicorp/synced_folder_has_override_opts
Synced folder has override opts
2022-07-07 16:28:14 -05:00
Chris Roberts
f5d778d51a Revert "Merge pull request #300 from hashicorp/optimize-ruby-command-list"
This reverts commit 1c26a4abb0c9e095b3f6ec9944c4b15f6f1cd064, reversing
changes made to 186824a568583d8f6f2a50501d940ed71608fa0b.

The changes broke plugin loading when using subcommands so these
changes will be reverted until the underlying issue can be
investigated and resolved.
2022-07-07 14:03:56 -07:00
Paul Hinze
59a8e9bb0f
Merge pull request #306 from hashicorp/fix-capability-boolean-handling
Fix Type::Booleans leaking through capabilities
2022-07-07 14:21:05 -05:00
sophia
b17c36c7c7 Fix typo 2022-07-07 12:30:24 -05:00
Sophia Castellarin
0b53e06687
Merge pull request #297 from hashicorp/port-command-fix
Use remote provider
2022-07-07 12:21:48 -05:00
sophia
f1af42a7fc Don't use hash with indifferent access when converting hash
The HashWithIndifferentAccess will change all keys to strings when
merged with another regular hash. This causes errors in cases where
hashes are merged, for example in the action builder. Symbol/String
type data is kept over the wire, so there is no need to make the
mapped hash a HashWithIndifferentAccess.
2022-07-07 11:50:03 -05:00
sophia
73801703e7 Pass machine to provider capabilities 2022-07-07 11:49:57 -05:00
Paul Hinze
75d900c93b
Fix Type::Booleans leaking through capabilities
We had some cases where calling a capability that returned a boolean was
not getting correctly unpacked, so instead of `true` or `false` the
capability was putting out
`VagrantPlugins::CommandServe::Type::Boolean`.

This may have been happening in _all_ cases where a boolean was returned
from a capability and we just didn't notice it yet because the return
value was always truthy.

These tweaks should help ensure that Ruby types make it out where they
are supposed to be in Args::Direct usage.
2022-07-07 11:29:50 -05:00
Chris Roberts
1c26a4abb0
Merge pull request #300 from hashicorp/optimize-ruby-command-list
Optimize command list generation
2022-07-07 09:29:15 -07:00
Sophia Castellarin
186824a568
Merge pull request #302 from hashicorp/private-network
Rely on string/symbol maps for hash mapping
2022-07-06 13:20:41 -05:00
sophia
eeba305399 Rely on string/symbol maps for hash mapping
Relying on HashWithIndifferentAccess in Hash mappers results in
errors when hashes get merged in Ruby. When merges between regular
hashes and HashWithIndifferentAccess happens, then all the keys
from HashWithIndifferentAccess are transformed to strings.
2022-07-01 12:47:12 -05:00
Paul Hinze
fb2a102c71
Fix init and other commands that run without a project
The Basis needs to be able to respond to Vagrantfile() and
DefaultProvider() to make it through Vagrant::Environment
initialization.

Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/178
2022-07-01 11:56:08 -05:00
Chris Roberts
6aa50189a2 Return empty results when no content to parse 2022-07-01 08:57:28 -07:00
sophia
20ec85b021 Use remote provider 2022-06-30 16:57:41 -05:00
Chris Roberts
067e6aeed1 Add get commands implementation to client and server 2022-06-29 16:13:36 -07:00
Chris Roberts
ffa10b4d85 Return integer value from serve command 2022-06-29 16:11:53 -07:00
sophia
adadf26c9c Check if communicator is available before detecting guests 2022-06-29 17:23:43 -05:00