diff --git a/cli/http.go b/cli/http.go index b7c3254b655bda3c315dd79039deb5f730fc023f..5182a624cd409b8d1636c1198fe4df3d6c7fa360 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 92ce1890a2a0d5585d0093f6614fa727d919184c..5bbe4edefbd525de56ed6d7babeff5fcb60c803c 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)