Skip to content

Commit 5426017

Browse files
committed
fix(groups): return JSON when requesting specific group
This is opposed to returning YAML, which is inconsistent with the format of the data returned from other API endpoints. Instead of returning a YAML document like: description: "" data: foo: bar file: content: - 35 - 35 [...snip...] - 101 - 10 name: "" encoding: base64 a JSON document with a proper base64-encoded config is returned: { "file": { "content": "IyM[...snip...]ZQo=", "encoding": "base64", "filename": "" }, "meta-data": { "foo": "bar" }, "name": "tester" }
1 parent 7515add commit 5426017

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/cloud-init-server/group_handlers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/OpenCHAMI/cloud-init/pkg/cistore"
88
"github.com/go-chi/chi/v5"
9-
yaml "gopkg.in/yaml.v2"
109
)
1110

1211
// GetGroups godoc
@@ -107,7 +106,7 @@ func (h CiHandler) GetGroupHandler(w http.ResponseWriter, r *http.Request) {
107106
return
108107
}
109108

110-
bytes, err = yaml.Marshal(data)
109+
bytes, err = json.Marshal(data)
111110
if err != nil {
112111
http.Error(w, err.Error(), http.StatusInternalServerError)
113112
return

0 commit comments

Comments
 (0)