From b0f28cfbc2fe27c0a64d6ebe0f2ba4ca112d446f Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Wed, 13 Jul 2022 01:21:46 +0530 Subject: [PATCH 1/2] Fix breaking sample apps Signed-off-by: Ashish Tiwari --- consul/install.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/consul/install.go b/consul/install.go index b39ebe4..8a29cc0 100644 --- a/consul/install.go +++ b/consul/install.go @@ -16,8 +16,6 @@ package consul import ( "fmt" - "io/ioutil" - "path" "sync" "github.com/layer5io/meshery-adapter-library/adapter" @@ -96,14 +94,7 @@ func (h *Consul) applyManifests(request adapter.OperationRequest, operation adap } } else { for _, template := range operation.Templates { - p := path.Join("consul", "config_templates", string(template)) - tpl, err := ioutil.ReadFile(p) - if err != nil { - errMx.Lock() - errs = append(errs, err) - errMx.Unlock() - continue - } + tpl := []byte(template) merged, err := utils.MergeToTemplate(tpl, map[string]string{"namespace": request.Namespace}) if err != nil { errMx.Lock() From e4f03d9abfa02cb64c64ae14af5c4b34318ca3fa Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Wed, 13 Jul 2022 01:50:14 +0530 Subject: [PATCH 2/2] Fix breaking sample apps Signed-off-by: Ashish Tiwari --- build/config.go | 1 - consul/install.go | 2 +- consul/operations.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/build/config.go b/build/config.go index 912d046..f0816b3 100644 --- a/build/config.go +++ b/build/config.go @@ -59,7 +59,6 @@ func init() { if len(allVersions) == 0 { return } - fmt.Println("here0") for i, v := range allVersions { if i == len(allVersions)-1 { //only get AppVersion of latest chart version //Executing the below function for all versions is redundant and takes time on startup, we only want to know the latest app version of latest version. diff --git a/consul/install.go b/consul/install.go index 8a29cc0..ca37ba9 100644 --- a/consul/install.go +++ b/consul/install.go @@ -94,7 +94,7 @@ func (h *Consul) applyManifests(request adapter.OperationRequest, operation adap } } else { for _, template := range operation.Templates { - tpl := []byte(template) + tpl := []byte(template.String()) merged, err := utils.MergeToTemplate(tpl, map[string]string{"namespace": request.Namespace}) if err != nil { errMx.Lock() diff --git a/consul/operations.go b/consul/operations.go index 79c89d5..cad55be 100644 --- a/consul/operations.go +++ b/consul/operations.go @@ -74,7 +74,6 @@ func (h *Consul) ApplyOperation(ctx context.Context, request adapter.OperationRe config.HTTPBinOperation, config.ImageHubOperation, config.BookInfoOperation: - status, err := h.applyManifests(request, *operation, kubeconfigs) if err != nil { e.Summary = fmt.Sprintf("Error while %s %s", status, opDesc)