Skip to content

Commit

Permalink
remove the check of exisiting database before deleteing the postgresuser
Browse files Browse the repository at this point in the history
  • Loading branch information
romg67 committed Jul 19, 2023
1 parent 0660c2d commit fd62c3a
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pkg/controller/postgresuser/postgresuser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,6 @@ func (r *ReconcilePostgresUser) Reconcile(request reconcile.Request) (reconcile.
// Initialize database name for connection with default database
// in case postgres cr isn't here anymore
db := r.pg.GetDefaultDatabase()
// Search Postgres CR
postgres, err := r.getPostgresCR(instance)
// Check if error exists and not a not found error
if err != nil && !errors.IsNotFound(err) {
return reconcile.Result{}, err
}
// Check if postgres cr is found and not in deletion state
if postgres != nil && !postgres.GetDeletionTimestamp().IsZero() {
db = instance.Status.DatabaseName
}
err = r.pg.DropRole(instance.Status.PostgresRole, instance.Status.PostgresGroup,
db, reqLogger)
if err != nil {
Expand Down

0 comments on commit fd62c3a

Please sign in to comment.