Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic if daemon command is invalid #788

Merged
merged 4 commits into from
Aug 17, 2022

Conversation

kemingy
Copy link
Member

@kemingy kemingy commented Aug 17, 2022

Signed-off-by: Keming kemingyang@tensorchord.ai

The warning may not be noticed by users.

Let it panic so users know something wrong in the envd file.

Signed-off-by: Keming <kemingyang@tensorchord.ai>
@zwpaper
Copy link
Member

zwpaper commented Aug 17, 2022

we now used 3 error libs in envd, should we stick to one?

  • github.com/pkg/errors
  • github.com/cockroachdb/errors
  • fmt.Errorf

@gaocegege
Copy link
Member

We should use github.com/cockroachdb/errors

@gaocegege
Copy link
Member

Ref #27

gaocegege
gaocegege previously approved these changes Aug 17, 2022
Co-authored-by: Ce Gao <ce.gao@outlook.com>
Signed-off-by: Keming <kemingy94@gmail.com>
@gaocegege
Copy link
Member

Signed-off-by: Keming <kemingyang@tensorchord.ai>
Signed-off-by: Keming <kemingyang@tensorchord.ai>
@kemingy
Copy link
Member Author

kemingy commented Aug 17, 2022

There are still 28 fmt.Errorf in the codebase, will fix them in another PR.

rrg 'fmt.Errorf' -F -w -t go
pkg/remote/sshd/os.go:26:       errNoShell = fmt.Errorf("failed to find any shell in the PATH")
pkg/ssh/ssh.go:216:             return fmt.Errorf("request for pseudo terminal failed: %w", err)
pkg/ssh/ssh.go:221:             return fmt.Errorf("unable to setup stdin for session: %w", err)
pkg/ssh/ssh.go:227:             return fmt.Errorf("unable to setup stdout for session: %w", err)
pkg/ssh/ssh.go:238:             return fmt.Errorf("unable to setup stderr for session: %w", err)
pkg/ssh/ssh.go:289:                     return nil, fmt.Errorf("decrypting PEM block failed %w", err)
pkg/ssh/ssh.go:301:                     return nil, fmt.Errorf("creating signer from encrypted key failed %w", err)
pkg/ssh/ssh.go:309:                     return nil, fmt.Errorf("parsing plain private key failed %w", err)
pkg/ssh/ssh.go:321:                     return nil, fmt.Errorf("Parsing PKCS private key failed %w", err)
pkg/ssh/ssh.go:328:                     return nil, fmt.Errorf("Parsing EC private key failed %w", err)
pkg/ssh/ssh.go:335:                     return nil, fmt.Errorf("Parsing DSA private key failed %w", err)
pkg/ssh/ssh.go:340:             return nil, fmt.Errorf("Parsing private key failed, unsupported key type %q", block.Type)
pkg/docker/docker.go:111:               return "", fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings, please rename it", s)
pkg/metrics/collector.go:30:    ErrUnknownCollector := fmt.Errorf("unknown collector: %s", name)
pkg/metrics/collector.go:31:    ErrUnknownHandle := fmt.Errorf("unknown handler: %s", name)
pkg/util/ziputil/unzip.go:105:                  return filenames, fmt.Errorf("%s: illegal file path", fpath)
pkg/lang/ir/util.go:46:                 return "", nil, fmt.Errorf("language %s is not supported", language)
pkg/ssh/config/ssh_config.go:239:                       return fmt.Errorf("failed to get info on %s: %w", p, err)
pkg/ssh/config/ssh_config.go:251:               return fmt.Errorf("failed to create temporary config file: %w", err)
pkg/ssh/config/ssh_config.go:265:               return fmt.Errorf("failed to set permissions to %s: %w", temp.Name(), err)
pkg/ssh/config/ssh_config.go:269:               return fmt.Errorf("new config is not valid: %w", err)
pkg/ssh/config/ssh_config.go:273:               return fmt.Errorf("failed to move %s to %s: %w", temp.Name(), p, err)
pkg/ssh/config/ssh_config.go:462:               return 0, fmt.Errorf("development container not found")
pkg/ssh/config/ssh_config.go:467:               return 0, fmt.Errorf("port not found")
pkg/ssh/config/ssh_config.go:472:               return 0, fmt.Errorf("invalid port: %s", param.value())
pkg/ssh/config/ssh_config.go:526:               return nil, fmt.Errorf("can't open %s: %w", path, err)
pkg/ssh/config/ssh_config.go:533:               return nil, fmt.Errorf("fail to decode %s: %w", path, err)
pkg/ssh/config/ssh_config.go:541:               return fmt.Errorf("fail to update SSH config file %s: %w", path, err)

@zwpaper zwpaper self-requested a review August 17, 2022 10:21
@zwpaper zwpaper requested a review from gaocegege August 17, 2022 10:22
@kemingy kemingy merged commit 7d293d7 into tensorchord:main Aug 17, 2022
@kemingy kemingy deleted the fix_daemon_parse_err branch August 17, 2022 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants