Skip to content

Commit

Permalink
fix(region): raw query with delete-all options (#19603)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Mar 1, 2024
1 parent 58602af commit b491e0e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/compute/models/network_additional_wires.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import (
"context"
"strings"

"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/utils"
"yunion.io/x/sqlchemy"

api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/netutils2"
)

Expand Down Expand Up @@ -66,6 +68,10 @@ func (manager *SNetworkAdditionalWireManager) newRecord(ctx context.Context, net
return errors.Wrap(err, "InsertOrUpdate")
}

func (manager *SNetworkAdditionalWireManager) NewQuery(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, useRawQuery bool) *sqlchemy.SQuery {
return manager.Query()
}

func (manager *SNetworkAdditionalWireManager) Query(fields ...string) *sqlchemy.SQuery {
q := manager.SModelBaseManager.Query(fields...)
q = q.Filter(sqlchemy.OR(
Expand Down
5 changes: 5 additions & 0 deletions pkg/compute/models/scalinggroup_guest.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"time"

"yunion.io/x/jsonutils"
"yunion.io/x/pkg/tristate"
"yunion.io/x/sqlchemy"

Expand Down Expand Up @@ -106,6 +107,10 @@ func (sgg *SScalingGroupGuest) SetGuestStatus(status string) error {
return err
}

func (sggm *SScalingGroupGuestManager) NewQuery(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, useRawQuery bool) *sqlchemy.SQuery {
return sggm.Query()
}

func (sggm *SScalingGroupGuestManager) Query(fields ...string) *sqlchemy.SQuery {
return sggm.SVirtualJointResourceBaseManager.Query(fields...).NotEquals("guest_status",
compute.SG_GUEST_STATUS_PENDING_REMOVE)
Expand Down
4 changes: 4 additions & 0 deletions pkg/keystone/models/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func (project *SProject) resetAdminUser(ctx context.Context, userCred mcclient.T
return nil
}

func (manager *SProjectManager) NewQuery(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, useRawQuery bool) *sqlchemy.SQuery {
return manager.Query()
}

func (manager *SProjectManager) Query(fields ...string) *sqlchemy.SQuery {
return manager.SIdentityBaseResourceManager.Query(fields...).IsFalse("is_domain")
}
Expand Down

0 comments on commit b491e0e

Please sign in to comment.