diff --git a/internal/server/proto/ruby_vagrant/ruby-server.proto b/internal/server/proto/ruby_vagrant/ruby-server.proto index a97cbf68b..62ca8b068 100644 --- a/internal/server/proto/ruby_vagrant/ruby-server.proto +++ b/internal/server/proto/ruby_vagrant/ruby-server.proto @@ -55,36 +55,38 @@ message ParseVagrantfileRequest { message ParseVagrantfileResponse { // Vagrantfile representation - Vagrantfile vagrantfile = 1; + VagrantfileComponents.Vagrantfile vagrantfile = 1; } -// TODO: Review what needs to be sent here -message Provisioner { - string name = 1; - google.protobuf.Any config = 2; -} +message VagrantfileComponents { + // TODO: Review what needs to be sent here + message Provisioner { + string name = 1; + google.protobuf.Any config = 2; + } -// TODO: Review what needs to be sent here -message MachineConfig { - string name = 1; - string box = 2; - repeated Provisioner provisioners = 3; -} + // TODO: Review what needs to be sent here + message MachineConfig { + string name = 1; + string box = 2; + repeated Provisioner provisioners = 3; + } -// TODO: Review what needs to be sent here -message Communicator { - string name = 1; - // This is the config that belongs to the communicator. - // Should be a message type from the core plugin or defined - // by a plugin author - google.protobuf.Any config = 2; -} + // TODO: Review what needs to be sent here + message Communicator { + string name = 1; + // This is the config that belongs to the communicator. + // Should be a message type from the core plugin or defined + // by a plugin author + google.protobuf.Any config = 2; + } -// TODO: Review what needs to be sent here -message Vagrantfile { - string path = 1; - string raw = 2; - string current_version = 3; - repeated MachineConfig machine_configs = 4; - repeated Communicator communicators = 5; + // TODO: Review what needs to be sent here + message Vagrantfile { + string path = 1; + string raw = 2; + string current_version = 3; + repeated MachineConfig machine_configs = 4; + repeated Communicator communicators = 5; + } } diff --git a/internal/server/proto/vagrant_server/server.proto b/internal/server/proto/vagrant_server/server.proto index 804383bf5..7738ed8fd 100644 --- a/internal/server/proto/vagrant_server/server.proto +++ b/internal/server/proto/vagrant_server/server.proto @@ -328,6 +328,17 @@ message Target { Job.DataSource data_source = 101; } +message Vagrantfile { + // Unique resource identifier (internal use) + string resource_id = 1; + + // TODO: not sure about this path + // Path where this Vagarant lives + string path = 2; + + // TODO: Determine Vagrantfile representation in DB +} + /******************************************************************** * Shared Messages ********************************************************************/ diff --git a/internal/serverclient/ruby_client.go b/internal/serverclient/ruby_client.go index bd02c20ba..03f0acf97 100644 --- a/internal/serverclient/ruby_client.go +++ b/internal/serverclient/ruby_client.go @@ -15,7 +15,7 @@ import ( type RubyVagrant interface { GetPlugins() ([]*ruby_vagrant.Plugin, error) - ParseVagrantfile(string) (*ruby_vagrant.Vagrantfile, error) + ParseVagrantfile(string) (*ruby_vagrant.VagrantfileComponents_Vagrantfile, error) } // This is the implementation of plugin.GRPCPlugin so we can serve/consume this. @@ -65,7 +65,7 @@ func (r *RubyVagrantClient) GetPlugins() ([]*ruby_vagrant.Plugin, error) { } // TODO: This should return an hcl Vagrantfile representation -func (r *RubyVagrantClient) ParseVagrantfile(path string) (*ruby_vagrant.Vagrantfile, error) { +func (r *RubyVagrantClient) ParseVagrantfile(path string) (*ruby_vagrant.VagrantfileComponents_Vagrantfile, error) { vf, err := r.client.ParseVagrantfile( context.Background(), &ruby_vagrant.ParseVagrantfileRequest{Path: path}, diff --git a/lib/vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb.rb b/lib/vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb.rb index 580524445..682964c59 100644 --- a/lib/vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb.rb +++ b/lib/vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb.rb @@ -27,27 +27,29 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :path, :string, 1 end add_message "hashicorp.vagrant.ParseVagrantfileResponse" do - optional :vagrantfile, :message, 1, "hashicorp.vagrant.Vagrantfile" + optional :vagrantfile, :message, 1, "hashicorp.vagrant.VagrantfileComponents.Vagrantfile" end - add_message "hashicorp.vagrant.Provisioner" do + add_message "hashicorp.vagrant.VagrantfileComponents" do + end + add_message "hashicorp.vagrant.VagrantfileComponents.Provisioner" do optional :name, :string, 1 optional :config, :message, 2, "google.protobuf.Any" end - add_message "hashicorp.vagrant.MachineConfig" do + add_message "hashicorp.vagrant.VagrantfileComponents.MachineConfig" do optional :name, :string, 1 optional :box, :string, 2 - repeated :provisioners, :message, 3, "hashicorp.vagrant.Provisioner" + repeated :provisioners, :message, 3, "hashicorp.vagrant.VagrantfileComponents.Provisioner" end - add_message "hashicorp.vagrant.Communicator" do + add_message "hashicorp.vagrant.VagrantfileComponents.Communicator" do optional :name, :string, 1 optional :config, :message, 2, "google.protobuf.Any" end - add_message "hashicorp.vagrant.Vagrantfile" do + add_message "hashicorp.vagrant.VagrantfileComponents.Vagrantfile" do optional :path, :string, 1 optional :raw, :string, 2 optional :current_version, :string, 3 - repeated :machine_configs, :message, 4, "hashicorp.vagrant.MachineConfig" - repeated :communicators, :message, 5, "hashicorp.vagrant.Communicator" + repeated :machine_configs, :message, 4, "hashicorp.vagrant.VagrantfileComponents.MachineConfig" + repeated :communicators, :message, 5, "hashicorp.vagrant.VagrantfileComponents.Communicator" end end end @@ -59,9 +61,10 @@ module Hashicorp Plugin::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Plugin.Type").enummodule ParseVagrantfileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.ParseVagrantfileRequest").msgclass ParseVagrantfileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.ParseVagrantfileResponse").msgclass - Provisioner = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Provisioner").msgclass - MachineConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.MachineConfig").msgclass - Communicator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Communicator").msgclass - Vagrantfile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Vagrantfile").msgclass + VagrantfileComponents = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.VagrantfileComponents").msgclass + VagrantfileComponents::Provisioner = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.VagrantfileComponents.Provisioner").msgclass + VagrantfileComponents::MachineConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.VagrantfileComponents.MachineConfig").msgclass + VagrantfileComponents::Communicator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.VagrantfileComponents.Communicator").msgclass + VagrantfileComponents::Vagrantfile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.VagrantfileComponents.Vagrantfile").msgclass end end diff --git a/lib/vagrant/protobufs/proto/vagrant_server/server_pb.rb b/lib/vagrant/protobufs/proto/vagrant_server/server_pb.rb index 0847ec222..0d5bcc9ad 100644 --- a/lib/vagrant/protobufs/proto/vagrant_server/server_pb.rb +++ b/lib/vagrant/protobufs/proto/vagrant_server/server_pb.rb @@ -55,6 +55,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :data_source, :message, 52, "hashicorp.vagrant.Job.DataSource" optional :provider, :string, 53 end + add_message "hashicorp.vagrant.Vagrantfile" do + optional :resource_id, :string, 1 + optional :path, :string, 2 + end add_message "hashicorp.vagrant.Ref" do end add_message "hashicorp.vagrant.Ref.Machine" do @@ -851,6 +855,7 @@ module Hashicorp Basis = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Basis").msgclass Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Project").msgclass Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Machine").msgclass + Vagrantfile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Vagrantfile").msgclass Ref = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Ref").msgclass Ref::Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Ref.Machine").msgclass Ref::Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.Ref.Project").msgclass