fix #507 #509

Closed
Apfelwurm wants to merge 1 commits from Apfelwurm/abra:own/fix_addserver into main
3 changed files with 9 additions and 3 deletions

View File

@ -103,8 +103,7 @@ developer machine. The domain is then set to "default".`,
if _, err := client.New(name, timeout); err != nil {
cleanUp(name)
log.Debugf("ssh %s error: %s", name, sshPkg.Fatal(name, err))
log.Fatalf("can't ssh to %s, make sure \"ssh %s\" works", name, name)
log.Fatalf("%s error: %s", name, sshPkg.Fatal(name, err))
}
if created {

View File

@ -89,7 +89,7 @@ func New(serverName string, opts ...Opt) (*client.Client, error) {
info, err := cl.Info(context.Background())
if err != nil {
return cl, sshPkg.Fatal(serverName, err)
decentral1se marked this conversation as resolved
Review

Is sshPkg.Fatal used anywhere else and/or should it be removed?

Is `sshPkg.Fatal` used anywhere else and/or should it be removed?
Review
It is still also in use in https://git.coopcloud.tech/toolshed/abra/src/branch/main/cli/server/add.go#L106 :)
return cl, fmt.Errorf("%s, make sure \"ssh %s\" works", sshPkg.Fatal(serverName, err), serverName)
}
if info.Swarm.LocalNodeState == "inactive" {

View File

@ -51,6 +51,13 @@ teardown(){
assert_output --partial 'swarm mode not enabled on local server'
}
@test "create notexisting server fails with could not resolve hostname" {
run $ABRA server add notexisting
assert_failure
assert_not_exists "$ABRA_DIR/servers/default"
assert_output --partial 'could not resolve hostname for'
}
# bats test_tags=slow
@test "cleanup when cannot add server" {
run $ABRA server add example.com