Skip to content

Commit d2034e4

Browse files
authored
Merge pull request #55 from opengovern/feat-make-task
fix: fix get labels and annotations
2 parents ad04e60 + 825d9c0 commit d2034e4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

discovery/pkg/task/run-task.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,21 @@ func GetIntegrationsFromQuery(coreServiceClient coreClient.CoreServiceClient, pa
252252
integ.Secret = rc.(string)
253253
case "annotations":
254254
if rc != nil {
255-
if jsonStr, ok := rc.(string); ok {
256-
var ann map[string]string
257-
if err := json.Unmarshal([]byte(jsonStr), &ann); err == nil {
258-
integ.Annotations = ann
255+
if obj, ok := rc.(map[string]interface{}); ok {
256+
for k, v := range obj {
257+
if vStr, ok := v.(string); ok {
258+
integ.Annotations[k] = vStr
259+
}
259260
}
260261
}
261262
}
262263
case "labels":
263264
if rc != nil {
264-
if jsonStr, ok := rc.(string); ok {
265-
var lbl map[string]string
266-
if err := json.Unmarshal([]byte(jsonStr), &lbl); err == nil {
267-
integ.Labels = lbl
265+
if obj, ok := rc.(map[string]interface{}); ok {
266+
for k, v := range obj {
267+
if vStr, ok := v.(string); ok {
268+
integ.Labels[k] = vStr
269+
}
268270
}
269271
}
270272
}

0 commit comments

Comments
 (0)