Skip to content

Commit 6171bec

Browse files
claudioloradamjensenbot
authored andcommitted
fix: improve liqoctl version error message
This patch improves the returned error message when it is not possible to retrieve the version of the Liqo server, by changing the error type from ERROR to WARNING, as an error is expected when there is no remote cluster with Liqo installed. Moreover, it clarifies that the error is related to the version of the Liqo instance running in the cluster and provides a set reasons why an error is produced.
1 parent ceca09c commit 6171bec

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/liqoctl/version/handler.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ func (o *Options) Run(ctx context.Context) error {
4141
return nil
4242
}
4343

44-
version, err := liqogetters.GetLiqoVersion(ctx, o.CRClient, o.LiqoNamespace)
44+
serverVersion, err := liqogetters.GetLiqoVersion(ctx, o.CRClient, o.LiqoNamespace)
4545
if err != nil {
46-
o.Printer.Error.Printfln("Failed to retrieve Liqo version: %v", output.PrettyErr(err))
46+
fmt.Println("Server version: Unknown")
47+
o.Printer.Warning.Printfln("Failed to retrieve Liqo server version: %v", output.PrettyErr(err))
48+
o.Printer.Warning.Println(
49+
"Is Liqo installed in your cluster? Is the cluster reachable? Do you have the permissions to access the target cluster?")
4750
return err
4851
}
4952

50-
fmt.Printf("Server version: %s\n", version)
53+
fmt.Printf("Server version: %s\n", serverVersion)
54+
55+
if serverVersion != LiqoctlVersion {
56+
o.Printer.Warning.Println("The version of liqoctl does not match the Liqo server version. This might cause unexpected behaviors.")
57+
}
5158

5259
return nil
5360
}

0 commit comments

Comments
 (0)