From 82e3dd55adb3b56be9bc03d05503d00cd5fe036d Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 7 Jan 2021 11:33:14 -0600 Subject: [PATCH] Setup machine client --- lib/vagrant/machine.rb | 30 +++++++++++++++++++ .../serve/service/provider_service.rb | 6 ++++ 2 files changed, 36 insertions(+) diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 921774fd1..f18ae318a 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -7,6 +7,36 @@ require "thread" require "log4r" module Vagrant + # This is the client that does CRUD operations against + # the core Vagrant service + class MachineClient + + attr_accessor :broker + + def initialize(client_connection, broker) + # TODO instantiate a new machine client + @client = nil # todo + @broker = broker + end + + # Get a machine by id + # + # @param [String] machine id + # @return [Machine] + def get_machine(id) + + end + + # Update/insert a machine + # + # @param [Machine] machine to upsert + # @return [Machine] the final state of the machine + def upsert_machine(machine) + + end + + end + # This represents a machine that Vagrant manages. This provides a singular # API for querying the state and making state changes to the machine, which # is backed by any sort of provider (VirtualBox, VMware, etc.). diff --git a/plugins/commands/serve/service/provider_service.rb b/plugins/commands/serve/service/provider_service.rb index e5515a626..3af46c439 100644 --- a/plugins/commands/serve/service/provider_service.rb +++ b/plugins/commands/serve/service/provider_service.rb @@ -35,10 +35,16 @@ module VagrantPlugins def action_up(req, _unused_call) LOG.debug("action up") + # TODO: deserialize request + # [>] LOG.debug(req) nil end + def machine_arg_to_machine(req) + + end + def action_up_spec(req, _unused_call) LOG.debug("action up spec") args = [