mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-31 02:38:07 +08:00
fix: remove apiversion param from session
This commit is contained in:
@@ -68,9 +68,9 @@ type BaseOptions struct {
|
||||
OsRegionName string `default:"$OS_REGION_NAME" help:"Defaults to env[OS_REGION_NAME]"`
|
||||
OsZoneName string `default:"$OS_ZONE_NAME" help:"Defaults to env[OS_ZONE_NAME]"`
|
||||
OsEndpointType string `default:"$OS_ENDPOINT_TYPE|internalURL" help:"Defaults to env[OS_ENDPOINT_TYPE] or internalURL" choices:"publicURL|internalURL|adminURL"`
|
||||
ApiVersion string `default:"$API_VERSION" help:"override default modules service api version"`
|
||||
OutputFormat string `default:"$CLIMC_OUTPUT_FORMAT|table" choices:"table|kv|json|flatten-table|flatten-kv" help:"output format"`
|
||||
SUBCOMMAND string `help:"climc subcommand" subcommand:"true"`
|
||||
// ApiVersion string `default:"$API_VERSION" help:"override default modules service api version"`
|
||||
OutputFormat string `default:"$CLIMC_OUTPUT_FORMAT|table" choices:"table|kv|json|flatten-table|flatten-kv" help:"output format"`
|
||||
SUBCOMMAND string `help:"climc subcommand" subcommand:"true"`
|
||||
}
|
||||
|
||||
func getSubcommandsParser() (*structarg.ArgumentParser, error) {
|
||||
@@ -222,16 +222,13 @@ func newClientSession(options *BaseOptions) (*mcclient.ClientSession, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if options.ApiVersion != "" {
|
||||
mcclient.DisableApiVersionByModule()
|
||||
}
|
||||
session := client.NewSession(
|
||||
context.Background(),
|
||||
options.OsRegionName,
|
||||
options.OsZoneName,
|
||||
options.OsEndpointType,
|
||||
cacheToken,
|
||||
options.ApiVersion)
|
||||
)
|
||||
return session, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func init() {
|
||||
svcUrl string
|
||||
)
|
||||
if len(opts.Service) > 0 {
|
||||
svcUrl, err = s.GetServiceURL(opts.Service, "")
|
||||
svcUrl, err = s.GetServiceURL(opts.Service, "", "")
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "get service %s url", opts.Service)
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ func init() {
|
||||
if opts.All {
|
||||
resSets := sets.NewString()
|
||||
mods, _ := modulebase.GetRegisterdModules()
|
||||
for _, ress := range mods {
|
||||
resSets.Insert(ress...)
|
||||
}
|
||||
resSets.Insert(mods...)
|
||||
resources = resSets.List()
|
||||
}
|
||||
if len(resources) == 0 {
|
||||
|
||||
@@ -62,7 +62,7 @@ func newClientSession(options *options.CloudMonOptions) (*mcclient.ClientSession
|
||||
"",
|
||||
options.EndpointType,
|
||||
token,
|
||||
options.ApiVersion)
|
||||
)
|
||||
|
||||
return session, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user