From 8654a70876439b1ded5ab3849d69880b9c4649ab Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Mon, 12 Sep 2022 17:53:40 +0800 Subject: [PATCH] fix: remove irrelevant common options --- pkg/apigateway/handler/auth.go | 14 +++++--------- pkg/apis/apigateway/regions.go | 7 +------ pkg/apis/identity/consts.go | 4 ---- pkg/cloudcommon/options/changes.go | 3 --- pkg/cloudcommon/options/options.go | 2 -- pkg/compute/options/options.go | 7 +++++++ 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/pkg/apigateway/handler/auth.go b/pkg/apigateway/handler/auth.go index bdeeaf6c60..8aea11beef 100644 --- a/pkg/apigateway/handler/auth.go +++ b/pkg/apigateway/handler/auth.go @@ -145,10 +145,8 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr Domains: []string{}, ReturnFullDomains: false, Idps: []agapi.SIdp{}, - SCommonConfig: agapi.SCommonConfig{ - ApiServer: options.Options.ApiServer, - }, - EncryptPasswd: true, + EncryptPasswd: true, + ApiServer: options.Options.ApiServer, } s := auth.GetAdminSession(ctx, regions[0]) @@ -195,12 +193,10 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr // fetch this option directly from Keystone commonCfg, err := modules.ServicesV3.GetSpecific(s, "common", "config", nil) if err == nil && commonCfg != nil { - config := agapi.SCommonConfig{} - commonCfg.Unmarshal(&config, "config", "default") - if len(config.ApiServer) > 0 { - ret.ApiServer = config.ApiServer + apiServer, _ := commonCfg.GetString("config", "default", "api_server") + if len(apiServer) > 0 { + ret.ApiServer = apiServer } - ret.IsForgetLoginUser = config.IsForgetLoginUser } return ret, nil } diff --git a/pkg/apis/apigateway/regions.go b/pkg/apis/apigateway/regions.go index 72b71dec98..e24619526b 100644 --- a/pkg/apis/apigateway/regions.go +++ b/pkg/apis/apigateway/regions.go @@ -23,11 +23,6 @@ type SIdp struct { IsDefault bool `json:"is_default"` } -type SCommonConfig struct { - ApiServer string `json:"api_server,allowempty"` - IsForgetLoginUser bool `json:"is_forget_login_user"` -} - type SRegionsReponse struct { Regions []string `json:"regions,allowempty"` Domains []string `json:"domains,allowempty"` @@ -37,5 +32,5 @@ type SRegionsReponse struct { EncryptPasswd bool `json:"encrypt_passwd"` - SCommonConfig + ApiServer string `json:"api_server,allowempty"` } diff --git a/pkg/apis/identity/consts.go b/pkg/apis/identity/consts.go index 49fed6e93b..3f44bc39cb 100644 --- a/pkg/apis/identity/consts.go +++ b/pkg/apis/identity/consts.go @@ -104,7 +104,6 @@ var ( "default": []string{ "enable_quota_check", "default_quota_value", - "enable_rbac", "non_default_domain_projects", "time_zone", "domainized_namespace", @@ -115,9 +114,6 @@ var ( "ignore_nonrunning_guests", "platform_name", "platform_names", - "is_forget_login_user", - "enable_organization", - "enable_tls_migration", }, } diff --git a/pkg/cloudcommon/options/changes.go b/pkg/cloudcommon/options/changes.go index 6b337406c7..2b00a65668 100644 --- a/pkg/cloudcommon/options/changes.go +++ b/pkg/cloudcommon/options/changes.go @@ -53,9 +53,6 @@ func OnBaseOptionsChange(oOpts, nOpts interface{}) bool { if oldOpts.ApiServer != newOpts.ApiServer { log.Debugf("api_server changed from %s to %s", oldOpts.ApiServer, newOpts.ApiServer) } - if oldOpts.EnableTlsMigration != newOpts.EnableTlsMigration { - log.Debugf("enable_tls_migration changed from %v to %v", oldOpts.EnableTlsMigration, newOpts.EnableTlsMigration) - } return changed } diff --git a/pkg/cloudcommon/options/options.go b/pkg/cloudcommon/options/options.go index c83597028f..566b7dfd5d 100644 --- a/pkg/cloudcommon/options/options.go +++ b/pkg/cloudcommon/options/options.go @@ -110,8 +110,6 @@ type BaseOptions struct { PlatformName string `help:"identity name of this platform" default:"Cloudpods"` PlatformNames map[string]string `help:"identity name of this platform by language"` - - EnableTlsMigration bool `help:"Enable TLS migration" default:"false"` } const ( diff --git a/pkg/compute/options/options.go b/pkg/compute/options/options.go index c0a5aa34ff..8234567e85 100644 --- a/pkg/compute/options/options.go +++ b/pkg/compute/options/options.go @@ -15,6 +15,8 @@ package options import ( + "yunion.io/x/log" + common_options "yunion.io/x/onecloud/pkg/cloudcommon/options" "yunion.io/x/onecloud/pkg/cloudcommon/pending_delete" "yunion.io/x/onecloud/pkg/multicloud/esxi" @@ -189,6 +191,8 @@ type ComputeOptions struct { EnableAwsMonitorAgent bool `help:"enable aws monitor agent" default:"true"` + EnableTlsMigration bool `help:"Enable TLS migration" default:"false"` + esxi.EsxiOptions } @@ -228,6 +232,9 @@ func OnOptionsChange(oldO, newO interface{}) bool { changed = true } } + if oldOpts.EnableTlsMigration != newOpts.EnableTlsMigration { + log.Debugf("enable_tls_migration changed from %v to %v", oldOpts.EnableTlsMigration, newOpts.EnableTlsMigration) + } return changed }