Paul Hinze
7c56c74bb6
Support and honor the "primary" option for Command plugins
2022-07-27 11:36:04 -05:00
Chris Roberts
dca389eda0
Generated proto updates
2022-07-25 15:00:49 -07:00
sophia
4f0082adfa
Fix provider options typo
2022-07-18 10:03:01 -07:00
Paul Hinze
313905dde5
Merge pull request #317 from hashicorp/fix-help-subcommand
...
Band-aid to prevent help subcommand from erroring
2022-07-15 16:42:13 -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
Paul Hinze
f3dbc24a22
Band-aid to prevent help subcommand from erroring
...
The code running in the help subcommand relies on Command plugins being
returned from the manager with their options hash. Stubbing in a blank
hash prevents the command from crashing
What we really need is for CommandOptions to be modeled and passed
through from Go to Ruby so :primary subcommands can be displayed, but
that can be a follow-on task from this quick fix.
2022-07-15 11:25:50 -05:00
Chris Roberts
a7d3652920
Generated proto update
2022-07-11 15:10:03 -07:00
Chris Roberts
d2ad38a607
Do not load provider during initialization
2022-07-08 16:38:03 -07:00
Chris Roberts
4dd69a07a3
Generated proto updates for vagrantfile
2022-07-08 16:38:02 -07:00
Chris Roberts
3c88c9ca7d
Support individual value fetching from vagrantfile
2022-07-08 16:38:02 -07:00
Paul Hinze
27d08534cf
Merge pull request #309 from hashicorp/fix-docker-by-supporting-machine-with-no-box
...
Make Docker provider work again post config refactor
2022-07-08 15:07:00 -05:00
sophia
a6caa47f8e
Environment#active_machines should return a list of tuple
...
The tuple should be compsed of the machine name (as a string)
and provider name (as a symbol)
2022-07-08 11:41:18 -05: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 1c26a4abb0 , reversing
changes made to 186824a568 .
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
sophia
9043ab4c45
go generate
2022-07-07 12:30:24 -05:00
sophia
e70a25e24f
Use the scoped hash override to get overriden synced folder config
2022-07-07 12:30:24 -05:00
sophia
b17c36c7c7
Fix typo
2022-07-07 12:30:24 -05:00
sophia
e8c0587c85
go generate
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
73801703e7
Pass machine to provider capabilities
2022-07-07 11:49:57 -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
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
sophia
52d37217ac
Use cache from CommandServe module
2022-06-30 16:57:41 -05:00
sophia
20ec85b021
Use remote provider
2022-06-30 16:57:41 -05:00
Chris Roberts
e1d7962ee8
Generated proto updates for get commands
2022-06-29 16:14:01 -07:00
sophia
adadf26c9c
Check if communicator is available before detecting guests
2022-06-29 17:23:43 -05:00
sophia
e0a30f9ba7
Raise error if communicator is not ready when getting guest from machine
2022-06-29 17:23:43 -05:00
Paul Hinze
430377fdce
Merge pull request #291 from hashicorp/fix-ssh-config
...
Fix ssh-config and winrm-config by remote-ifying safe_puts
2022-06-28 11:50:08 -05:00
Chris Roberts
f1695b6c1f
Generated proto updates for config wrappers
2022-06-24 18:28:10 -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
Chris Roberts
4b61b0be49
Fix state loading for machine
2022-06-21 14:42:14 -07:00
Chris Roberts
83467013e9
Handle Set and Logger types
2022-06-20 16:56:30 -07:00
Chris Roberts
e0d8fa6689
Generated proto updates
2022-06-20 13:13:06 -07:00
Chris Roberts
8e69548c76
Memoize some values fetched from the machine client
2022-06-20 13:10:38 -07:00
Chris Roberts
3f557e26f1
Log what wasn't handled by wrapper
2022-06-20 13:06:14 -07:00
Chris Roberts
4d403ef02a
Only raise error if version load is nil
2022-06-15 11:15:08 -07:00
Chris Roberts
2274efa568
Add helper method for performing partial loads
2022-06-15 11:06:33 -07:00
Chris Roberts
2af4ee0859
Always store values even when not registered
2022-06-15 11:06:33 -07:00
Chris Roberts
dfc2a6d6f4
Make dummy config a proper config instance and remove to_proto
2022-06-15 11:06:33 -07:00
Chris Roberts
09e6ff7ba2
Use client to get vagrantfile for environment
2022-06-15 11:06:33 -07:00
Chris Roberts
0d2627014c
Update remote machine to use client for values
2022-06-15 11:06:28 -07:00
Chris Roberts
972ba095e9
Add remote vagrantfile implementation
2022-06-15 11:02:29 -07:00
Chris Roberts
e47da98810
Update unset value constant
2022-06-15 11:02:29 -07:00
Chris Roberts
4128441aac
Remove to_proto from config and update unset value constant
2022-06-15 11:02:29 -07:00
sophia
ec2e2a6e89
go generate
2022-06-08 10:30:46 -05:00
sophia
90825f7086
go generate
2022-06-08 10:30:46 -05:00
Paul Hinze
8b08b3117c
Use plugin options for Synced Folder priorities
...
Now that plugin options are available, we can use them to interpret
synced folder priorities and remove the shim we had in place.
2022-06-06 17:39:09 -05:00
Paul Hinze
8dbe72a5a0
Use Component Options to implement ProviderOptions
...
* Populates ComponentOptions into plugin structs
* Maps options for legacy Provider Plugins into PluginOptions
* Demos use of PluginOptions in a stub provider
* Honors plugin priority and defaultable settings
2022-06-03 16:37:05 -05:00
Sophia Castellarin
fa1f45732b
Merge pull request #276 from hashicorp/machine-readable-flag
...
Machine readable flag
2022-06-03 12:11:15 -05:00
sophia
1ad8dc5234
Add command remote plugin
2022-06-01 14:36:19 -05:00
sophia
194882214a
Add machine readable bool endpoint to terminal ui
2022-05-31 15:47:47 -05:00
sophia
4ffe33461c
go generate .
2022-05-31 15:47:27 -05:00
sophia
32bb18e9b9
Only output machine readable data if the terminal is not interactive
2022-05-31 10:53:21 -05:00
sophia
65e851d646
Output machine readable data as table
2022-05-31 10:28:26 -05:00
sophia
313ba8655a
Implement missing ui#machine method
2022-05-31 10:09:36 -05:00
sophia
58e8e6ff97
Remove unused machine initialization steps
2022-05-31 10:09:35 -05:00
Paul Hinze
02a06bca45
Fixes for provider capability invocations
...
It looks like I might have been the first to hit provider cabability
invocation in testing these changes, and so I found these few missing
methods on the client. They're just copied over from the other
capability hosts.
Calling capabilities on a provider also revealed that the wrong Machine
type was being pulled out of the funcspec args, so we had to correct
that too in order to get the capability calls working.
2022-05-25 16:19:50 -05:00
Paul Hinze
e605132321
Pass along provider to environment.target
...
Mirrors change in https://github.com/hashicorp/vagrant-plugin-sdk/pull/157
2022-05-25 16:19:50 -05:00
Paul Hinze
06350a7afc
Port default provider selection
...
- Pulls in the SDK changes to Project.DefaultProvider and Project.Target
- Implements the hefty default provider method
- Un-hard-codes provider from Target, and sets it when a Target is
looked up from a Project
2022-05-25 16:19:50 -05: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
sophia
dc1687e1ab
go generate
2022-05-17 15:03:24 -05:00
sophia
d708bab84a
Add error message for errors originating from a remote
2022-05-13 17:14:50 -05:00
Paul Hinze
8ff4fd674c
Add back in some respond_to checks
...
Helps Environment::Remote to work when it's handed a Basis client for
operations like `box list` and `vagrant init`.
2022-05-06 15:23:54 -05:00
sophia
e020c6600e
Hacks to let a remote machine be instantiated with or with out a client
2022-05-04 11:25:54 -05:00
sophia
a40d890f74
Instantiate provider for remote machine
2022-05-04 11:25:18 -05:00
sophia
6c10944c52
Clean up unused functions
2022-05-04 11:23:12 -05:00
sophia
053d658e52
Get default provider from go side
...
For now the go side will just return a hard coded value for the
default provider. It should be implementing the algorithm defined
at https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider
2022-05-04 11:23:12 -05:00
sophia
92a0b1c541
Allow remote machine to be initialized with just a machine client
2022-05-04 11:23:06 -05:00
sophia
0117c01e4b
Fill in environment remote class
2022-05-04 11:22:41 -05:00
sophia
2000a53b06
Initialize from client if provided, otherwise from passed in environment
2022-05-04 09:32:36 -05:00
sophia
0a37521ef2
Remove reload machine function from the grpc api
2022-05-04 09:32:36 -05:00
sophia
6dfca17d54
Get machine state from go impl
2022-05-04 09:32:36 -05:00
sophia
b4fbf76a33
Plug machine#uid methods into remote go backend
2022-05-04 09:32:36 -05:00
sophia
5ab49f33bc
Refactor remote machine
2022-05-04 09:32:36 -05:00
Chris Roberts
bbf7e0fb12
Generated proto updates
2022-04-25 16:12:38 -07:00
sophia
3b8bf20b48
go generate
2022-04-25 14:12:28 -05:00
sophia
875c44b324
go generate
2022-04-25 12:26:58 -05:00
sophia
016a9a0efc
Remove box metadata ToMap functions
...
Box metadata is no longer passed around as a map. Instead it is
it's own service.
2022-04-25 12:26:57 -05:00
sophia
cddcfef0a1
Update Box#UpdateInfo to use box metadata client
2022-04-25 12:26:57 -05:00
sophia
8f23ce0d84
Return nil if box does not have an update
2022-04-25 12:26:57 -05:00
sophia
bb3da1e7db
Create box metadata from hash
2022-04-25 12:26:57 -05:00
sophia
147aa06cfd
Downcase and stringify metadata to create StringIO
2022-04-25 12:26:57 -05:00
sophia
35c094f570
Get box update info
2022-04-25 12:26:57 -05:00
sophia
495902a5df
go generate
2022-04-25 12:26:57 -05:00
Chris Roberts
81ec1173c2
Remove symbol transformation in config
2022-04-25 12:26:56 -05:00
Chris Roberts
a8edd7a031
Generated proto update
2022-04-25 12:26:56 -05:00
Paul Hinze
e5a75b78ec
Update Environment::Remote to match Environment changes
...
Since the `initialize` method is copied over, we need to mirror changes
from #250 into that copy
2022-04-25 12:26:55 -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
sophia
9dcb9df7ff
Let mappers convert machine to proto opposed to client
2022-04-25 12:26:55 -05:00
sophia
7b470d4b25
Ensure box metadata has optional arguments
2022-04-25 12:26:53 -05:00
sophia
c464569794
Remove extra logging
2022-04-25 12:26:53 -05:00
sophia
8adbab2f22
Sort box metadata versions
2022-04-25 12:26:53 -05:00
sophia
03ecb877e6
Update box metadata Name endpoint to boxName
2022-04-25 12:26:53 -05:00
sophia
66524426d0
Update ruby remote box metadata for proto changes
2022-04-25 12:26:53 -05:00
sophia
7f099bc30d
go generate
2022-04-25 12:26:53 -05:00
sophia
33c9d23a2e
go generate
2022-04-25 12:26:52 -05:00
sophia
428c3b02fd
Use remote box metadata implementation
2022-04-25 12:26:52 -05:00
sophia
84a6950c9e
go generate
2022-04-25 12:26:52 -05:00
sophia
9bf59a0d42
Rely on proto mappers to convert configs
2022-04-25 12:26:51 -05:00
sophia
436518e445
No need to stringify hash keys when using mappers
2022-04-25 12:26:51 -05:00
sophia
7dd3649d73
Update Symbol proto mappers
2022-04-25 12:26:51 -05:00
sophia
d5aacc0bc6
Thrash around making to proto for config faster
2022-04-25 12:26:51 -05:00
sophia
f4811af759
Use symbol proto when protoizing plugin configs
2022-04-25 12:26:51 -05:00
sophia
ccf2bf6197
Pass config as a SDK hash in order to use the Symbol proto
2022-04-25 12:26:51 -05:00
sophia
a0cec28849
go generate
2022-04-25 12:26:50 -05:00
sophia
77a06e83d0
Close core plugins
2022-04-25 12:26:50 -05:00
sophia
b40dde3797
Module for core plugin manager mappers
2022-04-25 12:26:50 -05:00
sophia
afc6d1c27d
Extract core plugin manager from context
2022-04-25 12:26:50 -05:00
sophia
e90c7a508f
go generate
2022-04-25 12:26:49 -05:00
Paul Hinze
a4f426d26e
Modify SSH utils server mode behavior so ssh -c works
...
Still work left to do on exec and stderr separation but this represents
enough working to let vagrant-spec assertions pass so I think it's worth a
checkpoint!
2022-04-25 12:26:48 -05:00
Paul Hinze
fda2bcf0cd
Refactor SSHRun action to make room for remote overrides
2022-04-25 12:26:48 -05:00
Paul Hinze
6471a5a310
Refactor Util::SSH to make room for remote overrides
...
Splitting out methods gives us a place to hook in appropriate behavior
for when we're running in a GRPC server.
2022-04-25 12:26:48 -05:00
sophia
b62bdd8efb
Add missing Target states to proto
2022-04-25 12:26:47 -05:00
Paul Hinze
8f9952089a
Fix commands that run without a project
...
Some commands like `vagrant init` and `vagrant box` should be able to
run successfully without a full Project available in VAGRANT_CWD (in
other words, they don't require that a valid Vagrantfile be available.)
Thus far we've been assuming that a Project is available when
dispatching commands, which mean that commands of this nature weren't
working.
Here we make the Basis available to serve as an alternative client to
Vagrant::Environment::Remote such that it can be instantiated and passed
through to commands. This required some changes to Environment::Remote
to make its interactions with the client more defensive, but we manage
to avoid needing to make any changes to the normal legacy codepaths.
2022-04-25 12:26:47 -05:00
sophia
725f7a3b6e
go generate
2022-04-25 12:26:47 -05:00
sophia
128599ab68
Get local box metadata in remote box
2022-04-25 12:26:47 -05:00
sophia
29d5b3627d
Always assume machine entry is valid on the ruby side
2022-04-25 12:26:46 -05:00
sophia
f55da8168a
Check if a box is in use using the machines endpoint
...
This returns a list of machine index entries that use the box. This
is what is expected from the Ruby side.
2022-04-25 12:26:46 -05:00
sophia
30c75b4d4d
go generate
2022-04-25 12:26:46 -05:00
sophia
a39747cc59
go generate
2022-04-25 12:26:46 -05:00
sophia
f1aec2c1c2
Return machine name as sym
2022-04-25 12:26:46 -05:00
sophia
bc641209e8
Check for box version
2022-04-25 12:26:46 -05:00
sophia
d9bcdba830
go generate
2022-04-25 12:26:45 -05:00
sophia
3516aa7131
Set defailt Vagrant log level
2022-04-25 12:26:44 -05:00
sophia
5d348e66a1
Update box proto to use struct for metadata
2022-04-25 12:26:44 -05:00
Paul Hinze
7c1d2e5368
Use optional fields on Synced Folder instead of empty string checks
...
Addresses concerns raised in discussion here
https://github.com/hashicorp/vagrant-ruby/pull/219#discussion_r816966056
and makes it so we don't have to change any plugin code to make things
work.
Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/133
2022-04-25 12:26:44 -05:00
Paul Hinze
2906d2c7df
Populate default when synced folder guest type is not set
...
This helps fix the unit tests that were failing. Also adding a test for
the new behavior
2022-04-25 12:26:44 -05:00
sophia
1441ea74d2
Get sf type from folders
2022-04-25 12:26:43 -05:00
Chris Roberts
6fe6ee3221
Generated proto update
2022-04-25 12:26:43 -05:00
Chris Roberts
535f82e192
Update remote UI implementation to retain formatting
2022-04-25 12:26:43 -05:00
Chris Roberts
2ec4bb1a13
Add remote override for #ask method
2022-04-25 12:26:42 -05:00
Chris Roberts
ee9af88606
Pass message as string instead of array
2022-04-25 12:26:42 -05:00
Chris Roberts
50a7a578d3
Use initialization args for cache key
2022-04-25 12:26:39 -05:00
Chris Roberts
6d0e08942b
Convert error logger message to warn
2022-04-25 12:26:39 -05:00
Chris Roberts
0a676fd3f1
Remove local provider class replacement in machine
2022-04-25 12:26:39 -05:00
Chris Roberts
924700e103
Support method passthru to local plugins
2022-04-25 12:26:38 -05:00
Chris Roberts
0ad82cf04a
Ensure all remote plugins handle client setup
2022-04-25 12:26:38 -05:00
Chris Roberts
7e9dad2b3e
Add remote host plugin
2022-04-25 12:26:38 -05:00
Paul Hinze
ff86d86ac8
Provisioner Plugins
2022-04-25 12:26:37 -05:00
Paul Hinze
8b6ef27a0f
Fix multiple synced folder handling in server mode
...
There was a hash assignment that was overriding values when there were
multiple synced folders for a given implementation.
Includes some stub-tastic unit tests to help verify the hash munging
behavior does what it's supposed to do going forward.
2022-04-25 12:26:37 -05:00
Chris Roberts
bdf8527ab0
Generated proto update
2022-04-25 12:26:36 -05:00
Chris Roberts
7cb620da23
Remove method which is no longer used
2022-04-25 12:26:36 -05:00
Chris Roberts
bcff6d6284
Re-enable using local provider from machine
2022-04-25 12:26:35 -05:00
Chris Roberts
a5b3ca9f6d
Return remote plugin instances
2022-04-25 12:26:35 -05:00
Chris Roberts
4a9d501823
Remove module injection on V2 plugins
2022-04-25 12:26:35 -05:00
Chris Roberts
e07a77f919
Update wrapper classes to use remote plugin classes
2022-04-25 12:26:35 -05:00
Chris Roberts
aa98e48e28
Update remote plugins to subclass V2 plugins
2022-04-25 12:26:35 -05:00
Chris Roberts
095a0f8847
WIP checkpoint with callable remote provider action
2022-04-25 12:26:35 -05:00
Chris Roberts
0cf2ea2eb6
Update wrapper initializer to use client from manager
2022-04-25 12:26:35 -05:00