Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

resolve issue #276 #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/cluster/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type Machine struct {
// container ip.
ip string

// container user, defaults to "root".
user string `default:"root"` //for solveing issue #276

runtimeNetworks []*RuntimeNetwork
// Fields that are cached from the docker daemon.

Expand All @@ -47,6 +50,11 @@ func (m *Machine) ContainerName() string {
return m.name
}

// Hostname is the machine hostname.
func (m *Machine) MachineUser() string { //for solveing issue #276
return m.user
}

// Hostname is the machine hostname.
func (m *Machine) Hostname() string {
return m.hostname
Expand Down
1 change: 1 addition & 0 deletions ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func ssh(cmd *cobra.Command, args []string) error {
node = args[0]
user, err := user.Current()
if err != nil {
user = cluster.machine.MachineUser()//for solveing issue #276
return errors.New("error in getting current user")
}
username = user.Username
Expand Down