File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/shared/databaseconfigurator/postgres Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -182,13 +182,22 @@ func (p *PostgresConfigurator) getAllowedDatabasesDiffForUser(ctx context.Contex
182182}
183183
184184func (p * PostgresConfigurator ) revokeDatabasePermissions (ctx context.Context , username string , dbname string ) error {
185+ if IsManagedDBName (dbname ) {
186+ // If we know that this is managed DB, we don't want to try to connect to it, becasue we know that we will
187+ // fail, and this might raise an alert on the database (for example, if we will try to connect to
188+ // 'cloudsqladmin' database in managed Google cloud SQL)
189+ logrus .WithField ("database" , dbname ).Debug ("Skipping known managed database" )
190+ return nil
191+ }
192+
185193 err := p .setConnection (ctx , dbname )
186- if err != nil && ( IsInvalidAuthorizationError (err ) || IsManagedDBName ( dbname ) ) {
194+ if err != nil && IsInvalidAuthorizationError (err ) {
187195 // Probably an admin database that we're failing to connect to or something along those lines
188196 // (like 'cloudsqladmin' database in managed Google cloud SQL)
189197 logrus .WithField ("database" , dbname ).Debug ("Skipping invalid authorization error" )
190198 return nil
191199 }
200+
192201 if err != nil {
193202 pgErr , ok := TranslatePostgresConnectionError (err )
194203 if ok {
You can’t perform that action at this time.
0 commit comments