Plug machine#uid methods into remote go backend
This commit is contained in:
parent
5ab49f33bc
commit
b4fbf76a33
@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/user"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
@ -38,6 +39,15 @@ func (m *Machine) ID() (id string, err error) {
|
||||
// SetID implements core.Machine
|
||||
func (m *Machine) SetID(value string) (err error) {
|
||||
m.machine.Id = value
|
||||
|
||||
// Also set uid
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.machine.Uid = user.Uid
|
||||
|
||||
// Persist changes
|
||||
if value == "" {
|
||||
m.target.Record = nil
|
||||
err = m.Destroy()
|
||||
|
||||
@ -237,10 +237,7 @@ module Vagrant
|
||||
end
|
||||
|
||||
def uid
|
||||
path = uid_file
|
||||
return nil if !path
|
||||
return nil if !path.file?
|
||||
return uid_file.read.chomp
|
||||
client.uid
|
||||
end
|
||||
|
||||
def with_ui(ui)
|
||||
@ -255,11 +252,6 @@ module Vagrant
|
||||
end
|
||||
end
|
||||
|
||||
def uid_file
|
||||
return nil if !@data_dir
|
||||
@data_dir.join("creator_uid")
|
||||
end
|
||||
|
||||
def check_cwd
|
||||
desired_encoding = @env.root_path.to_s.encoding
|
||||
vagrant_cwd_filepath = @data_dir.join('vagrant_cwd')
|
||||
|
||||
@ -118,7 +118,9 @@ module VagrantPlugins
|
||||
|
||||
# @return [Integer] user ID that owns machine
|
||||
def uid
|
||||
client.uid(Empty.new).user_id
|
||||
user_id = client.uid(Empty.new).user_id
|
||||
return nil if user_id == ""
|
||||
return user_id
|
||||
end
|
||||
|
||||
def _cleaned_folder_hash(folder)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user