Skip to content
Snippets Groups Projects
Commit 025a8d85 authored by Max Bohling's avatar Max Bohling
Browse files

init returns status message

parent a94be2bb
No related merge requests found
Pipeline #71960 passed
...@@ -38,8 +38,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error { ...@@ -38,8 +38,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error {
if err != nil { if err != nil {
return err return err
} }
switch f { //if this is in response to "init" query, we also set PND and SBI to ENV as initialized by the controller
case "init": if f == "init" {
pnd := string(bytes[9:45]) pnd := string(bytes[9:45])
sbi := string(bytes[55:91]) sbi := string(bytes[55:91])
viper.Set("CLI_PND", pnd) viper.Set("CLI_PND", pnd)
...@@ -48,9 +48,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error { ...@@ -48,9 +48,8 @@ func HTTPGet(apiEndpoint, f string, args ...string) error {
if err != nil { if err != nil {
log.Error(err) log.Error(err)
} }
default:
fmt.Println(string(bytes))
} }
fmt.Println(string(bytes))
case http.StatusCreated: case http.StatusCreated:
defer resp.Body.Close() defer resp.Body.Close()
......
...@@ -185,6 +185,7 @@ func httpApi(writer http.ResponseWriter, request *http.Request) { ...@@ -185,6 +185,7 @@ func httpApi(writer http.ResponseWriter, request *http.Request) {
case "init": case "init":
writeIDs(writer, "PNDs", c.pndc.UUIDs()) writeIDs(writer, "PNDs", c.pndc.UUIDs())
writeIDs(writer, "SBIs", c.sbic.UUIDs()) writeIDs(writer, "SBIs", c.sbic.UUIDs())
fmt.Fprintf(writer, "init completed, ready")
case "update", "replace": case "update", "replace":
if err := httpPnd.ChangeOND(id, apiOpmap[q], query.Get("path"), query.Get("value")); err != nil { if err := httpPnd.ChangeOND(id, apiOpmap[q], query.Get("path"), query.Get("value")); err != nil {
handleServerError(writer, err) handleServerError(writer, err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment