X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=main.go;h=668738c34cb58f79873b0207b0e746369a0c5d7f;hb=2f718c72a51850f3ab1af8d93a381b594fb2c825;hp=2d0c1799fbb41cff765698461dec2eb43a485998;hpb=63e37a1f02638525e6261a1aaecb51df3504639c;p=src%2Fxds%2Fxds-cli.git diff --git a/main.go b/main.go index 2d0c179..668738c 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,9 +28,10 @@ import ( "strings" "text/tabwriter" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent.git/lib/xaapiv1" + common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib" "github.com/Sirupsen/logrus" - "github.com/iotbzh/xds-agent/lib/xaapiv1" - common "github.com/iotbzh/xds-common/golib" + "github.com/joho/godotenv" socketio_client "github.com/sebd71/go-socket.io-client" "github.com/urfave/cli" @@ -57,7 +58,7 @@ var AppSubVersion = "unknown-dev" // Application details const ( - appCopyright = "Copyright (C) 2017 IoT.bzh - Apache-2.0" + appCopyright = "Copyright (C) 2017-2018 IoT.bzh - Apache-2.0" defaultLogLevel = "error" ) @@ -388,6 +389,9 @@ func XdsConnInit(ctx *cli.Context) error { if err := XdsConfigGet(&xdsConf); err != nil { return cli.NewExitError("ERROR while getting XDS config: "+err.Error(), 1) } + if len(xdsConf.Servers) < 1 { + return cli.NewExitError("No XDS Server connected", 1) + } svrCfg := xdsConf.Servers[XdsServerIndexGet()] if (serverURL != "" && svrCfg.URL != serverURL) || !svrCfg.Connected { Log.Infof("Update XDS Server config: serverURL=%v, svrCfg=%v", serverURL, svrCfg)