From 9043bbf545d244b2dee9eefc5031d5dca1ccf78f Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Thu, 21 Mar 2024 02:37:29 +0530 Subject: [PATCH] Expose getClusterRegInfo (#4881) so that it can be used by other projects (e.g. console) instead of duplicating the logic. --- cmd/license-register.go | 2 +- cmd/subnet-utils.go | 5 +++-- cmd/support-perf.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/license-register.go b/cmd/license-register.go index c5e547a5..8809c187 100644 --- a/cmd/license-register.go +++ b/cmd/license-register.go @@ -232,7 +232,7 @@ func mainLicenseRegister(ctx *cli.Context) error { } } - regInfo := getClusterRegInfo(getAdminInfo(aliasedURL), clusterName) + regInfo := GetClusterRegInfo(getAdminInfo(aliasedURL), clusterName) lrm := licRegisterMessage{Status: "success", Alias: alias} if !globalAirgapped { diff --git a/cmd/subnet-utils.go b/cmd/subnet-utils.go index ec33a769..c7a19c2b 100644 --- a/cmd/subnet-utils.go +++ b/cmd/subnet-utils.go @@ -431,7 +431,8 @@ func setSubnetLicense(alias, lic string) { setSubnetConfig(alias, "license", lic) } -func getClusterRegInfo(admInfo madmin.InfoMessage, clusterName string) ClusterRegistrationInfo { +// GetClusterRegInfo - returns the cluster registration info +func GetClusterRegInfo(admInfo madmin.InfoMessage, clusterName string) ClusterRegistrationInfo { noOfPools := 1 noOfDrives := 0 for _, srvr := range admInfo.Servers { @@ -596,7 +597,7 @@ func getSubnetAPIKeyUsingAuthHeaders(authHeaders map[string]string) (string, err } func getSubnetLicenseUsingAPIKey(alias, apiKey string) (string, error) { - regInfo := getClusterRegInfo(getAdminInfo(alias), alias) + regInfo := GetClusterRegInfo(getAdminInfo(alias), alias) _, lic, e := registerClusterOnSubnet(regInfo, alias, apiKey) return lic, e } diff --git a/cmd/support-perf.go b/cmd/support-perf.go index fd879fd3..de3a8432 100644 --- a/cmd/support-perf.go +++ b/cmd/support-perf.go @@ -480,7 +480,7 @@ func execSupportPerf(ctx *cli.Context, aliasedURL, perfType string) { resultFileNamePfx := fmt.Sprintf("%s-perf_%s", filepath.Clean(alias), UTCNow().Format("20060102150405")) resultFileName := resultFileNamePfx + ".json" - regInfo := getClusterRegInfo(getAdminInfo(aliasedURL), alias) + regInfo := GetClusterRegInfo(getAdminInfo(aliasedURL), alias) tmpFileName, e := zipPerfResult(convertPerfResults(results), resultFileName, regInfo) fatalIf(probe.NewError(e), "Unable to generate zip file from performance results")