Skip to content

Commit

Permalink
resolve issue weaveworks#276
Browse files Browse the repository at this point in the history
  • Loading branch information
royadaneshi committed May 12, 2023
1 parent 5f5f18b commit 0deeb8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 0deeb8d

Please sign in to comment.