Automatic merge from release/2.5.0 -> release/2.6.0

* commit '56cd5919d673d92ece5df13a0672591098a74647':
  避免传递tenant_id和onecloud api冲突
This commit is contained in:
邱剑
2019-01-19 12:21:28 +08:00
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -45,8 +45,8 @@ func init() {
AuthURL string `help:"OpenStack auth_url"`
Host string `help:"VMware host"`
Port string `help:"VMware host port" default:"443"`
TenantID string `help:"Azure tenant_id"`
ClientID string `help:"Azure tenant_id"`
directoryID string `help:"Azure directory_id"`
ClientID string `help:"Azure client_id"`
ClientSecret string `help:"Azure clinet_secret"`
Environment string `help:"Azure|Huawei|Aws environment" choices:"AzureGermanCloud|AzureChinaCloud|AzureUSGovernmentCloud|AzurePublicCloud|InternationalCloud|ChinaCloud|"`
PROVIDER string `help:"Driver for cloud account" choices:"VMware|Aliyun|Azure|Qcloud|OpenStack|Huawei|Aws"`
@@ -66,7 +66,7 @@ func init() {
requireParamsMap := map[string][]string{
"VMware": {"username", "password", "host", "port"},
"Aliyun": {"access_key_id", "access_key_secret"},
"Azure": {"tenant_id", "client_id", "client_secret", "environment"},
"Azure": {"directory_id", "client_id", "client_secret", "environment"},
"Qcloud": {"app_id", "secret_id", "secret_key"},
"OpenStack": {"project_name", "username", "password", "auth_url"},
"Huawei": {"access_key_id", "access_key_secret", "environment"},
+4 -4
View File
@@ -24,9 +24,9 @@ func (self *SAzureProviderFactory) ValidateChangeBandwidth(instanceId string, ba
}
func (self *SAzureProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) error {
tenantID, _ := data.GetString("tenant_id")
if len(tenantID) == 0 {
return httperrors.NewMissingParameterError("tenant_id")
directoryID, _ := data.GetString("directory_id")
if len(directoryID) == 0 {
return httperrors.NewMissingParameterError("directory_id")
}
clientID, _ := data.GetString("client_id")
if len(clientID) == 0 {
@@ -40,7 +40,7 @@ func (self *SAzureProviderFactory) ValidateCreateCloudaccountData(ctx context.Co
if len(environment) == 0 {
return httperrors.NewMissingParameterError("environment")
}
data.Set("account", jsonutils.NewString(tenantID))
data.Set("account", jsonutils.NewString(directoryID))
data.Set("secret", jsonutils.NewString(fmt.Sprintf("%s/%s", clientID, clientSecret)))
data.Set("access_url", jsonutils.NewString(environment))
return nil