Skip to content

Commit

Permalink
setting hash for op incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
jpflueger committed Apr 15, 2020
1 parent c8156b9 commit 799e654
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/resourcemanager/cosmosdbs/cosmosdb_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,32 @@ func (m *AzureCosmosDBManager) Ensure(ctx context.Context, obj runtime.Object, o
db, err = m.CreateOrUpdateCosmosDB(ctx, groupName, accountName, location, kind, dbType, tags)
if err != nil {
azerr := errhelp.NewAzureErrorAzureError(err)
instance.Status.Message = err.Error()

switch azerr.Type {
case errhelp.AsyncOpIncompleteError:
instance.Status.State = "Creating"
instance.Status.Message = "Resource request successfully submitted to Azure"
return false, nil
instance.Status.SpecHash = hash
case errhelp.InvalidResourceLocation, errhelp.LocationNotAvailableForResourceType:
instance.Status.Provisioning = false
instance.Status.Message = azerr.Error()
return true, nil
case errhelp.ResourceGroupNotFoundErrorCode, errhelp.ParentNotFoundErrorCode:
instance.Status.Provisioning = false
instance.Status.Message = azerr.Error()
return false, nil
case errhelp.NotFoundErrorCode:
if nameExists, err := m.CheckNameExistsCosmosDB(ctx, accountName); err != nil {
nameExists, err := m.CheckNameExistsCosmosDB(ctx, accountName)
if err != nil {
instance.Status.Message = err.Error()
return false, err
} else if nameExists {
}
if nameExists {
instance.Status.Provisioning = false
instance.Status.Message = "CosmosDB Account name already exists"
return true, nil
}
default:
instance.Status.Message = azerr.Error()
return false, nil
}

return false, nil
}

instance.Status.SpecHash = hash
Expand Down

0 comments on commit 799e654

Please sign in to comment.