From 3bd83bb007559153a48bf8fa17a51d0c9ec75642 Mon Sep 17 00:00:00 2001 From: ashish Date: Fri, 21 Jan 2022 15:36:34 +0530 Subject: [PATCH] minor change Signed-off-by: ashish --- osm/oam/register.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osm/oam/register.go b/osm/oam/register.go index 1798f03a..7d2c2b10 100644 --- a/osm/oam/register.go +++ b/osm/oam/register.go @@ -19,6 +19,7 @@ var ( // AvailableVersions denote the component versions available statically var AvailableVersions = map[string]bool{} +var pathSets []schemaDefinitionPathSet type schemaDefinitionPathSet struct { oamDefinitionPath string @@ -33,11 +34,6 @@ type schemaDefinitionPathSet struct { func RegisterWorkloads(runtime, host string) error { oamRDP := []adapter.OAMRegistrantDefinitionPath{} - pathSets, err := load(WorkloadPath) - if err != nil { - return err - } - for _, pathSet := range pathSets { metadata := map[string]string{ config.OAMAdapterNameMetadataKey: config.OSMOperation, @@ -122,3 +118,11 @@ func load(basePath string) ([]schemaDefinitionPathSet, error) { return res, nil } + +func init() { + var err error + pathSets, err = load(WorkloadPath) + if err != nil { + fmt.Println("Err loading components: ", err.Error()) + } +}