Skip to content

Commit

Permalink
[supervisor] use hard code HOME dir
Browse files Browse the repository at this point in the history
  • Loading branch information
iQQBot authored and roboquat committed Aug 30, 2022
1 parent e605e81 commit 1a65e69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions components/supervisor/pkg/supervisor/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,7 @@ func (is *InfoService) WorkspaceInfo(context.Context, *api.WorkspaceInfoRequest)
}
}

resp.UserHome, err = os.UserHomeDir()
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
resp.UserHome = "/home/gitpod"

endpoint, host, err := is.cfg.GitpodAPIEndpoint()
if err != nil {
Expand Down Expand Up @@ -715,7 +712,7 @@ func (c *ControlService) ExposePort(ctx context.Context, req *api.ExposePortRequ

// CreateSSHKeyPair create a ssh key pair for the workspace.
func (ss *ControlService) CreateSSHKeyPair(context.Context, *api.CreateSSHKeyPairRequest) (response *api.CreateSSHKeyPairResponse, err error) {
home, _ := os.UserHomeDir()
home := "/home/gitpod/"
if ss.privateKey != "" && ss.publicKey != "" {
checkKey := func() error {
data, err := os.ReadFile(filepath.Join(home, ".ssh/authorized_keys"))
Expand Down
7 changes: 2 additions & 5 deletions components/supervisor/pkg/supervisor/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,10 @@ func prepareSSHKey(ctx context.Context, sshkey string) error {
}

func writeSSHEnv(cfg *Config, envvars []string) error {
home, err := os.UserHomeDir()
if err != nil {
return err
}
home := "/home/gitpod"

d := filepath.Join(home, ".ssh")
err = os.MkdirAll(d, 0o700)
err := os.MkdirAll(d, 0o700)
if err != nil {
return xerrors.Errorf("cannot create $HOME/.ssh: %w", err)
}
Expand Down

0 comments on commit 1a65e69

Please sign in to comment.