fix(import): activate label policy after creation (#4879)

This commit is contained in:
Livio Spring 2022-12-21 09:46:05 +01:00 committed by GitHub
parent f5eddcc490
commit 6093440747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,6 +420,17 @@ func (s *Server) importData(ctx context.Context, orgs []*admin_pb.DataOrg) (*adm
_, err = s.command.AddLabelPolicy(ctx, org.GetOrgId(), management.AddLabelPolicyToDomain(org.GetLabelPolicy()))
if err != nil {
errors = append(errors, &admin_pb.ImportDataError{Type: "label_policy", Id: org.GetOrgId(), Message: err.Error()})
if isCtxTimeout(ctx) {
return &admin_pb.ImportDataResponse{Errors: errors, Success: success}, count, err
}
} else {
_, err = s.command.ActivateLabelPolicy(ctx, org.GetOrgId())
if err != nil {
errors = append(errors, &admin_pb.ImportDataError{Type: "label_policy", Id: org.GetOrgId(), Message: err.Error()})
if isCtxTimeout(ctx) {
return &admin_pb.ImportDataResponse{Errors: errors, Success: success}, count, err
}
}
}
}
if org.LockoutPolicy != nil {