Skip to content

Commit

Permalink
update vendor return error state
Browse files Browse the repository at this point in the history
  • Loading branch information
linyguo committed Dec 12, 2024
1 parent 25048ea commit ae38c50
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 56 deletions.
10 changes: 5 additions & 5 deletions api/pkg/apis/v1alpha1/vendors/activations-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *ActivationsVendor) onStatus(request v1alpha2.COARequest) v1alpha2.COARe
if err != nil {
vLog.InfofCtx(ctx, "V (Activations Vendor): onStatus failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -158,7 +158,7 @@ func (c *ActivationsVendor) onActivations(request v1alpha2.COARequest) v1alpha2.
if err != nil {
vLog.InfofCtx(ctx, "V (Activations Vendor): onActivations failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func (c *ActivationsVendor) onActivations(request v1alpha2.COARequest) v1alpha2.
if err != nil {
vLog.ErrorfCtx(ctx, "V (Activations Vendor): onActivations failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -205,7 +205,7 @@ func (c *ActivationsVendor) onActivations(request v1alpha2.COARequest) v1alpha2.
if err != nil {
vLog.ErrorfCtx(ctx, "V (Activations Vendor): onActivations failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func (c *ActivationsVendor) onActivations(request v1alpha2.COARequest) v1alpha2.
if err != nil {
vLog.ErrorfCtx(ctx, "V (Activations Vendor): onActivations failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/campaigns-container-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (c *CampaignContainersVendor) onCampaignContainers(request v1alpha2.COARequ
if err != nil {
ccLog.ErrorfCtx(ctx, "V (CampaignContainers): onCampaignContainers failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func (c *CampaignContainersVendor) onCampaignContainers(request v1alpha2.COARequ
if err != nil {
ccLog.InfofCtx(ctx, "V (CampaignContainers): onCampaignContainers failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -144,7 +144,7 @@ func (c *CampaignContainersVendor) onCampaignContainers(request v1alpha2.COARequ
if err != nil {
ccLog.ErrorfCtx(ctx, "V (CampaignContainers): onCampaignContainers failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/campaigns-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (c *CampaignsVendor) onCampaigns(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
cLog.InfofCtx(ctx, "V (Campaigns): onCampaigns failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (c *CampaignsVendor) onCampaigns(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
cLog.ErrorfCtx(ctx, "V (Campaigns): onCampaigns failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -145,7 +145,7 @@ func (c *CampaignsVendor) onCampaigns(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
cLog.ErrorfCtx(ctx, "V (Campaigns): onCampaigns failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/devices-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (c *DevicesVendor) onDevices(request v1alpha2.COARequest) v1alpha2.COARespo
if err != nil {
log.ErrorfCtx(ctx, "V (Devices): failed to get device spec, error %v", err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func (c *DevicesVendor) onDevices(request v1alpha2.COARequest) v1alpha2.COARespo
if err != nil {
log.ErrorfCtx(ctx, "V (Devices): failed to upsert device spec, error %v", err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -148,7 +148,7 @@ func (c *DevicesVendor) onDevices(request v1alpha2.COARequest) v1alpha2.COARespo
if err != nil {
log.ErrorfCtx(ctx, "V (Devices): failed to delete device spec, error %v", err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
16 changes: 8 additions & 8 deletions api/pkg/apis/v1alpha1/vendors/federation-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (c *FederationVendor) onStatus(request v1alpha2.COARequest) v1alpha2.COARes

if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -270,7 +270,7 @@ func (f *FederationVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAR
})
} else {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func (f *FederationVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAR
err = f.SitesManager.UpsertSpec(ctx, id, site)
if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -315,7 +315,7 @@ func (f *FederationVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAR
err := f.SitesManager.DeleteSpec(ctx, id)
if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -356,7 +356,7 @@ func (f *FederationVendor) onSync(request v1alpha2.COARequest) v1alpha2.COARespo
if err != nil {
tLog.ErrorfCtx(pCtx, "V (Federation): failed to publish job report: %v", err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -390,7 +390,7 @@ func (f *FederationVendor) onSync(request v1alpha2.COARequest) v1alpha2.COARespo

if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -403,7 +403,7 @@ func (f *FederationVendor) onSync(request v1alpha2.COARequest) v1alpha2.COARespo
catalog, err := f.CatalogsManager.GetState(ctx, c.Id, namespace)
if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -476,7 +476,7 @@ func (f *FederationVendor) onK8sHook(request v1alpha2.COARequest) v1alpha2.COARe
})
if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/models-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *ModelsVendor) onModels(request v1alpha2.COARequest) v1alpha2.COARespons
tLog.ErrorfCtx(ctx, " V (Models): onModels failed to GetSpec, id: %s, err: %v", id, err)
}
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func (c *ModelsVendor) onModels(request v1alpha2.COARequest) v1alpha2.COARespons
if err != nil {
tLog.ErrorfCtx(ctx, "V (Models): onModels failed to UpsertSpec, id: %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -152,7 +152,7 @@ func (c *ModelsVendor) onModels(request v1alpha2.COARequest) v1alpha2.COARespons
if err != nil {
tLog.ErrorfCtx(ctx, "V (Models): onModels failed to DeleteSpec, id: %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
4 changes: 2 additions & 2 deletions api/pkg/apis/v1alpha1/vendors/settings-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (c *SettingsVendor) onConfig(request v1alpha2.COARequest) v1alpha2.COARespo
if err != nil {
log.ErrorfCtx(ctx, "V (Settings): onConfig failed to get config %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -122,7 +122,7 @@ func (c *SettingsVendor) onConfig(request v1alpha2.COARequest) v1alpha2.COARespo
if val == nil {
log.ErrorfCtx(ctx, "V (Settings): onConfig failed to get object %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
} else {
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/skills-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *SkillsVendor) onSkills(request v1alpha2.COARequest) v1alpha2.COARespons
kLog.ErrorfCtx(ctx, " V (Skills): onSkills failed to GetSpec, id: %s, err: %v", id, err)
}
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func (c *SkillsVendor) onSkills(request v1alpha2.COARequest) v1alpha2.COARespons
if err != nil {
kLog.ErrorfCtx(ctx, "V (Skills): onSkills failed to UpsertSpec, id: %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand All @@ -152,7 +152,7 @@ func (c *SkillsVendor) onSkills(request v1alpha2.COARequest) v1alpha2.COARespons
if err != nil {
kLog.ErrorfCtx(ctx, "V (Skills): onSkills failed to DeleteSpec, id: %s, error: %v", id, err)
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/solution-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (c *SolutionVendor) onQueue(request v1alpha2.COARequest) v1alpha2.COARespon
})
} else {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: data,
})
}
Expand Down Expand Up @@ -209,7 +209,7 @@ func (c *SolutionVendor) onQueue(request v1alpha2.COARequest) v1alpha2.COARespon
if err != nil {
sLog.ErrorfCtx(ctx, "V (Solution): onQueue DeleteSummary failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -261,7 +261,7 @@ func (c *SolutionVendor) onReconcile(request v1alpha2.COARequest) v1alpha2.COARe
if err != nil {
sLog.ErrorfCtx(ctx, "V (Solution): onReconcile failed POST - reconcile %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: data,
})
}
Expand Down
6 changes: 3 additions & 3 deletions api/pkg/apis/v1alpha1/vendors/solutions-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (c *SolutionsVendor) onSolutions(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
uLog.ErrorfCtx(ctx, "V (Solutions): onSolutions failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -160,7 +160,7 @@ func (c *SolutionsVendor) onSolutions(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
uLog.ErrorfCtx(ctx, "V (Solutions): onSolutions failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -196,7 +196,7 @@ func (c *SolutionsVendor) onSolutions(request v1alpha2.COARequest) v1alpha2.COAR
if err != nil {
uLog.ErrorfCtx(ctx, "V (Solutions): onSolutions failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
12 changes: 6 additions & 6 deletions api/pkg/apis/v1alpha1/vendors/targets-vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (c *TargetsVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAResp
if err != nil {
tLog.ErrorfCtx(ctx, "V (Targets) : onRegistry failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (c *TargetsVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAResp
if err != nil {
tLog.ErrorfCtx(ctx, "V (Targets) : onRegistry failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -263,7 +263,7 @@ func (c *TargetsVendor) onRegistry(request v1alpha2.COARequest) v1alpha2.COAResp
if err != nil {
tLog.ErrorfCtx(ctx, "V (Targets) : onRegistry failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -383,7 +383,7 @@ func (c *TargetsVendor) onStatus(request v1alpha2.COARequest) v1alpha2.COARespon
if err != nil {
tLog.ErrorfCtx(pCtx, "V (Targets) : onStatus failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -422,7 +422,7 @@ func (c *TargetsVendor) onDownload(request v1alpha2.COARequest) v1alpha2.COAResp
state, err := c.TargetsManager.GetState(pCtx, request.Parameters["__name"], namespace)
if err != nil {
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down Expand Up @@ -483,7 +483,7 @@ func (c *TargetsVendor) onHeartBeat(request v1alpha2.COARequest) v1alpha2.COARes
if err != nil {
tLog.ErrorfCtx(pCtx, "V (Targets) : onHeartBeat failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (c *VisualizationClientVendor) onVisClient(request v1alpha2.COARequest) v1a
if err != nil {
cvLog.ErrorfCtx(pCtx, "V (VisualizationClient): onVisClient failed - %s", err.Error())
return observ_utils.CloseSpanWithCOAResponse(span, v1alpha2.COAResponse{
State: v1alpha2.InternalError,
State: v1alpha2.GetErrorState(err),
Body: []byte(err.Error()),
})
}
Expand Down
Loading

0 comments on commit ae38c50

Please sign in to comment.