409 Commits

Author SHA1 Message Date
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
380afe5fac Define directory and paths for insecure private keys
Within the environment, add a new directory value which points to the
directory containing the valid insecure private keys. A new default
private key paths value contains an array of all the insecure private
keys which are available for initial authentication.
2023-06-26 15:43:25 -07:00
sophia
7661eba89a Environment home dir is also not accessible if EROFS error occurs 2023-01-03 16:01:20 -08:00
Paul Hinze
f221614187
Fix duplicate guess_provider call
No reason to call it twice when it's already being stored in a local
variable that's unmodified.

Also document the params for this method to help lay the groundwork for
porting.
2022-05-25 16:19:50 -05:00
Paul Hinze
2707d09181
Fix prepend/append action hooks firing multiple times
This addresses the surprising behavior that the StoreBoxMetadata hook
was running many times during a machine up, including during failed
operations where a destroy_on_error deleted the machine. This was
resulting in an error that looked like:

> No such file or directory @ rb_sysopen [...] /[...]/box_meta

Plugin action hooks using prepend/append were attaching every time a
Builder was run, including sub-Builders that show up for things like
Call actions.

To fix this, we tell Builders if they are "primary" and only run
prepend/append on those. See inline comments for more explanation.
2022-04-25 12:26:55 -05:00
Paul Hinze
0fef7cc416
Port push plugins
This uses the new Push plugin support added to the plugin SDK in https://github.com/hashicorp/vagrant-plugin-sdk/pull/106 to make the following changes:

 * The plugin manager on the Go side now registers push plugins
 * The the _remote_ plugin manager on the Ruby side now calls over to
   the go side to get push plugins
 * All the wiring is hooked up such that when a push plugin is replaced
   with its remote GRPC-client-wielding equivalent, the messages are
   ferried around.
2022-04-25 12:26:21 -05:00
Chris Roberts
6994f5d5a7
Start adding updates for remote environment in ruby runtime 2022-04-25 12:24:08 -05:00
Chris Roberts
c887a18437
Allow UI instance to be provided to environment and used properly 2022-04-25 12:23:55 -05:00
Chris Roberts
7350b85902
Implement enough of the command service to get things working.
Also updates the UI setup so that we can properly get the
    output streaming back to us.
2022-04-25 12:23:55 -05:00
sophia
4c26f5b384
Make machine with ui 2022-04-25 12:23:54 -05:00
sophia
fd74318bf5
Pass ui to machine 2022-04-25 12:23:54 -05:00
Pedro Furtado
a8e00cb01d
Update environment.rb 2021-07-09 21:32:22 -03:00
Chris Roberts
c6153ff84f Remove deprecation log messages 2021-03-15 15:36:33 -07:00
Chris Roberts
51382a0d0a Deprecate hook and disable access token parameter by default
This sets the `authenticate_box_url` hook as deprecated and also
    disables the cloud auth middleware from adding an access token
    as a URL parameter by default. An environment variable has been
    added which can be used for re-enabling the access token URL
    parameter behavior if required for some legacy system which does
    not support the authorization header.
