@@ -19,9 +19,11 @@ import (
1919 "github.com/eclipse-symphony/symphony/coa/pkg/apis/v1alpha2/contexts"
2020 "github.com/eclipse-symphony/symphony/coa/pkg/apis/v1alpha2/providers"
2121 coa_utils "github.com/eclipse-symphony/symphony/coa/pkg/apis/v1alpha2/utils"
22+ "github.com/eclipse-symphony/symphony/coa/pkg/logger"
2223)
2324
2425var msLock sync.Mutex
26+ var clog = logger .NewLogger ("coa.runtime" )
2527
2628type CatalogConfigProviderConfig struct {
2729 User string `json:"user"`
@@ -106,6 +108,7 @@ func (m *CatalogConfigProvider) unwindOverrides(override string, field string, n
106108 return "" , v1alpha2 .NewCOAError (nil , fmt .Sprintf ("field '%s' is not found in configuration '%s'" , field , override ), v1alpha2 .NotFound )
107109}
108110func (m * CatalogConfigProvider ) Read (object string , field string , localcontext interface {}) (interface {}, error ) {
111+ clog .Debug (" M (Catalog): Read, object: %s, field: %s" , object , field )
109112 namespace := m .getNamespaceFromContext (localcontext )
110113 object = api_utils .ReplaceSeperator (object )
111114 catalog , err := m .ApiClient .GetCatalog (context .TODO (), object , namespace , m .Config .User , m .Config .Password )
@@ -130,8 +133,10 @@ func (m *CatalogConfigProvider) Read(object string, field string, localcontext i
130133}
131134
132135func (m * CatalogConfigProvider ) ReadObject (object string , localcontext interface {}) (map [string ]interface {}, error ) {
136+ clog .Debug (" M (Catalog): ReadObject, object: %s" , object )
133137 namespace := m .getNamespaceFromContext (localcontext )
134138 object = api_utils .ReplaceSeperator (object )
139+
135140 catalog , err := m .ApiClient .GetCatalog (context .TODO (), object , namespace , m .Config .User , m .Config .Password )
136141 if err != nil {
137142 return nil , err
@@ -223,7 +228,7 @@ func (m *CatalogConfigProvider) traceValue(v interface{}, localcontext interface
223228// TODO: IConfigProvider interface methods should be enhanced to accept namespace as a parameter
224229// so we can get rid of getCatalogInDefaultNamespace.
225230func (m * CatalogConfigProvider ) Set (object string , field string , value interface {}) error {
226- object = api_utils . ReplaceSeperator ( object )
231+ clog . Debug ( " M (Catalog): Set, object: %s, field: %s" , object , field )
227232 catalog , err := m .getCatalogInDefaultNamespace (context .TODO (), object )
228233 if err != nil {
229234 return err
@@ -233,7 +238,7 @@ func (m *CatalogConfigProvider) Set(object string, field string, value interface
233238 return m .ApiClient .UpsertCatalog (context .TODO (), object , data , m .Config .User , m .Config .Password )
234239}
235240func (m * CatalogConfigProvider ) SetObject (object string , value map [string ]interface {}) error {
236- object = api_utils . ReplaceSeperator ( object )
241+ clog . Debug ( " M (Catalog): SetObject, object: %s" , object )
237242 catalog , err := m .getCatalogInDefaultNamespace (context .TODO (), object )
238243 if err != nil {
239244 return err
@@ -246,7 +251,7 @@ func (m *CatalogConfigProvider) SetObject(object string, value map[string]interf
246251 return m .ApiClient .UpsertCatalog (context .TODO (), object , data , m .Config .User , m .Config .Password )
247252}
248253func (m * CatalogConfigProvider ) Remove (object string , field string ) error {
249- object = api_utils . ReplaceSeperator ( object )
254+ clog . Debug ( " M (Catalog): Remove, object: %s, field: %s" , object , field )
250255 catlog , err := m .getCatalogInDefaultNamespace (context .TODO (), object )
251256 if err != nil {
252257 return err
@@ -259,10 +264,12 @@ func (m *CatalogConfigProvider) Remove(object string, field string) error {
259264 return m .ApiClient .UpsertCatalog (context .TODO (), object , data , m .Config .User , m .Config .Password )
260265}
261266func (m * CatalogConfigProvider ) RemoveObject (object string ) error {
267+ clog .Debug (" M (Catalog): RemoveObject, object: %s" , object )
262268 object = api_utils .ReplaceSeperator (object )
263269 return m .ApiClient .DeleteCatalog (context .TODO (), object , m .Config .User , m .Config .Password )
264270}
265271
266272func (m * CatalogConfigProvider ) getCatalogInDefaultNamespace (context context.Context , catalog string ) (model.CatalogState , error ) {
273+ catalog = api_utils .ReplaceSeperator (catalog )
267274 return m .ApiClient .GetCatalog (context , catalog , "" , m .Config .User , m .Config .Password )
268275}
0 commit comments