+ ctx.App.Metadata["ioskCli"] = IOSkClient
+
+ // Display version in logs (debug helpers)
+ ver := xaapiv1.XDSVersion{}
+ if err := XdsVersionGet(&ver); err != nil {
+ return cli.NewExitError("ERROR while retrieving XDS version: "+err.Error(), 1)
+ }
+ Log.Infof("XDS Agent/Server version: %v", ver)
+
+ // Get current config and update connection to server when needed
+ xdsConf := xaapiv1.APIConfig{}
+ 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)
+ if serverURL != "" {
+ svrCfg.URL = serverURL
+ }
+ svrCfg.ConnRetry = 10
+ if err := XdsConfigSet(xdsConf); err != nil {
+ return cli.NewExitError("ERROR while updating XDS server URL: "+err.Error(), 1)
+ }
+ }