2021-03-15 14:46:46 -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
50c4464d44 Support loading plugin information from nested Vagrantfiles
Since plugin installation happens when the environment is first
initialized, attempt to determine the provider in use and load
any box provided Vagrantfiles to include any plugin configuration
they may include.
2019-06-04 10:07:02 -07: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
Chris Roberts
1c480880f1 Add test coverage of local rgloader creation 2018-10-10 10:30:30 -07:00
Chris Roberts
006cea45e3 Provide rgloader for project local plugins 2018-10-09 16:27:47 -07:00
Chris Roberts
798fb81926 Force command to be re-run after installing local plugins
Reloading the Vagrantfile causes issue with multiple evaluations
where users expect single evaluation. Instead of allowing local
plugin installation to happen prior to command execution, force
halt after installation and the command to be re-run. This will
prevent multiple loads of the Vagrantfile within a single run.
2018-09-10 09:59:58 -07:00
Chris Roberts
e24728cb5a
Merge pull request #10155 from chrisroberts/f-plugin-load-config
Reset internal environment after plugin load
2018-08-30 11:30:14 -07:00
Chris Roberts
9b67655e45 Reset internal environment after plugin load
Force the vagrantfile and configuration loader to be rebuilt after
plugins have been loaded to properly allow newly introduced plugin
configurations to be properly supported within the Vagrantfile.
2018-08-30 10:44:09 -07:00
Chris Roberts
92109752a3 Fix local plugin prompt and add coverage 2018-08-30 10:35:16 -07:00
Chris Roberts
6c1a9dc58e Store box metadata of active guest
When a guest is created, the box metadata information is stored in the
machine data directory. This allows modifications to happen to the
Vagrantfile definition of the box in use (box name change, box version
change, etc) while still allowing the Machine instance of an active
guest successfully load the box currently backing it.
2018-08-02 11:01:36 -07:00
Chris Roberts
ae14f95124 Properly downcase answer for check. Default response to no. 2018-07-19 10:31:32 -07:00
Chris Roberts
ab39125570 Set options directly instead of lazy merging 2018-07-18 15:47:35 -07:00
Chris Roberts
c605b7d875 Update option name for local plugin installation 2018-07-17 15:35:25 -07:00
Chris Roberts
3223737734 Use env_local consistently internally 2018-07-17 14:49:41 -07:00
Chris Roberts
84c0aafe71 Support non-interactive local plugin install 2018-07-17 14:49:41 -07:00
Chris Roberts
40f4e6f67e Vagrant Environment isolated plugins
Adds support for plugins isolated to a specific `Vagrant::Environment`
which can be managed by the vagrant plugin command using the the
--local flag.
2018-07-17 14:49:41 -07:00
Chris Roberts
f3c5e86f28
Merge pull request #9504 from zachflower/feature/vagrant-aliases
Vagrant aliases
2018-04-06 15:39:18 -07:00
Josh Soref
1a5ddea9f4 Spelling fixes
* account
* addresses
* administrator
* afterwards
* because
* bridgeable
* capabilities
* capability
* checksum
* configuration
* configuration for
* configure
* criteria
* delimited
* delivered
* derivatives
* description
* detect
* directory
* display
* downloading
* during
* electric
* enabling
* encountered
* equivalent
* executable
* executed
* hashicorp
* hypervisor
* hyphens
* implementation
* incorporate
* inheritance
* initialize
* instance
* instead
* interactions
* invocable
* machine
* maximum
* message
* mounting
* overridden
* overwrite
* paramiko
* preparing
* provides
* provisioning
* recursively
* requested
* resetting
* retryable
* running
* satisfied
* searching
* sometimes
* specified
* successfully
* synced folders
* unauthorized
* underlying
* userprofile
* vagrant
* vagrantfile
* variable
* various
* version
* virtual
* windows
2018-03-14 14:41:04 +00:00
Zachary Flower
3dbcdea691 allow the alias file path to be defined via an environment variable 2018-02-25 22:32:13 -07:00
Zachary Flower
f46ebf5240 throw an exception when whitespace is found within an alias keyword 2018-02-16 13:28:57 -07:00
Chris Roberts
d2cad65053 Remove deprecated checkpoint integration 2018-01-16 15:21:22 -08:00
Chris Roberts
4ce0ee1a7d Add debug output when detecting provider for environment. 2017-07-06 12:30:57 -07:00
Aron Griffis
7c538b4504
Honor VAGRANT_PREFERRED_PROVIDERS in Environment#default_provider 2017-05-03 08:19:29 -04:00
Aron Griffis
f256fc882f
Rewrite Environment#default_provider to be less confusing 2017-05-03 08:19:03 -04:00
Chris Roberts
bfc2af4cf9 Always provide timeout on thread join to prevent deadlock errors 2017-03-27 12:58:39 -07:00
Chris Roberts
74438cc495 Merge pull request #8196 from chrisroberts/fix/expand-vagrantfile-path
Allow VAGRANT_DOTFILE_PATH to be expanded as expected.
2017-02-23 13:33:07 -08:00
Chris Roberts
959bdada82 Fix environment gems_path location 2017-02-01 12:43:16 -08:00
Chris Roberts
832c62f2aa Allow VAGRANT_DOTFILE_PATH to be expanded as expected.
This allows custom paths that include special characters like `~`
to be properly expanded instead of resulting in joined root path
with special characters included.
2017-01-12 14:01:25 -08:00
Alejandro Ojeda
50ca748b5c Fix Vagrant not prioritizing configured providers correctly
Fixes #7135: config.vm.provider not setting provider in multi-machine Vagrantfile
2016-08-25 03:34:23 +02:00
Carlos Rodrigues
218b697d5e This looks cleaner 2016-07-24 19:01:54 +01:00
Carlos Rodrigues
188a7dab0c Another try, without string substitution 2016-07-24 18:40:09 +01:00
Carlos Rodrigues
9ebc028745 Better checks, hopefully 2016-07-22 14:59:05 +01:00