fix(delivery): accept root@% credential for CloudDM registration
PR #128 looks up the root credential with account_host = 'localhost', which never matches under the single root@% account model. Widen the lookup to account_host IN ('%', 'localhost'), consistent with the compatibility strategy in deploymentCredentialVars.
This commit is contained in:
@@ -2046,7 +2046,7 @@ func (s *DeliveryService) RegisterCloudDM(ctx context.Context, taskID string) er
|
||||
}
|
||||
var credential model.DeploymentCredential
|
||||
if err := s.db.WithContext(ctx).
|
||||
Where("task_id = ? AND username = ? AND account_host = ? AND status IN ?", taskID, "root", "localhost", []string{"pending", "available"}).
|
||||
Where("task_id = ? AND username = ? AND account_host IN ? AND status IN ?", taskID, "root", []string{"%", "localhost"}, []string{"pending", "available"}).
|
||||
First(&credential).Error; err != nil {
|
||||
return fmt.Errorf("CloudDM registration requires the MySQL root credential: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user