feat: translation support
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See #483
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
)
|
||||
|
||||
// Fatal is a error output wrapper which aims to make SSH failures easier to
|
||||
@ -11,17 +13,17 @@ func Fatal(hostname string, err error) error {
|
||||
out := err.Error()
|
||||
|
||||
if strings.Contains(out, "Host key verification failed.") {
|
||||
return fmt.Errorf("SSH host key verification failed for %s", hostname)
|
||||
return errors.New(i18n.G("SSH host key verification failed for %s", hostname))
|
||||
} else if strings.Contains(out, "Could not resolve hostname") {
|
||||
return fmt.Errorf("could not resolve hostname for %s", hostname)
|
||||
return errors.New(i18n.G("could not resolve hostname for %s", hostname))
|
||||
} else if strings.Contains(out, "Connection timed out") {
|
||||
return fmt.Errorf("connection timed out for %s", hostname)
|
||||
return errors.New(i18n.G("connection timed out for %s", hostname))
|
||||
} else if strings.Contains(out, "Permission denied") {
|
||||
return fmt.Errorf("ssh auth: permission denied for %s", hostname)
|
||||
return errors.New(i18n.G("ssh auth: permission denied for %s", hostname))
|
||||
} else if strings.Contains(out, "Network is unreachable") {
|
||||
return fmt.Errorf("unable to connect to %s, please check your SSH config", hostname)
|
||||
return errors.New(i18n.G("unable to connect to %s, please check your SSH config", hostname))
|
||||
} else if strings.Contains(out, "Is the docker daemon running") {
|
||||
return fmt.Errorf("docker: is the daemon running / your user has docker permissions?")
|
||||
return errors.New(i18n.G("docker: is the daemon running / your user has docker permissions?"))
|
||||
}
|
||||
|
||||
return err
|
||||
|
Reference in New Issue
Block a user