From a1a04457790f390c03c582e681daf25a9505ebcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Sat, 19 Jan 2019 11:54:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E4=BC=A0=E9=80=92tenant=5Fid?= =?UTF-8?q?=E5=92=8Conecloud=20api=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/climc/shell/cloudaccounts.go | 6 +++--- pkg/util/azure/provider/provider.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/climc/shell/cloudaccounts.go b/cmd/climc/shell/cloudaccounts.go index 455da1a15e..558e6cc14d 100644 --- a/cmd/climc/shell/cloudaccounts.go +++ b/cmd/climc/shell/cloudaccounts.go @@ -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"}, diff --git a/pkg/util/azure/provider/provider.go b/pkg/util/azure/provider/provider.go index c4e9d31030..88fc56849e 100644 --- a/pkg/util/azure/provider/provider.go +++ b/pkg/util/azure/provider/provider.go @@ -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