diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-08 11:45:25 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-08 11:45:25 +0200 |
| commit | a48e1ead6170b63721ef12801ca6e6f5dee6aa09 (patch) | |
| tree | f240213968ee1b4252b704cc7ec90530161b00e3 /vm/gce | |
| parent | a28999b4c6b1b8cac00c91231b6c72137ffea9fd (diff) | |
vm/gce: work around GCE console bug
Sometimes connects to serial console spuriously fail with:
Permission denied (publickey)
Diffstat (limited to 'vm/gce')
| -rw-r--r-- | vm/gce/gce.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go index e9d1daa90..084189522 100644 --- a/vm/gce/gce.go +++ b/vm/gce/gce.go @@ -237,25 +237,31 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin { var output []byte timeout := time.NewTimer(time.Minute) + connectedMsg := []byte("serialport: Connected") + permissionDeniedMsg := []byte("Permission denied (publickey)") loop: for { select { case out := <-merger.Output: output = append(output, out...) - if bytes.Contains(output, []byte("serialport")) { + if bytes.Contains(output, connectedMsg) { // Just to make sure (otherwise we still see trimmed reports). time.Sleep(5 * time.Second) break loop } + if bytes.Contains(output, permissionDeniedMsg) { + // This is a GCE bug. + break + } case <-timeout.C: break loop } } timeout.Stop() - if len(output) == 0 { + if len(output) == 0 || bytes.Contains(output, permissionDeniedMsg) { con.Process.Kill() merger.Wait() - return nil, nil, fmt.Errorf("no output from console") + return nil, nil, fmt.Errorf("no output from console or permission denied") } } |
