Merge pull request #303 from hashicorp/synced_folder_has_override_opts
Synced folder has override opts
This commit is contained in:
commit
66a22e5254
2
go.mod
2
go.mod
@ -46,7 +46,7 @@ require (
|
|||||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||||
github.com/hashicorp/hcl/v2 v2.11.1
|
github.com/hashicorp/hcl/v2 v2.11.1
|
||||||
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d
|
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d
|
||||||
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220701171937-4cbbeaea0e70
|
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220707165921-a8b5817e43f5
|
||||||
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
|
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
|
||||||
github.com/imdario/mergo v0.3.11
|
github.com/imdario/mergo v0.3.11
|
||||||
github.com/improbable-eng/grpc-web v0.13.0
|
github.com/improbable-eng/grpc-web v0.13.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@ -363,6 +363,8 @@ github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d h1:afuZ/KNbxwU
|
|||||||
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d/go.mod h1:DCi2k47yuUDzf2qWAK8E1RVmWgz/lc0jZQeEnICTxmY=
|
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d/go.mod h1:DCi2k47yuUDzf2qWAK8E1RVmWgz/lc0jZQeEnICTxmY=
|
||||||
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220701171937-4cbbeaea0e70 h1:Pqn/v5JGkP20UNz8gyq/bm4OBdhitEqxs5y/+CmaeFY=
|
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220701171937-4cbbeaea0e70 h1:Pqn/v5JGkP20UNz8gyq/bm4OBdhitEqxs5y/+CmaeFY=
|
||||||
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220701171937-4cbbeaea0e70/go.mod h1:bdjvCJEaP+EFbg9vKdYuT5WuCfnFbemm0FEn4KtZaqU=
|
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220701171937-4cbbeaea0e70/go.mod h1:bdjvCJEaP+EFbg9vKdYuT5WuCfnFbemm0FEn4KtZaqU=
|
||||||
|
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220707165921-a8b5817e43f5 h1:ik4/++5TqY2LCBrSAiJHMKV+FGb1ZhnrdD00kyZRejg=
|
||||||
|
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220707165921-a8b5817e43f5/go.mod h1:bdjvCJEaP+EFbg9vKdYuT5WuCfnFbemm0FEn4KtZaqU=
|
||||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
||||||
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce h1:7UnVY3T/ZnHUrfviiAgIUjg2PXxsQfs5bphsG8F7Keo=
|
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce h1:7UnVY3T/ZnHUrfviiAgIUjg2PXxsQfs5bphsG8F7Keo=
|
||||||
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
||||||
|
|||||||
@ -444,7 +444,7 @@ func (m *Machine) SyncedFolders() (folders []*core.MachineSyncedFolder, err erro
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := map[string]interface{}{}
|
opts := map[interface{}]interface{}{}
|
||||||
for k, v := range options {
|
for k, v := range options {
|
||||||
key, err := optionToString(k)
|
key, err := optionToString(k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
|
||||||
// - protoc v3.19.4
|
|
||||||
// source: proto/ruby_vagrant/ruby-server.proto
|
|
||||||
|
|
||||||
package ruby_vagrant
|
package ruby_vagrant
|
||||||
|
|
||||||
|
|||||||
@ -9686,8 +9686,7 @@ func (*GetJobStreamResponse_Terminal_Event_Raw_) isGetJobStreamResponse_Terminal
|
|||||||
|
|
||||||
func (*GetJobStreamResponse_Terminal_Event_Table_) isGetJobStreamResponse_Terminal_Event_Event() {}
|
func (*GetJobStreamResponse_Terminal_Event_Table_) isGetJobStreamResponse_Terminal_Event_Event() {}
|
||||||
|
|
||||||
func (*GetJobStreamResponse_Terminal_Event_StepGroup_) isGetJobStreamResponse_Terminal_Event_Event() {
|
func (*GetJobStreamResponse_Terminal_Event_StepGroup_) isGetJobStreamResponse_Terminal_Event_Event() {}
|
||||||
}
|
|
||||||
|
|
||||||
func (*GetJobStreamResponse_Terminal_Event_Step_) isGetJobStreamResponse_Terminal_Event_Event() {}
|
func (*GetJobStreamResponse_Terminal_Event_Step_) isGetJobStreamResponse_Terminal_Event_Event() {}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
|
||||||
// - protoc v3.19.4
|
|
||||||
// source: proto/vagrant_server/server.proto
|
|
||||||
|
|
||||||
package vagrant_server
|
package vagrant_server
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module Vagrant
|
|||||||
module Action
|
module Action
|
||||||
module Builtin
|
module Builtin
|
||||||
module MixinSyncedFolders
|
module MixinSyncedFolders
|
||||||
autoload :Remote, "vagrant/action/builtin/remote/mixin_synced_folderse"
|
autoload :Remote, "vagrant/action/builtin/remote/mixin_synced_folders"
|
||||||
|
|
||||||
include Vagrant::Util::ScopedHashOverride
|
include Vagrant::Util::ScopedHashOverride
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
require "vagrant/util/scoped_hash_override"
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
class Machine
|
class Machine
|
||||||
# This module enables the Machine for server mode
|
# This module enables the Machine for server mode
|
||||||
module Remote
|
module Remote
|
||||||
|
|
||||||
|
include Vagrant::Util::ScopedHashOverride
|
||||||
|
|
||||||
# Add an attribute reader for the client
|
# Add an attribute reader for the client
|
||||||
# when applied to the Machine class
|
# when applied to the Machine class
|
||||||
def self.prepended(klass)
|
def self.prepended(klass)
|
||||||
@ -298,8 +301,9 @@ module Vagrant
|
|||||||
impl = :virtualbox
|
impl = :virtualbox
|
||||||
end
|
end
|
||||||
sf = Vagrant::Plugin::Remote::SyncedFolder.new(client: f[:plugin])
|
sf = Vagrant::Plugin::Remote::SyncedFolder.new(client: f[:plugin])
|
||||||
|
folder_opts = scoped_hash_override(f[:folder], impl)
|
||||||
# Set plugin, guestpath and hostpath from synced folder info
|
# Set plugin, guestpath and hostpath from synced folder info
|
||||||
new_folder = {f[:folder][:destination] => f[:folder].merge({
|
new_folder = {f[:folder][:destination] => folder_opts.merge({
|
||||||
plugin: sf,
|
plugin: sf,
|
||||||
guestpath: f[:folder][:destination],
|
guestpath: f[:folder][:destination],
|
||||||
hostpath: f[:folder][:source],
|
hostpath: f[:folder][:source],
|
||||||
|
|||||||
@ -715,9 +715,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|||||||
add_message "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse" do
|
add_message "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse" do
|
||||||
repeated :synced_folders, :message, 1, "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder"
|
repeated :synced_folders, :message, 1, "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder"
|
||||||
end
|
end
|
||||||
|
add_message "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.Folder" do
|
||||||
|
optional :source, :string, 1
|
||||||
|
optional :destination, :string, 2
|
||||||
|
optional :options, :message, 3, "hashicorp.vagrant.sdk.Args.Hash"
|
||||||
|
end
|
||||||
add_message "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder" do
|
add_message "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder" do
|
||||||
optional :plugin, :message, 1, "hashicorp.vagrant.sdk.Args.SyncedFolder"
|
optional :plugin, :message, 1, "hashicorp.vagrant.sdk.Args.SyncedFolder"
|
||||||
optional :folder, :message, 2, "hashicorp.vagrant.sdk.Vagrantfile.SyncedFolder"
|
optional :folder, :message, 2, "hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.Folder"
|
||||||
end
|
end
|
||||||
add_message "hashicorp.vagrant.sdk.Project" do
|
add_message "hashicorp.vagrant.sdk.Project" do
|
||||||
end
|
end
|
||||||
@ -1186,6 +1191,7 @@ module Hashicorp
|
|||||||
Target::Machine::GetStateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.GetStateResponse").msgclass
|
Target::Machine::GetStateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.GetStateResponse").msgclass
|
||||||
Target::Machine::UIDResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.UIDResponse").msgclass
|
Target::Machine::UIDResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.UIDResponse").msgclass
|
||||||
Target::Machine::SyncedFoldersResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse").msgclass
|
Target::Machine::SyncedFoldersResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse").msgclass
|
||||||
|
Target::Machine::SyncedFoldersResponse::Folder = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.Folder").msgclass
|
||||||
Target::Machine::SyncedFoldersResponse::MachineSyncedFolder = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder").msgclass
|
Target::Machine::SyncedFoldersResponse::MachineSyncedFolder = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Target.Machine.SyncedFoldersResponse.MachineSyncedFolder").msgclass
|
||||||
Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Project").msgclass
|
Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Project").msgclass
|
||||||
Project::ActiveTargetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Project.ActiveTargetsResponse").msgclass
|
Project::ActiveTargetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Project.ActiveTargetsResponse").msgclass
|
||||||
|
|||||||
@ -118,11 +118,9 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
|
|
||||||
def _cleaned_folder_hash(folder)
|
def _cleaned_folder_hash(folder)
|
||||||
folder_hash = folder.to_h
|
folder_hash = folder.options.to_ruby.transform_keys(&:to_sym)
|
||||||
folder_hash.delete_if do |k, v|
|
folder_hash[:source] = folder.source
|
||||||
hazzer = :"has_#{k}?"
|
folder_hash[:destination] = folder.destination
|
||||||
folder.respond_to?(hazzer) && !folder.send(hazzer)
|
|
||||||
end
|
|
||||||
folder_hash
|
folder_hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user