Skip to content

Commit

Permalink
Return clean on failure (#922)
Browse files Browse the repository at this point in the history
* don't check for watches if the clean command failed
* remove redundant condition

Signed-off-by: Ramiro Berrelleza <rberrelleza@gmail.com>
  • Loading branch information
rberrelleza committed Jun 16, 2020
1 parent 206bce7 commit bd2d1b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/up.go
Expand Up @@ -806,6 +806,8 @@ func (up *UpContext) cleanCommand() {

if err != nil {
log.Infof("failed to clean session: %s", err)
up.cleaned <- struct{}{}
return
}

if utils.IsWatchesConfigurationTooLow(out.String()) {
Expand All @@ -820,7 +822,7 @@ func (up *UpContext) runCommand() error {
log.Infof("starting remote command")
up.updateStateFile(ready)

if up.Dev.ExecuteOverSSHEnabled() || up.Dev.RemoteModeEnabled() {
if up.Dev.RemoteModeEnabled() {
return ssh.Exec(up.Context, up.Dev.RemotePort, true, os.Stdin, os.Stdout, os.Stderr, up.Dev.Command.Values)
}

Expand Down
7 changes: 6 additions & 1 deletion cmd/utils/watches.go
Expand Up @@ -47,9 +47,14 @@ func CheckLocalWatchesConfiguration() {
//IsWatchesConfigurationTooLow returns if watches configuration is too low
func IsWatchesConfigurationTooLow(value string) bool {
value = strings.TrimSuffix(string(value), "\n")
if value == "" {
log.Infof("max_user_watches is empty '%s'", value)
return false
}

c, err := strconv.Atoi(value)
if err != nil {
log.Infof("Fail to parse the value of max_user_watches: %s", err)
log.Infof("failed to parse the value of max_user_watches: %s", err)
return false
}
log.Debugf("max_user_watches = %d", c)
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/pods/pod.go
Expand Up @@ -225,7 +225,7 @@ func MonitorDevPod(ctx context.Context, dev *model.Dev, pod *apiv1.Pod, c *kuber
log.Errorf("type error getting pod: %s", event)
continue
}
log.Infof("pod %s updated", pod.Name)
log.Infof("dev pod %s updated to %s", pod.Name, pod.Status.Phase)
if pod.Status.Phase == apiv1.PodRunning {
return pod, nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/syncthing/syncthing.go
Expand Up @@ -295,6 +295,7 @@ func (s *Syncthing) WaitForPing(ctx context.Context, local bool) error {
for i := 0; ; i++ {
_, err := s.APICall(ctx, "rest/system/ping", "GET", 200, nil, local, nil, false)
if err == nil {
log.Debugf("syncthing local=%t responded to the ping", local)
return nil
}

Expand Down

0 comments on commit bd2d1b9

Please sign in to comment.