Skip to content

Commit

Permalink
update crossplane plugin changes for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
vramk23 committed Jun 5, 2024
1 parent 954da6a commit eed417c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions capten/agent/internal/api/plugin_crossplane_provider_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"context"

"github.com/google/uuid"
"github.com/kube-tarian/kad/capten/common-pkg/gerrors"
"github.com/kube-tarian/kad/capten/common-pkg/pb/captenpluginspb"
postgresdb "github.com/kube-tarian/kad/capten/common-pkg/postgres"
"github.com/kube-tarian/kad/capten/model"
)

Expand All @@ -23,15 +25,15 @@ func (a *Agent) AddCrossplanProvider(ctx context.Context, request *captenplugins
}
a.log.Infof("Add Crossplane Provider type %s with cloud provider %s request recieved", request.CloudType, request.CloudProviderId)

project, err := a.as.GetCrossplanProviderByCloudType(request.CloudType)
if err != nil {
existingProvider, err := a.as.GetCrossplanProviderByCloudType(request.CloudType)
if err != nil && gerrors.GetErrorType(err) != postgresdb.ObjectNotExist {
a.log.Infof("failed to get crossplane provider", err)
return &captenpluginspb.AddCrossplanProviderResponse{
Status: captenpluginspb.StatusCode_INTERNAL_ERROR,
StatusMessage: "failed to get crossplane provider for " + request.CloudType,
}, nil
}
if project != nil {
if existingProvider != nil {
return &captenpluginspb.AddCrossplanProviderResponse{
Status: captenpluginspb.StatusCode_NOT_FOUND,
StatusMessage: "Crossplane provider is already available",
Expand Down

0 comments on commit eed417c

Please sign in to comment.