60 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
2375cbe8a2 Use Command operation in place of Task 2023-06-05 14:18:05 -07:00
sophia
21e9fc3674 Use basic ui if using a non color enabled terminal 2022-09-14 11:42:54 -04:00
sophia
f7cd08b208 Pass terminal output color option from Ruby to terminal plugin 2022-09-14 11:42:52 -04:00
sophia
a718e228a4 Colour go experimental warning 2022-09-14 11:41:30 -04:00
sophia
2f5c185708 Warn users when using vagrant-go 2022-07-28 11:54:27 -05:00
Paul Hinze
7c56c74bb6
Support and honor the "primary" option for Command plugins 2022-07-27 11:36:04 -05:00
Chris Roberts
cbbc0ca7f5 Keep deferred close as multiple calls are allowed 2022-07-25 15:28:00 -07:00
Chris Roberts
1ae72d6283 Use cleanup and log error if encountered 2022-07-25 15:27:30 -07:00
Chris Roberts
d5e41e328e Check base command close for error and modify exitcode 2022-07-25 14:28:53 -07:00
Paul Hinze
63cefbb8ed
Fix ssh-config and winrm-config by remote-ifying safe_puts
This also removes the "Running (command)..." output since users will
expect to be able to redirect the ssh-config output to a file without
that noise.

If we really like the "Running" thing we can try and swing around and
get fancy by detecting whether or not we have a terminal or a file as
output and doing conditional stuff, but this seemed like the simplest
way forward for now.
2022-06-24 12:53:57 -05:00
sophia
9ed92d2ab6 Recognize --machine-readable flag 2022-05-31 14:41:34 -05:00
sophia
079975fe2b Add machine readable flag 2022-05-31 10:09:35 -05:00
sophia
4f63043646 Rename --tty flag to --interactive 2022-05-25 16:10:27 -05:00
sophia
85362faaed Output deprecated message for --timestamp and --debug-timestamp flags 2022-05-24 12:11:08 -05:00
sophia
1137b9d467 Recognize debug flags 2022-05-24 12:11:08 -05:00
sophia
d062e03d97 Force all boolean flags to have a negative alias 2022-05-18 15:13:58 -05:00
sophia
887903c0e1 Set aliases for command flags 2022-05-17 14:06:04 -05:00
sophia
584e7d2913 Make flag --no-tty 2022-05-17 14:04:18 -05:00
sophia
108275de21 Set default values for flags 2022-05-16 16:19:40 -05:00
sophia
1b8246c28f Set base command flag data 2022-05-16 14:56:22 -05:00
sophia
df25af809c Use no-tty flag 2022-05-16 13:52:52 -05:00
sophia
26fac3e1d9 Setup noninteractive ui for the base command if the --no-tty falg is provided 2022-05-13 16:49:30 -05:00
sophia
7a999d1f06 Add tty flag and set noninteractive terminal 2022-05-13 13:46:36 -05:00
Paul Hinze
73a1be95fe
Fix nil dereference bug in new error handling logic
Found this while running `./vagrant box` with no args to get the help
output. It turns out you can have an empty RunResult but also a nil
error. I took the occasion to unwind the conditional tree a bit which
hopefully makes it a bit easier to read.
2022-04-25 12:26:49 -05:00
Paul Hinze
1341bfe0af
Tweak Ruby->Go error handling so exit codes match
In legacy Vagrant, any exception raised that's a subclass of
Vagrant::Errors::VagrantError is considered user-facing and so causes
the error message to be printed to the console and the process to use
exit code 1. Anything outside of that causes the process to use exit
code 255. (See `bin/vagrant` for the code.)

Here we mirror that behavior by treating errors that have a
LocalizedMessage as user-facing and those without as unexpected. This
allows the basic virtualbox component to pass in vagrant-spec!
2022-04-25 12:26:49 -05:00
Paul Hinze
7f56168959
Work around a few global flag collisions for ssh command
* `vagrant ssh` has a --no-tty flag colliding with the one defined in
   `bin/vagrant` - in fact none of the flags in `bin/vagrant` are
   processed in `serve` mode, so remove the code that captures them from
   the CommandInfo OptionParser dance
 * `vagrant ssh` has a `--plain` flag colliding with the one defined in
   `internal/cli/base.go` - this flag was inherited from Waypoint, so we
   can just rename it to line up with the (inversely defined) `--color`
   flag used in legacy vagrant
2022-04-25 12:26:48 -05:00
sophia
f97aff623f
Set default log level fwhen launching vagrant ruby 2022-04-25 12:26:45 -05:00
sophia
3516aa7131
Set defailt Vagrant log level 2022-04-25 12:26:44 -05:00
sophia
0904996af1
Set default log level for VAGRANT_LOG 2022-04-25 12:26:44 -05:00
Paul Hinze
736e080add
Fix version printing to pass vagrant-spec
* Makes all help output showup on stdout like in rubyland
 * Moves verbosity flags to capital Vs to get out of the way of version
 * Passes version down to mitchellh/cli so it handles -v and --version
   flags
 * Tweaks version output to remove the leading `v` which is not output
   in legacy vagrant
2022-04-25 12:26:41 -05:00
Chris Roberts
14fa44a449
Update to use command info from sdk 2022-04-25 12:26:32 -05:00
Chris Roberts
46a9440b57
Set remaining args into proto 2022-04-25 12:26:26 -05:00
Chris Roberts
c010ae0429
Update CLI to use internal flags implementation 2022-04-25 12:26:25 -05:00
Chris Roberts
16931138e7
Update git submodule location
Having the modules stored in `./vendor` causes issues with `go mod`.
    Follow waypoint's convention to store in `./thirdparty` and grab
    the same Makefile modifications to alert when the submodules need
    to be initialized. Update generators to use new path.
2022-04-25 12:26:25 -05:00
Chris Roberts
d8145cdd52
Update flag value extraction for dynamic commands 2022-04-25 12:26:22 -05:00
Chris Roberts
e00f82fdee
Update to use component flags and update parsing 2022-04-25 12:26:22 -05:00
Chris Roberts
39439cf9fb
Register commands and subcommands during setup 2022-04-25 12:26:22 -05:00
Chris Roberts
66dc2fd259
Remove loading status during startup 2022-04-25 12:26:22 -05:00
Chris Roberts
5115bc3fb3
Update to use component command flags 2022-04-25 12:26:21 -05:00
sophia
deb667ecd3
Use common rpc errdetails messages 2022-04-25 12:26:20 -05:00
sophia
219473fb60
Seach for localized error message in error details 2022-04-25 12:26:20 -05:00
sophia
c4e97bb89b
Send localized message originating from plugin (if applicable) 2022-04-25 12:26:20 -05:00
Chris Roberts
42a89335d4
Set environment variable to persist logging level 2022-04-25 12:26:19 -05:00
sophia
bb43048813
Remove unused cli config code 2022-04-25 12:26:06 -05:00
Chris Roberts
96ac78a9a4
Fix some panics 2022-04-25 12:24:31 -05:00
Chris Roberts
6bc65c10c8
Update dynamic to use client directly and automatically set scope 2022-04-25 12:24:25 -05:00
Chris Roberts
9caa92a20a
Update command setup to use base client and then load scope
There are still some things left to address like how to handle
a target (or targets) and if that is something we should even
be doing. It may be best to just let the command deal with
target loading. There are also some considerations to make
around remote source.
2022-04-25 12:24:25 -05:00
Chris Roberts
dd9f7f19b4
Update types used 2022-04-25 12:24:24 -05:00