fix(region): qcloud permission (#20555)

This commit is contained in:
屈轩
2024-06-17 14:25:05 +08:00
committed by GitHub
parent aacaf4e34f
commit 47ea1c0ca7
6 changed files with 22 additions and 6 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240603072808-2fc75a83dad7
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240617060756-e174e60e95f7
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20240203102553-4096f103b401
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
+2 -2
View File
@@ -1210,8 +1210,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240603072808-2fc75a83dad7 h1:61XiAkSLyvgKN024+WumxFJSx/VsVpHnW2Tuqa8NWnI=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240603072808-2fc75a83dad7/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240617060756-e174e60e95f7 h1:j92tB/bgJF9EbwXfvAxWIplyIVBA+KXL78Dmg4NCg/0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240617060756-e174e60e95f7/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+1 -1
View File
@@ -1485,7 +1485,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240603072808-2fc75a83dad7
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240617060756-e174e60e95f7
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+1
View File
@@ -17,6 +17,7 @@ package compute
const (
MONGO_DB_STATUS_CREATING = "creating"
MONGO_DB_STATUS_RUNNING = "running"
MONGO_DB_STATUS_PROCESSING = "processing"
MONGO_DB_STATUS_DEPLOY = "deploy"
MONGO_DB_STATUS_CHANGE_CONFIG = "change_config"
MONGO_DB_STATUS_DELETING = "deleting"
+3 -1
View File
@@ -115,8 +115,10 @@ func (self *SMongoDB) GetName() string {
func (self *SMongoDB) GetStatus() string {
switch self.Status {
case 0, 1:
case 0:
return api.MONGO_DB_STATUS_CREATING
case 1:
return api.MONGO_DB_STATUS_PROCESSING
case 2:
return api.MONGO_DB_STATUS_RUNNING
case -2, -3:
+14 -1
View File
@@ -455,7 +455,20 @@ func (client *SQcloudClient) getSdkClient(regionId string) (*common.Client, erro
service := strings.Split(req.URL.Host, ".")[0]
action := params.Get("Action")
respCheck := func(resp *http.Response) error {
if client.cpcfg.UpdatePermission != nil {
if resp.ContentLength <= 0 {
return nil
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return errors.Wrapf(err, "ioutil.ReadAll")
}
resp.Body = io.NopCloser(bytes.NewBuffer(body))
obj, _ := jsonutils.Parse(body)
code := ""
if obj != nil {
code, _ = obj.GetString("Response", "Error", "Code")
}
if client.cpcfg.UpdatePermission != nil && code == "UnauthorizedOperation" {
client.cpcfg.UpdatePermission(service, action)
}
return nil