Get/set machine id
This commit is contained in:
parent
fc8fe0a106
commit
5ecb1cdc26
@ -13,10 +13,11 @@ func (m *Machine) Close() (err error) {
|
||||
}
|
||||
|
||||
func (m *Machine) ID() (id string, err error) {
|
||||
return "machine-id-value", nil
|
||||
return m.target.Uuid, nil
|
||||
}
|
||||
|
||||
func (m *Machine) SetID(value string) (err error) {
|
||||
m.target.Uuid = value
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ module VagrantPlugins
|
||||
def get_id
|
||||
req = Google::Protobuf::Empty.new
|
||||
result = @client.get_id(req).id
|
||||
@logger.debug("Got remote machine id: #{result}")
|
||||
if result.nil?
|
||||
raise "Failed to get machine ID. REF: #{ref.inspect} - ID WAS NIL"
|
||||
end
|
||||
@ -45,7 +46,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def set_id(new_id)
|
||||
req = SDK::Target::SetIDRequest.new(
|
||||
req = SDK::Target::Machine::SetIDRequest.new(
|
||||
id: new_id
|
||||
)
|
||||
@client.set_id(req)
|
||||
|
||||
@ -55,7 +55,7 @@ module VagrantPlugins
|
||||
|
||||
begin
|
||||
@logger.debug("Instantiating the driver for machine ID: #{@machine.id.inspect}")
|
||||
@driver = Driver::Meta.new(id)
|
||||
@driver = Driver::Meta.new(uuid=id)
|
||||
rescue Driver::Meta::VMNotFound
|
||||
# The virtual machine doesn't exist, so we probably have a stale
|
||||
# ID. Just clear the id out of the machine and reload it.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user