fix(region): azure account read only

This commit is contained in:
ioito
2022-07-18 15:29:02 +08:00
parent 60d1fc2ca7
commit 00d9b5fa59
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -156,6 +156,8 @@ const (
QCLOUD_DBINSTANCE_STORAGE_TYPE_LOCAL_SSD = "local_ssd" //本地盘SSD盘
QCLOUD_DBINSTANCE_STORAGE_TYPE_CLOUD_SSD = "cloud_ssd" //SSD云盘
// Azure
AZURE_DBINSTANCE_STORAGE_TYPE_DEFAULT = "default"
)
var (
+1 -1
View File
@@ -161,7 +161,7 @@ func (self *SAzureClient) getClient(resource TAzureResource) (*autorest.Client,
transport, _ := httpClient.Transport.(*http.Transport)
httpClient.Transport = cloudprovider.GetCheckTransport(transport, func(req *http.Request) (func(resp *http.Response), error) {
if self.cpcfg.ReadOnly {
if req.Method == "GET" {
if req.Method == "GET" || (req.Method == "POST" && strings.HasSuffix(req.URL.Path, "oauth2/token")) {
return nil, nil
}
return nil, errors.Wrapf(cloudprovider.ErrAccountReadOnly, "%s %s", req.Method, req.URL.Path)
+1 -1
View File
@@ -142,7 +142,7 @@ func (self *SSQLServer) GetStatus() string {
}
func (self *SSQLServer) GetStorageType() string {
return ""
return api.AZURE_DBINSTANCE_STORAGE_TYPE_DEFAULT
}
func (self *SSQLServer) fetchDatabase() ([]SSQLServerDatabase, error) {