Do not retry on permission denied in ssh

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-11-21 14:08:24 +01:00 committed by Kristoffer Dalby
parent f34e7c341b
commit 8a79c2e7ed

View file

@ -28,6 +28,13 @@ var retry = func(times int, sleepInterval time.Duration,
if err == nil {
return result, stderr, nil
}
// If we get a permission denied error, we can fail immediately
// since that is something we wont recover from by retrying.
if err != nil && strings.Contains(stderr, "Permission denied (tailscale)") {
return result, stderr, err
}
time.Sleep(sleepInterval)
}