Use --api-key flag on register when provided (#4458)
This commit is contained in:
+11
-6
@@ -170,13 +170,18 @@ func mainLicenseRegister(ctx *cli.Context) error {
|
||||
regInfo := getClusterRegInfo(getAdminInfo(aliasedURL), clusterName)
|
||||
|
||||
alreadyRegistered := false
|
||||
apiKey, _, e := getSubnetCreds(alias)
|
||||
fatalIf(probe.NewError(e), "Error in fetching subnet API Key")
|
||||
if len(apiKey) > 0 {
|
||||
alreadyRegistered = true
|
||||
if len(accAPIKey) == 0 {
|
||||
if len(accAPIKey) == 0 {
|
||||
apiKey, _, e := getSubnetCreds(alias)
|
||||
fatalIf(probe.NewError(e), "Error in fetching subnet API Key")
|
||||
if len(apiKey) > 0 {
|
||||
alreadyRegistered = true
|
||||
accAPIKey = apiKey
|
||||
}
|
||||
} else {
|
||||
apiKey := getSubnetAPIKeyFromConfig(alias)
|
||||
if len(apiKey) > 0 {
|
||||
alreadyRegistered = true
|
||||
}
|
||||
}
|
||||
|
||||
lrm := licRegisterMessage{Status: "success", Alias: alias}
|
||||
@@ -189,7 +194,7 @@ func mainLicenseRegister(ctx *cli.Context) error {
|
||||
lrm.URL = subnetOfflineRegisterURL(regToken)
|
||||
} else {
|
||||
lrm.Type = "online"
|
||||
_, _, e = registerClusterOnSubnet(regInfo, alias, accAPIKey)
|
||||
_, _, e := registerClusterOnSubnet(regInfo, alias, accAPIKey)
|
||||
fatalIf(probe.NewError(e), "Could not register cluster with SUBNET:")
|
||||
|
||||
lrm.Action = "registered"
|
||||
|
||||
Reference in New Issue
Block a user