From 4021ae6af0b166342a17c2f140fc0b7cc338dea7 Mon Sep 17 00:00:00 2001 From: Abukar Mohamed Date: Fri, 12 Jul 2019 05:17:19 +0000 Subject: [PATCH] Update subscription data Change-Id: I99aff23367d95f79ca6e90ac743c9261df69aaa3 Signed-off-by: Abukar Mohamed --- cmd/appmgr/subscriptions.go | 9 +++++++-- cmd/appmgr/types.go | 2 +- container-tag.yaml | 2 +- helm_chart/appmgr/values.yaml | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/appmgr/subscriptions.go b/cmd/appmgr/subscriptions.go index 1db4c5a..40735a9 100755 --- a/cmd/appmgr/subscriptions.go +++ b/cmd/appmgr/subscriptions.go @@ -107,9 +107,13 @@ func (sd *SubscriptionDispatcher) notifyClients(xapps []Xapp, et EventType) { } func (sd *SubscriptionDispatcher) notify(xapps []Xapp, et EventType, s Subscription, seq int) error { - notif := []SubscriptionNotif{} - notif = append(notif, SubscriptionNotif{Id: s.req.Id, Version: seq, EventType: string(et), XappData: xapps}) + xappData, err := json.Marshal(xapps) + if err != nil { + Logger.Info("json.Marshal failed: %v", err) + return err + } + notif := SubscriptionNotif{Id: s.req.Id, Version: seq, EventType: string(et), XApps: string(xappData)} jsonData, err := json.Marshal(notif) if err != nil { Logger.Info("json.Marshal failed: %v", err) @@ -118,6 +122,7 @@ func (sd *SubscriptionDispatcher) notify(xapps []Xapp, et EventType, s Subscript // Execute the request with retry policy return sd.retry(s, func() error { + Logger.Info("Posting notification to targetUrl=%s: %v", s.req.TargetUrl, notif) resp, err := http.Post(s.req.TargetUrl, "application/json", bytes.NewBuffer(jsonData)) if err != nil { Logger.Info("Posting to subscription failed: %v", err) diff --git a/cmd/appmgr/types.go b/cmd/appmgr/types.go index 685d118..34e3b74 100755 --- a/cmd/appmgr/types.go +++ b/cmd/appmgr/types.go @@ -123,7 +123,7 @@ type SubscriptionNotif struct { Id string `json:"id"` Version int `json:"version"` EventType string `json:"eventType"` - XappData []Xapp `json:"xapp"` + XApps string `json:"xApps"` } type Subscription struct { diff --git a/container-tag.yaml b/container-tag.yaml index d7e5871..254173b 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,3 +1,3 @@ # The Jenkins job requires a tag to build a Docker image --- -tag: '0.1.4' +tag: '0.1.5' diff --git a/helm_chart/appmgr/values.yaml b/helm_chart/appmgr/values.yaml index 268081b..a1c8bec 100755 --- a/helm_chart/appmgr/values.yaml +++ b/helm_chart/appmgr/values.yaml @@ -31,7 +31,7 @@ image: # xAppmanager Docker image name and tag name: appmgr - tag: 0.1.4 + tag: 0.1.5 #nameOverride: "" #fullnameOverride: "" -- 2.16.6