From 025a8d8583eb9024c6f7be2e4cf64968ae10c12a Mon Sep 17 00:00:00 2001 From: Max Bohling <max.bohling@stud.h-da.de> Date: Wed, 26 May 2021 12:24:45 +0200 Subject: [PATCH] init returns status message --- cli/http.go | 7 +++---- http.go | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/http.go b/cli/http.go index b7c3254b6..5182a624c 100644 --- a/cli/http.go +++ b/cli/http.go @@ -38,8 +38,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error { if err != nil { return err } - switch f { - case "init": + //if this is in response to "init" query, we also set PND and SBI to ENV as initialized by the controller + if f == "init" { pnd := string(bytes[9:45]) sbi := string(bytes[55:91]) viper.Set("CLI_PND", pnd) @@ -48,9 +48,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error { if err != nil { log.Error(err) } - default: - fmt.Println(string(bytes)) } + fmt.Println(string(bytes)) case http.StatusCreated: defer resp.Body.Close() diff --git a/http.go b/http.go index 92ce1890a..5bbe4edef 100644 --- a/http.go +++ b/http.go @@ -185,6 +185,7 @@ func httpApi(writer http.ResponseWriter, request *http.Request) { case "init": writeIDs(writer, "PNDs", c.pndc.UUIDs()) writeIDs(writer, "SBIs", c.sbic.UUIDs()) + fmt.Fprintf(writer, "init completed, ready") case "update", "replace": if err := httpPnd.ChangeOND(id, apiOpmap[q], query.Get("path"), query.Get("value")); err != nil { handleServerError(writer, err) -- GitLab