Skip to content

Commit

Permalink
report errors when failing to create required steps (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwells authored Oct 25, 2024
1 parent 55484f4 commit 3dd627e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion pkg/databaseclaim/awsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ func (r *DatabaseClaimReconciler) updateDBInstance(ctx context.Context, reqInfo
} else {
maxStorageVal = &params.MaxStorageGB
}
dbInstance.Spec.ForProvider.DBName = &dbClaim.Spec.DatabaseName
dbInstance.Spec.ForProvider.MaxAllocatedStorage = maxStorageVal
dbInstance.Spec.ForProvider.EnableCloudwatchLogsExports = reqInfo.EnableCloudwatchLogsExport
dbInstance.Spec.ForProvider.MultiAZ = &multiAZ
Expand Down
9 changes: 5 additions & 4 deletions pkg/databaseclaim/databaseclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,21 +586,22 @@ func (r *DatabaseClaimReconciler) reconcileNewDB(ctx context.Context, reqInfo *r

// Updates the database name
if err := r.createDatabaseAndExtensions(ctx, reqInfo, dbClient, &dbClaim.Status.NewDB, operationalMode); err != nil {
return ctrl.Result{}, err
logr.Error(err, "unable to create database and extensions")
return r.manageError(ctx, dbClaim, err)
}

// Updates the connection info username
err = r.manageUserAndExtensions(ctx, reqInfo, logr, dbClient, &dbClaim.Status.NewDB, dbClaim.Spec.DatabaseName, dbClaim.Spec.Username, operationalMode)
if err != nil {
logr.Error(err, "unable to update users, user credents not persisted to status object")
return ctrl.Result{}, err
logr.Error(err, "unable to update users, user credentials not persisted to status object")
return r.manageError(ctx, dbClaim, err)
}

// TODO: I don't know what purpose these serve
// ref: https://github.com/infobloxopen/db-controller/pull/193
err = dbClient.ManageSystemFunctions(dbClaim.Spec.DatabaseName, basefun.GetSystemFunctions(r.Config.Viper))
if err != nil {
return ctrl.Result{}, err
return r.manageError(ctx, dbClaim, err)
}
logr.V(debugLevel).Info("populated_newdb_information", "newdb", dbClaim.Status.NewDB)
return ctrl.Result{}, nil
Expand Down

0 comments on commit 3dd627e

Please sign in to comment.